Repository navigation
fix(genome): a training plan must cover the loss peak it will pay, and a killed run must leave the measurement that explains it - #4389
Conversation
…d a killed run must leave the measurement that explains it
Why there is no learning on the 5090 — measured, not inferred. Kimi's genome
holds 87 ledger events and 40 terminal ones; the last (job b73456e6,
2026-09-25 00:23Z) is not a missing feature, it is:
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 1.89 GiB.
GPU 0 has a total capacity of 31.84 GiB of which 1.05 GiB is free.
28.91 GiB allowed; ... 27.36 GiB is allocated by PyTorch, and 1.34 GiB is
reserved by PyTorch but unallocated.
at transformers/loss/loss_utils.py:59 ForCausalLMLoss -> logits.float()
Everything around it worked: the planner ran, the resource governor admitted
the plan (`wait_for_training_memory` -> `acquire_guarded`), the trainer
honoured its admission ("28.91 GiB allowed"), and it died INSIDE that
admission — because the plan's logits term was 8 bytes per vocab entry per
token while the real peak holds three copies at once: the bf16 logits (2),
the fp32 upcast transformers makes of the whole tensor (4), and that copy's
fp32 gradient (4). A budget that is under the true peak is not a budget; it
is a guess that gets the job killed after it has already paid for the
weights.
- `LOGITS_BYTES_PER_TOKEN = 12` replaces the 8 in both the per-example fit
and the reported term, documented with the incident that set it. Erring
high costs a smaller micro-batch; erring low cost the entire run.
- `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` on the trainer command:
1.34 GiB of the card was fragmentation the allocator would not return, and
the OOM message asked for exactly this rather than more card.
- A killed run now writes `training-failure.json` (peakAllocatedBytes,
budgetBytes, microBatchSize, sequenceLength, logitsBytesPerToken) before
re-raising. `training-provenance.json` already recorded the peak on
SUCCESS — the one case where nobody needs it. The OOM left a traceback and
no numbers, so the estimate that caused it could not be calibrated from its
own failure. Best-effort, and the raise is unconditional: it never masks.
The next attempt either completes at a smaller micro-batch or reports its
plan-vs-actual miss as a number.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Review (Claude, M5) at ac610a4: APPROVE. Merge when CI is green at this exact head. The fix is right. The budget now covers the loss peak (bf16 logits, their fp32 upcast, and the upcast's gradient), Non-blocking note: the comment says the peak also holds "the shifted copy cross-entropy makes internally," but 12 doesn't count one. Cross-entropy's saved fp32 log-softmax is another candidate for the same slot. Either count it or drop the sentence. The new |
…NDOW is the lever — shed it to what the budget affords, never crash and never wait forever Measured consequence of getting the estimate right (#4389). Replaying Kimi's failed job b73456e6 through the corrected planner on this card: old plan memoryBytes 31,037,849,600 = 28.91 GiB ← the OOM's "28.91 GiB allowed" new plan memoryBytes 33,072,087,040 = 30.80 GiB the OOM 28.91 admitted + 1.89 short = 30.80 GiB needed So 12 bytes per vocab entry per token is not a guess — it predicts the real peak to the byte. What it exposes is that a 27B QLoRA at this sequence does not fit a 31.84 GiB card: `microBatchSize` was ALREADY 1, so the corrected plan asks for more than the card has and the job would now wait for capacity that never comes. An honest number that makes the job unrunnable is only half a fix. The window is the lever left: `admitted_window(sequence, tokens, affordable)` — the requested window when one example fits, else the affordable one BOUNDED ABOVE by the requested and floored at `MINIMUM_TRAIN_TOKENS` (512, below which the chunker is splitting a write-error-fix trajectory into fragments too small to carry the lesson; a plan that cannot afford that much is refused by its owner with the numbers rather than shrunk toward the chunker's floor of two). It only ever SHEDS — taking the floor alone would have handed back a LONGER window than requested whenever the budget is tiny, reporting 512 against the existing 32-token fixture's zero-byte plan. Same trade the serving planner makes for lanes: shed the window, never crash. The admitted window goes BACK through the owner into the trainer's schedule (`CudaPlan::sequence_length` → `spec.request.schedule.sequence_length`, probe `genome.train.window_shed`), so the chunker produces exactly the geometry the governor paid for — otherwise admission for one geometry is spent on another. Pure and pinned in CI: `admitted_window` is a plain function, so the 5090's numbers are a test (`test_the_admitted_window_only_ever_sheds`) and not a story — the real CUDA test stays opt-in. 4 trainer tests pass, numerics 6, `cargo check` clean. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…NDOW is the lever — shed it to what the budget affords, never crash and never wait forever Measured consequence of getting the estimate right (#4389). Replaying Kimi's failed job b73456e6 through the corrected planner on this card: old plan memoryBytes 31,037,849,600 = 28.91 GiB ← the OOM's "28.91 GiB allowed" new plan memoryBytes 33,072,087,040 = 30.80 GiB the OOM 28.91 admitted + 1.89 short = 30.80 GiB needed So 12 bytes per vocab entry per token is not a guess — it predicts the real peak to the byte. What it exposes is that a 27B QLoRA at this sequence does not fit a 31.84 GiB card: `microBatchSize` was ALREADY 1, so the corrected plan asks for more than the card has and the job would now wait for capacity that never comes. An honest number that makes the job unrunnable is only half a fix. The window is the lever left: `admitted_window(sequence, tokens, affordable)` — the requested window when one example fits, else the affordable one BOUNDED ABOVE by the requested and floored at `MINIMUM_TRAIN_TOKENS` (512, below which the chunker is splitting a write-error-fix trajectory into fragments too small to carry the lesson; a plan that cannot afford that much is refused by its owner with the numbers rather than shrunk toward the chunker's floor of two). It only ever SHEDS — taking the floor alone would have handed back a LONGER window than requested whenever the budget is tiny, reporting 512 against the existing 32-token fixture's zero-byte plan. Same trade the serving planner makes for lanes: shed the window, never crash. The admitted window goes BACK through the owner into the trainer's schedule (`CudaPlan::sequence_length` → `spec.request.schedule.sequence_length`, probe `genome.train.window_shed`), so the chunker produces exactly the geometry the governor paid for — otherwise admission for one geometry is spent on another. Pure and pinned in CI: `admitted_window` is a plain function, so the 5090's numbers are a test (`test_the_admitted_window_only_ever_sheds`) and not a story — the real CUDA test stays opt-in. 4 trainer tests pass, numerics 6, `cargo check` clean. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Why there is no learning on the 5090 — measured
Kimi's genome ledger holds 87 events, 40 terminal. The last (job
b73456e6, 2026-09-25 00:23Z) is not a missing feature:Everything around it worked. The planner ran, the governor admitted the plan (
wait_for_training_memory→acquire_guarded), the trainer honoured its admission ("28.91 GiB allowed") — and it died inside its own admission, because the plan's logits term was 8 bytes per vocab entry per token while the real peak holds three copies at once: bf16 logits (2), the fp32 upcast transformers makes of the whole tensor (4), and that copy's fp32 gradient (4).A budget under the true peak is not a budget; it is a guess that gets the job killed after it has paid for the weights.
Changes
LOGITS_BYTES_PER_TOKEN = 12replaces the 8 in both the per-example fit and the reported term, documented with the incident that set it. Erring high costs a smaller micro-batch; erring low cost the whole run.PYTORCH_CUDA_ALLOC_CONF=expandable_segments:Trueon the trainer command — 1.34 GiB was fragmentation the allocator would not return, and the OOM asked for exactly this rather than more card.training-failure.json(peakAllocatedBytes,budgetBytes,microBatchSize,sequenceLength,logitsBytesPerToken) before re-raising.training-provenance.jsonalready recorded the peak on success — the one case where nobody needs it. The OOM left a traceback and no numbers, so the estimate that caused it could not be calibrated from its own failure. Best-effort; theraiseis unconditional, so it never masks.Receipt to look for
The next attempt on this card either completes at a smaller micro-batch, or reports its plan-vs-actual miss as a number instead of a traceback.
cargo check -p continuum-core --libclean; trainer parses.Context
This is the first broken link in the flywheel on this node, ahead of the academy-borrow work: graded turns → curriculum → training → genome. Measured alongside it —
~/.continuum/datasets/is empty, citizens hold 1 experience record each (Sept 5–15), so the fuel is thin too; that is the next slice. Asha's prerequisites (validate_owned_launch,restore_owned_launch,EphemeralServingLane,ServingOperation, …) are all on canary; the daemon-owned teach batch she specified is still absent.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc