Skip to content

fix(train): let SFT retrieval replay run one epoch instead of a guessed step count - #140

Merged
ppodolsky merged 1 commit into
mainfrom
audit-llm-code-and-repos
Aug 8, 2026
Merged

fix(train): let SFT retrieval replay run one epoch instead of a guessed step count#140
ppodolsky merged 1 commit into
mainfrom
audit-llm-code-and-repos

Conversation

@ppodolsky

Copy link
Copy Markdown
Contributor

Follow-up to #138, found by the live SFT run crashing.

What happened

The four retrieval replay phases I added in #138 each requested 1,200 optimizer steps. That number was invented rather than measured, and the smallest shard cannot supply it — the language-foundations retrieval split yields 46 steps at seq 512 / batch 8 / accumulation 4.

The live run completed its summarization phase (1,500 steps, loss 3.12 → 2.30), entered retrieval replay, ran 19 healthy steps at 38k tok/s, then died:

workflow phase `replay-retrieval-language-foundations-seq512` requested
1200 optimizer steps, but its data and epochs produced 46

It then looped 34 times under the supervisor — restore checkpoint 1500, run ~20 steps, die — for about four hours. The supervisor behaved correctly; it cannot distinguish a transient failure from a deterministic one.

validate-workflow cannot catch this. It validates configuration; the shortfall is only visible by reading the data.

Fix

steps is optional in WorkflowV2, so the replay phases now run one epoch of whatever their shard actually holds.

The trade-off is real and worth stating: epoch-bounded phases force the trainer to enumerate each phase's data at startup to compute its length. Measured at ~6 minutes for this workflow, with the GPU idle. The first run started training in seconds precisely because every phase had a hardcoded step count. I consider that a good trade — phases that adapt to the corpus beat phases that assert a size the corpus may not have — but if startup cost matters more than adaptability, the alternative is explicit per-shard step counts measured against real capacity.

Cost

Changing the workflow changes the run signature, so the interrupted run's step-1500 checkpoint could not be resumed. It is preserved (checkpoint-abandoned-1500 on the box, and the 17.6 GB GCS prefix moved aside rather than deleted) and the run restarted from the pretrained weights — about 1.6 hours of A100 time.

Verified: workflow validates locally and on the training host; the restarted run is training at 89% GPU.

…ed step count

The retrieval replay phases added in the previous commit each requested 1200
optimizer steps. That number was invented, not measured, and the smallest
shard cannot supply it: the language-foundations retrieval split yields 46
steps at seq 512 / batch 8 / accumulation 4. The live SFT run completed its
summarization phase, entered retrieval replay, ran 19 steps, and died with

    workflow phase `replay-retrieval-language-foundations-seq512` requested
    1200 optimizer steps, but its data and epochs produced 46

then looped 34 times under the supervisor, restoring the same checkpoint and
failing identically for about four hours. validate-workflow cannot catch this:
it checks configuration, and the shortfall is only visible by reading the data.

`steps` is optional, so the four replay phases now run one epoch of whatever
their shard holds. This costs a one-time startup scan -- the trainer must
enumerate each epoch-bounded phase's data to compute its length, measured at
about six minutes for this workflow -- in exchange for phases that adapt to
the corpus instead of asserting a size it may not have.

Changing the workflow changes the run signature, so the interrupted run's
step-1500 checkpoint could not be resumed; it is preserved locally and in GCS
and the run restarted from the pretrained weights.
@ppodolsky
ppodolsky merged commit 0c30744 into main Aug 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant