Files
OBLITERATUS/docs/distributed-model-load.md
Joseph Magly 002e6e56e1 feat: complete local readiness across UI, MCP and memory admission
Integrate bounded admission, UI ownership and controls, opt-in durable MCP execution, rank-local TP2 groundwork, regression hardening and operator guides. Physical larger-memory and two-host qualification remain separate.
2026-10-20 17:58:20 -04:00

225 lines
14 KiB
Markdown

# EXPERIMENTAL distributed model-load candidate
OBLITERATUS contains an **EXPERIMENTAL** development adapter for loading one
exact dense, bias-free, untied `LlamaForCausalLM` checkpoint with Transformers native tensor
parallelism. This experimental TP2 stack was accepted in
[issue #244](https://github.com/elder-plinius/OBLITERATUS/issues/244). It is not
a supported user workflow, does not add a model-surgery command, and does not
establish physically qualified multi-host operation.
The [rank-local candidate](distributed-rank-local.md) adds schema-v3 private
per-rank attempts/load evidence and bounded summary exchange. Its closed storage
registry is empty; ordinary two-host refusals and `not_qualified` status remain.
The default CPU/offline suite proves the schema, registry, artifact admission,
placement mathematics, evidence, consensus, and failure contracts (E0/E1). The
required two-GPU lane has not yet qualified an exact candidate (E2). Until that
retained lane passes, documentation and tracker records must describe native TP
loading as `not_qualified`.
## Exact admitted row
The registry contains one row:
| Property | Required value |
|---|---|
| Adapter | `llama-for-causal-lm-bf16-native-tp2-v1` |
| Model/config class | `LlamaForCausalLM` / `LlamaConfig` |
| Layout | Dense, bias-free, untied Llama decoder |
| Precision/artifact | BF16 Hugging Face safetensors only |
| Tensor-parallel world | Classifier: exactly two ranks in one-host/two-local-GPU or two-host/one-local-GPU-per-host form; live GPU preflight admits only the one-host form |
| Control/data planes | Retained Gloo control group and explicit NCCL one-dimensional device mesh |
| Torch | `2.13.0` |
| Transformers | `5.15.0` |
| Accelerate | `1.14.0` |
| safetensors | `0.8.0` |
| Runtime parameter storage | Ordinary rank-local `Parameter` objects |
The project describes placement as **DTensor-equivalent logical placement**.
It does not claim that the pinned Transformers implementation retains runtime
DTensor parameter objects. The private manifest records the global shape,
rank-local shape, complete shard intervals, owners, replicas/ties, hook sites,
surgery roles, and `local_tensor_parameter` as the observed storage kind.
The fixed native plan is column-wise for the attention Q/K/V projections and
MLP gate/up projections, row-wise for attention output and MLP down projections,
and column-wise with gathered output for `lm_head`. `auto`, inferred, partially
matched, changed, or fallback plans are refused.
## Admission boundary
Model loading requires a successful fixed-membership preflight in the
same process and live Gloo group. A schema-version 2 profile adds this required
section to the existing closed profile:
```json
{
"model": {
"adapter_id": "llama-for-causal-lm-bf16-native-tp2-v1",
"artifact_revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"hf_config_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"load_timeout_seconds": 120
}
}
```
`artifact_revision` is a 40-to-64-character lower-case hexadecimal immutable
revision or project-generated fixture digest. `hf_config_digest` is the
canonical digest of the exact admitted `config.json`. These fields supplement;
they do not replace the preflight source/model/tokenizer, code, commit,
topology, software, storage, and evidence bindings.
The source must already exist as an immutable local directory. Workers do not
download models, use Hub credentials, execute remote/custom code, load pickle,
install packages, compile extensions, invoke the ordinary loader, use
`device_map`, offload, retry, or choose an alternate plan. Quantized/packed,
adapter, MoE, multimodal, recurrent/SSM/hybrid, tied, custom-kernel, unknown,
extra, missing, or non-BF16 state is rejected before model construction.
An exact execution also binds separate digests for the acquisition manifest,
profile, code checkout, dependency lock, installed package tree, runtime,
installed TP API, immutable image, CUDA Torch wheel, hardware, topology, and
both process groups. The closed external profile supplies seven independently
reviewed expected identities: acquisition manifest, lock, package set, runtime,
installed API, image, and CUDA Torch wheel. Every candidate worker recomputes
the package-set, runtime, and reviewed installed-API fingerprints and fails on
drift. The session derives and validates the other fifteen bindings from the
accepted profile, live preflight, process groups, mount, loaded handle, and
manifest. This avoids asking an operator to predict runtime identities such as
the post-preflight attestation digest.
Version strings are not substitutes for these identities.
The immutable-source mechanism and read-only mount/object identity must be
observed; file mode bits alone are insufficient.
The TP2 deployment shape is also a closed identity. `local_tp2` means global
ranks 0 and 1 are local ranks 0 and 1 in host group 0. `two_host_tp2` means
global ranks 0 and 1 are each local rank 0 in distinct host groups 0 and 1.
No hybrid, oversubscribed, reordered, elastic, heterogeneous, or larger shape
is accepted. Host, device, rank-map, and topology-plan digests are recomputed
from the complete preflight attestation set and bound into load evidence.
The two rank numbers intentionally have different meanings on the two-host
shape: the TP mesh rank remains the global TP shard ordinal (0 or 1), while the
CUDA device index is the torchrun `LOCAL_RANK` (0 on each host). The pinned
Transformers loader selects the CUDA device from `LOCAL_RANK`; treating global
rank 1 as CUDA device 1 on host 2 is a contract failure.
### Cross-stage two-host boundary
Part 6 of upstream issue #244 admits the two-host identity at the code level.
It does not authorize a live two-host attempt. The current stage decisions are:
| Stage | Two-host decision and reason |
|---|---|
| PREFLIGHT / live model session | Terminal refusal with the same `LMS_TOPOLOGY_UNSUPPORTED` on every rank during layout admission, before lifecycle identity consensus and staging access. Record construction, gather (including peer poison), and comparison failures use the same terminal outcome. Direct preflight, `execute_preflight`, the CLI, and live/execute model-session entry points preserve this outcome through bounded local control-group teardown. No attempt directory is created or opened; no staging probe, receipt read/write, shared evidence publication/read, or filesystem cleanup runs. Rank-zero attempt creation, shared nonce probes, and terminal receipts require shared filesystem visibility that has no physical two-host qualification. No model or NCCL data plane is allocated. |
| Model adapter / NCCL mesh identity | Code-level acceptance only: global ranks own TP shards, while CUDA selection uses `LOCAL_RANK=0` on both hosts. Source bytes and read-only content-root mounts are checked locally; the live preflight refusal prevents physical execution. |
| PROBE / DISTILL | Compatible at the code level: the coordinator reads its own tokenizer, broadcasts inputs and decisions, and each rank admits its own host-memory budget through the existing unanimous vote. A worker with insufficient RAM vetoes the stage. |
| EXCISE / rollback journals | Compatible at the code level: resources and CUDA devices are rank-local, and each rank creates, validates, restores, and removes its own exclusive journal. Journal parents need not be shared. |
| VERIFY | Compatible at the code level: identical inputs and decisions use group collectives; metric buffers and resource admission are local to each rank. No peer-written files are loaded. |
| Canonical EXPORT | Independently refused with `LMS_EXPORT_TOPOLOGY_UNSUPPORTED` through unanimous entry votes before resource or filesystem work. Multiple writer ranks, both reload validators, and rank-zero atomic publication consume a shared destination sibling directory outside the attested preflight attempt. |
| Launcher | Compatible at the code level: fixed global/group/local rank geometry and numeric network `env://` rendezvous; no rendezvous file or CUDA index derived from global rank. |
Focused CPU-only mocks cover these refusals and compatible identities. They
do not supply physical evidence. Enabling live two-host execution requires
reviewed filesystem protocols and retained same-head two-host E3/E4 evidence,
including over-one-host capacity. The stack remains **EXPERIMENTAL** and
`not_qualified`, with no support row or operator surgery CLI.
Issue #287's [shared-filesystem design review](distributed-shared-storage-plan.md)
records the missing pre-ownership storage, lifetime namespace and publication
invariants and a staged implementation/test plan. No new storage configuration
is accepted in this version. A shared mount supplied by an operator does not
make `candidate_two_host_gpu` executable or qualified. The future capability
must be bound through preflight, exact load evidence and export together.
For an admitted single-host workload, choose ordinary complete-module placement
instead of this internal TP2 adapter; see [GPU qualification](gpu-qualification.md).
## Lifecycle and evidence
The model session owns the transition from an accepted preflight capability to
`LOADED`. It keeps the Gloo control group live, creates the exact NCCL data
plane, contains FD1/FD2 plus Python warnings/logging, validates the model and
complete placement manifest, publishes one private record per rank, reaches
bounded rank consensus, and then requires unanimous `LOADED` stage messages.
An outer process supervisor must be able to terminate native code that does not
honor a Python deadline.
The internal `live_model_session` context yields the validated model handle and
both live group capabilities only after evidence and unanimous `LOADED`. It
keeps them guarded until the context exits, allowing later roadmap stages to
continue the same lifecycle. The narrower `execute_model_session` wrapper is a
load-only verifier: it closes the live capability and completes teardown before
returning digest-only results.
Any disagreement, unexpected output, timeout, rank loss, source change,
evidence failure, or uncertain cleanup aborts the whole fixed attempt. There is
no fallback or in-process retry. Cleanup uncertainty is `QUARANTINED`; retry
requires fresh run and rendezvous identities and fresh worker processes.
Full manifests remain in an owner-only local evidence directory. Collectives,
CI summaries, and tracker records contain only bounded counts, digests, stable
`LMS_*` codes, evidence tier, and result. Raw paths, hosts, device identifiers,
exceptions, environment, prompts, tokens, tensors, and model values are not
retained.
Evidence tiers are closed:
- `protocol_cpu` proves code-verifiable E0/E1 behavior and explicitly records
GPU, NCCL, and native-TP noncoverage.
- `candidate_local_gpu` is permitted only after the exact two-GPU lane executes
every mandatory parity, activation, manifest, resource, fault, cleanup, and
evidence assertion at one signed candidate head.
- `candidate_two_host_gpu` is the distinct, unaccepted evidence label for the
closed `two_host_tp2` layout. Its schema and fail-closed topology classifier
are code-verifiable, but the label cannot be produced as qualification
evidence until an approved physical two-host (E3/E4) profile runs on the
exact candidate.
No tier claims over-one-host capacity, production readiness, transport
authentication/encryption, or support. In particular,
`candidate_two_host_gpu` existing in the schema is not proof that it has run.
## Conditional two-GPU gate
The `llama-tp-local-gpu` gate is manual and currently `not_qualified`. It
requires exactly two homogeneous CUDA GPUs with native BF16, Gloo and NCCL, an
exact signed checkout, a local hash-verified CUDA Torch wheel, and externally
provisioned exact image/package/runtime/API identities. Its tiny Llama fixture
and single-process reference are generated locally and never downloaded; the
read-only reference safetensors digest is bound into the acquisition record.
```bash
export OBLITERATUS_LLAMA_TP_EVIDENCE_PATH=conditional-evidence/llama-tp-hardware.json
python scripts/run_conditional_gate.py llama-tp-local-gpu
python scripts/check_llama_tp_hardware_evidence.py \
--evidence conditional-evidence/llama-tp-hardware.json \
--candidate-sha "$CONDITIONAL_CANDIDATE_SHA" \
--image-digest "$OBLITERATUS_TP_IMAGE_DIGEST" \
--lock uv.lock \
--torch-wheel-digest "$OBLITERATUS_TP_TORCH_WHEEL_SHA256" \
--package-digest "$OBLITERATUS_TP_PACKAGE_DIGEST" \
--runtime-digest "$OBLITERATUS_TP_RUNTIME_DIGEST" \
--api-digest "$OBLITERATUS_TP_API_DIGEST"
```
These commands are qualification tooling, not an operator model-load command.
A selected CI job rejects skipped tests and missing evidence; unavailable
hardware produces explicit noncoverage rather than a pass.
## Deliberate remaining boundary
The **EXPERIMENTAL**, `not_qualified`
[PROBE/DISTILL candidate](distributed-probe-distill.md),
[transactional EXCISE/rollback candidate](distributed-excise.md),
[collective VERIFY candidate](distributed-verification.md) and
[bounded canonical export candidate](distributed-export.md) now extend the
live model capability, and the closed two-host topology classifier
admits one GPU on each of two hosts at the code level. Live GPU preflight and
canonical EXPORT refuse that layout as described above. A multi-host support
claim still requires an approved exact profile and same-head evidence from at
least two physical hosts, including a model whose admitted live state exceeds
one qualified host (E3/E4). This adapter does not establish that support.
See the [preflight contract](distributed-preflight.md),
[conditional testing policy](conditional-testing.md).