mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 02:24:12 +01:00
Review of 5a4835e: with no manifest global shape, a sharded head fell back
to mutable config.vocab_size, so 16-row shards with config vocab 16 passed
on both ranks. A vocab-sharded head now needs the manifest global row
extent corroborated by the live local weight shape and a complete even
shard layout (local rows x world size, per-rank start/end and rank
shards); config alone never establishes it, and anything else fails closed
with LMS_VERIFY_FORWARD_CONTRACT in baseline and post-edit revalidation.
Docs state the exact rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
199 lines
12 KiB
Markdown
199 lines
12 KiB
Markdown
# EXPERIMENTAL distributed VERIFY candidate
|
|
|
|
The **EXPERIMENTAL** TP2 stack in
|
|
[upstream issue #244](https://github.com/elder-plinius/OBLITERATUS/issues/244)
|
|
adds an internal fail-closed VERIFY adapter over
|
|
[part 3 EXCISE](distributed-excise.md). This candidate is `not_qualified`
|
|
and exposes no CLI, checkpoint writer, or support row. A successful result is a
|
|
private `VERIFIED` capability for
|
|
future export (part 5), subject to that part's acceptance gates. It provides
|
|
no physical multi-host / over-one-host-capacity evidence (E3/E4).
|
|
|
|
## Pristine baseline and input ownership
|
|
|
|
Verification begins before EXCISE. Rank 0 alone owns the ordered prompt text,
|
|
tokenizer operation, refusal-token set, and capability target tokens. The
|
|
preparation boundary sorts samples by the closed harmful, coherence, and
|
|
capability roles, tokenizes without truncation, and returns a private corpus
|
|
whose public metadata contains only counts and content digests. Every rank then
|
|
receives the same bounded token, mask, role, target, and refusal tensors.
|
|
|
|
The pristine pass records full float32 log probabilities only in private
|
|
memory. Configuration bounds the sample count, sequence width, batch size,
|
|
host baseline bytes, peak device bytes, safety margin, timeout, rank tolerance,
|
|
and every quality threshold before allocation. Host admission reserves
|
|
`H = I + 2S + max(F, M) + D`, plus `safety_margin_bytes`, where:
|
|
|
|
- `I = 16NW + 8(2N + R)` accounts for token/mask and decision-token inputs;
|
|
- `S = 4V(P + N)` is one retained float32 snapshot;
|
|
- `F = max(48BWV, 4NV)` bounds per-batch forward/comparison/log-probability
|
|
buffers (including CPU execution and padded-batch cloning overlap), plus
|
|
duplicate next-token rows during stacking and snapshot digest serialization;
|
|
- `M = 32CV + 128` bounds metric chunks and scalar accumulators, with the
|
|
module constant `_METRIC_CHUNK_ROWS` fixing `C = 16`;
|
|
- `D = 2 * TENSOR_DIGEST_CHUNK_BYTES` (8 MiB) bounds one contiguous CPU
|
|
digest chunk and its byte serialization. Whole-model hashing streams the
|
|
canonical bytes in order, including BF16 and non-contiguous tensors.
|
|
|
|
Before mutation, the live EXCISE/VERIFY wrapper additionally admits the combined
|
|
host peak `S + E + H + max(excise_margin, verify_margin)` against the runtime's
|
|
single available-memory observation, with a unanimous control-group vote and
|
|
`LMS_EXCISE_RESOURCE_DENIED` on rejection. Here `E = J + 3L` is EXCISE's own
|
|
host reservation excluding margin, `J` is the sum of selected local parameter
|
|
bytes, and `L` is the largest selected local parameter. This conservative bound
|
|
includes the retained pristine baseline, journal/restoration storage, and the
|
|
VERIFY peak together. The post-edit snapshot is released in a voted step before
|
|
rollback loads the pristine journal; the baseline remains for restoration proof.
|
|
|
|
Here `N` is sample count, `W` padded input width, `V` vocabulary size, `P` the
|
|
sum of non-padding sequence positions (`length - 1`), `R` refusal-token count,
|
|
and `B = min(batch_size, N)`. Device admission reserves
|
|
`48BWV + 16NW + safety_margin_bytes`. These are tensor working-set bounds;
|
|
the margin covers other host/runtime overhead. Padded CPU batches and forward
|
|
outputs are released inside the voted local step before the next batch or
|
|
snapshot digest. The baseline binds:
|
|
|
|
- run, DISTILL, manifest, expected EXCISE configuration, and verification
|
|
configuration identities;
|
|
- corpus, sample-order, tokenizer, and tokenization identities;
|
|
- every logical pristine parameter root; and
|
|
- the exact rank-agreed pristine log-probability stream.
|
|
|
|
Raw prompts, token IDs, masks, logits, log probabilities, model tensors,
|
|
journal paths, and absolute paths are excluded from summaries and repr output.
|
|
|
|
The tokenizer vocabulary bounds all input, refusal, and capability-target IDs.
|
|
The model output vocabulary may be larger because the head contains padded
|
|
columns. A replicated head's live weight row count takes precedence over
|
|
`out_features` and config. For a vocabulary-sharded head, the global row count
|
|
must come from `lm_head.weight.global_shape` in the parameter manifest and be
|
|
corroborated by its complete even-shard layout: the live weight must match
|
|
`local_shape`, local rows times world size must equal global rows, hidden
|
|
dimensions must match, and `shard_dim`, rank offsets, owner ranks, and all
|
|
`rank_shards` must describe that same partition. `config.vocab_size` alone
|
|
cannot establish a global extent, even when it equals the output width.
|
|
Every rank must return logits of exactly the corroborated global width and
|
|
at least the tokenizer width. Missing or inconsistent corroboration, or an
|
|
output width that differs from that extent, fails closed with
|
|
`LMS_VERIFY_FORWARD_CONTRACT` during baseline or post-edit forward validation.
|
|
Baseline capability revalidation also requires the same corroborated extent.
|
|
Rank shape/dtype
|
|
disagreement is a forward-contract failure before any logit data collective.
|
|
Baseline validation, snapshot storage, and memory admission use the full model
|
|
output width; plan and summary `vocab_size` retain their tokenizer meaning.
|
|
|
|
## Preregistered metrics
|
|
|
|
All metrics are computed in deterministic sample order over the same edited
|
|
model on every rank. KL and coherence reductions use fixed row chunks with
|
|
float64 accumulators; capability probabilities accumulate in sample order.
|
|
KL needs at most three simultaneous float64 chunks, and no metric allocates a
|
|
full-sequence float64 log-probability intermediate. Chunked reductions may
|
|
differ from a single full reduction by float64 rounding, while every rank uses
|
|
the same accumulation order and must agree on bit-identical metric records:
|
|
|
|
- **Refusal rate** is the fraction of harmful samples whose next-token argmax
|
|
over tokenizer-valid IDs belongs to the rank-zero-provided refusal-token set.
|
|
- **Coherence retention** is
|
|
`exp(min(0, pristine_sequence_nll - edited_sequence_nll))` over coherence
|
|
samples. It is one for unchanged or improved likelihood and approaches zero
|
|
as sequence likelihood regresses.
|
|
- **Forward KL** is the mean exact
|
|
`KL(pristine || edited)` over every non-padding next-token position.
|
|
- **Capability retention** is the edited-to-pristine ratio of the mean
|
|
preregistered capability-target probability, capped at one.
|
|
- **Non-finite count** must be zero. A non-finite model value, logit, or
|
|
aggregate is a refusal, never a score.
|
|
|
|
The vocabulary used at each reduction or selection boundary is explicit:
|
|
|
|
| Operation | Vocabulary and reason |
|
|
| --- | --- |
|
|
| Logit finiteness and rank comparison | Full output tensor, including model-only columns and padded input positions; padding never hides an invalid value or rank disagreement. |
|
|
| `log_softmax` and private snapshots/digests | Full model width, preserving the true model distribution and binding every column. |
|
|
| Refusal argmax (the only greedy selection) | Slice `[0, plan.vocab_size)`; model-only padded IDs cannot win a token decision. |
|
|
| Coherence NLL | Index only tokenizer-valid sequence targets into full-width log probabilities; retain full normalization without renormalizing the tokenizer slice. |
|
|
| Capability-target probability | Index only preregistered tokenizer-valid target IDs into full-width log probabilities; retain their true model probabilities. |
|
|
| Forward KL | Full distribution, including model-only columns, so changes in probability mass outside the tokenizer remain visible. |
|
|
|
|
The configuration digest commits the maximum refusal rate, minimum coherence
|
|
and capability retention, maximum forward KL, probability floor, rank
|
|
tolerances, and all resource/tokenizer bounds. Thresholds cannot be changed
|
|
after observing EXCISE output.
|
|
|
|
## Consensus, rollback, and terminal states
|
|
|
|
Before evaluating the edited model, VERIFY recomputes every logical parameter
|
|
root. Each intended mutable root must match its committed EXCISE postcondition;
|
|
every other parameter must match the pristine baseline. Each rank submits one
|
|
closed sequence-zero evidence record with the edit/baseline identity, pristine
|
|
and post-state roots, tokenization and logit-stream digests, canonical
|
|
hexadecimal metrics, and its quality vote. Missing, duplicate, stale,
|
|
malformed, non-finite, or divergent evidence prevents acceptance.
|
|
|
|
Rank 0 broadcasts one digest-bound `accept` or `abort` decision. An abort,
|
|
cancellation, signal-normalized callback, timeout, live rank error, changed
|
|
state, or quality failure invokes part 3 EXCISE journal restoration while the
|
|
fixed world is alive. After EXCISE restores its edited parameters, VERIFY
|
|
recomputes every logical parameter root and unanimously proves the full state
|
|
against the pristine baseline before rollback lifecycle messages or journal
|
|
deletion. A mismatch or inability to prove restoration retains the journals,
|
|
quarantines the transaction, and reports `LMS_VERIFY_STATE_UNCERTAIN`;
|
|
it never claims `ROLLED_BACK`. A clean rollback also requires successful
|
|
journal cleanup through the hardened EXCISE restoration path.
|
|
Success requires rank agreement on the summary, a final cancellation/deadline
|
|
check, removal of every private journal, and agreement on the
|
|
`MUTATING -> VERIFIED` lifecycle message. Continuation checks after cleanup
|
|
and lifecycle prevent those steps from silently exceeding the stage bound;
|
|
interruption after journal deletion is state uncertainty. Cleanup or lifecycle
|
|
uncertainty
|
|
sets the transaction to `QUARANTINED`, reports `LMS_VERIFY_STATE_UNCERTAIN`,
|
|
and returns no usable result or clean rollback claim.
|
|
|
|
Rank-local preparation, tensor copies/digests, metrics, validation, journal I/O,
|
|
and fault hooks vote unanimously before the next collective. Raw records enter
|
|
the symmetric consensus primitives so preparation failures still join their
|
|
fixed-shape gather with poison. VERIFY reserves sequences `[10_000_000,
|
|
17_000_000)`, disjoint from EXCISE. The primitives' fixed-size buffer allocation
|
|
and deterministic processing of identical gathered bytes remain the bounded
|
|
timeout / rank-loss boundary; they fail closed and never establish success.
|
|
Inference-mode construction and entry, input copies, and forward setup all
|
|
finish inside the preparation vote before entering the model. A rank-local
|
|
failure inside the model's forward, before or between its internal TP data
|
|
collectives, cannot be voted on from outside that forward. This is also a
|
|
process-fault boundary: the bounded process-group timeout / rank-loss path
|
|
must terminate the attempt with an LMS error and pristine restoration or
|
|
quarantine, never `VERIFIED`.
|
|
|
|
The adapter never retries in memory. The surrounding preflight already
|
|
requires distinct run and rendezvous identities, exclusively creates
|
|
`staging/<run_id>`, and rejects a pre-existing attempt directory. A retry
|
|
therefore reloads the immutable source in a new externally launched worker
|
|
group; neither a baseline, journal, staging directory, nor model object from a
|
|
prior attempt is accepted.
|
|
|
|
## Evidence scope
|
|
|
|
The mandatory CPU/Gloo oracle runs two fixed processes and covers accepted
|
|
verification, quality rollback, cancellation and signal normalization,
|
|
timeout, rank exit, non-finite output, state divergence, stale baselines,
|
|
missing/duplicate/stale/divergent rank evidence, coordinator failure, and
|
|
faults before and after baseline, evaluation, evidence, decision, cleanup, and
|
|
lifecycle boundaries. Vocabulary cases cover corroborated global-32/local-16
|
|
acceptance with gathered 32-wide logits, missing global metadata despite a
|
|
16-wide config and output, inconsistent global/local extents, identical
|
|
16-wide outputs under a corroborated global-32 head, rank width disagreement,
|
|
and a padded argmax that must still detect a tokenizer-valid
|
|
refusal and reject quality. These cases require the identical exact error code
|
|
on both ranks, bounded termination, and pristine state or proven rollback.
|
|
The oracle also checks that no failed path returns a `VerificationResult`.
|
|
|
|
The conditional `llama-tp-local-gpu` lane is wired to retain the earlier exact
|
|
native-TP rollback proof and to run a second immutable-source attempt with new
|
|
run, rendezvous, and staging identities through successful collective VERIFY.
|
|
It retains only digests, booleans, and aggregate metrics. The lane is currently
|
|
`not_qualified`; a skip is explicit LMS-E2 noncoverage. LMS-E3/E4 and all
|
|
support publication remain blocked on physical multi-host /
|
|
over-one-host-capacity evidence (E3/E4) and the remaining gates in upstream
|
|
issue #244.
|