Repository navigation
fix(checkpoint): keep the calls a restored turn carried over under forest training - #5147
Conversation
…arity Under token_capture.forest_training the trainer names each row <group>_g<i>_s<segment>, and the parity check rejected them as invalid sample IDs. Accept the single segment _s0, which still compares one trained row per rollout, and fail clearly on a later segment. With #5147 applied, the prefix-recovery test passes under forest training: 8 restored episodes seal as their next attempt and all 8 trained rows match the uninterrupted run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…arity Under token_capture.forest_training the trainer names each row <group>_g<i>_s<segment>, and the parity check rejected them as invalid sample IDs. Accept the single segment _s0, which still compares one trained row per rollout, and fail clearly on a later segment. With #5147 applied, the prefix-recovery test passes under forest training: 8 restored episodes seal as their next attempt and all 8 trained rows match the uninterrupted run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
terrykong
left a comment
There was a problem hiding this comment.
@aroshanghias-nvd can you help review?
…arity Under token_capture.forest_training the trainer names each row <group>_g<i>_s<segment>, and the parity check rejected them as invalid sample IDs. Accept the single segment _s0, which still compares one trained row per rollout, and fail clearly on a later segment. With #5147 applied, the prefix-recovery test passes under forest training: 8 restored episodes seal as their next attempt and all 8 trained rows match the uninterrupted run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
aroshanghias-nvd
left a comment
There was a problem hiding this comment.
Reviewed 44f1b433. The ownership rule matches Gym’s reconstruction semantics, and all four forest validation points use it consistently. No blocking issues found.
Locally, 409 affected CPU tests passed. Two additional tests covering a connected chain across one and two restores also passed, preserving one training row and counting each generated token once. Suggest adding those as permanent regressions; nonblocking. I haven’t independently rerun the live functional test.
|
/ok to test 33434dc |
@macandro96, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 44f1b43 |
terrykong
left a comment
There was a problem hiding this comment.
Thanks for tracking this down. The fix is right: all four Forest ownership checks now follow Gym's rule, and the new retry log line makes data retries visible. We found no bugs. There are three comments, two about tests and one about the copied Gym rule:
- (C1) No test reaches the actor's
capture_receiptschange on the accept side. - (C2) The
later_attemptcase tests the rollout-id check, not the new attempt check, and no test covers a second restore. - (C4) The ownership rule is copied from Gym. Call Gym's function instead, so the two cannot drift.
Each test fix was run against the head and against a copy of the code with that check broken. The C4 change returns the same result as the current code on 480 cases.
Before merge: the branch is 14 commits behind main, and "Check if PR branch is up to date" fails (limit 10), so please update the branch. The CI test lanes are green.
Generated by Claude Code
…rest training Turn-level recovery (#4500) continues a restored episode as its next attempt (<rollout_id>-a<N>) and keeps the calls the earlier attempt made, still staged under that attempt's key. Forest training's ownership checks (#4124, #4200) predate this and required every manifest row to be staged under the current attempt's key. So every continued episode that had made a model call before the checkpoint failed with "Forest recovery has foreign staging ownership"; the rollout manager counted a data retry and regenerated the episode from its prompt without logging why. Training stayed correct, but turn (and prefix) recovery saved nothing under forest training. Accept a row staged under the current attempt or an earlier attempt of the same rollout, the rule Gym's rebuild already applies through each carried row's source_capture_key, at all four Forest ownership checks: the recovery ledger, the finalizer request, selected-call planning and logical-row finalization. Rows of another rollout or a later attempt are still refused. Also print each data retry with its error, so a prompt that is silently regenerated shows why in the log. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…p names Mirror Gym's rebuild instead of accepting any earlier attempt's key: a manifest call without source_capture_key must be staged under the receipt's own attempt, and a carried call must be staged under exactly the attempt its stamp names, which must be an earlier attempt of the same rollout. The recovery ledger checks this at seal time, before the rebuild does, and decides which rows cleanup claims, so it now claims only rows a restore explicitly carried over. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…heck Address the first review of #5147: - C1: the continued-attempt test also reads the request's capture_receipts, which cleanup uses and finalize() never reaches, so reverting the reassembler actor's ownership check now fails a test. - C2: the continued Forest state builds its carried owner from its own ledger, so the later-attempt case reaches the attempt check instead of the rollout-id check, and a second restore (-a2 carrying calls from attempt 0 and -a1) is covered. - C4: _owned_staging_key calls Gym's rebuild._staging_owner instead of restating it, so RL cannot drift from the rule Gym's rebuild applies. The old and new rule agree on 120 owner, stamp and call-id cases. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
44f1b43 to
cbcd08f
Compare
|
/ok to test cbcd08f |
What does this PR do ?
Fixes turn-level rollout recovery under
token_capture.forest_training. Before this PR, every restored episode that had already made a model call was quietly regenerated from its prompt instead of continued.Issues
Found while testing generation-prefix recovery with forest training (#4506, review threads C26/C56).
The problem
Turn-level recovery (#4500) continues a restored episode as its next attempt,
<rollout_id>-a<N>. The calls the earlier attempt made are kept and stay staged under that attempt's key (Gym stamps each carried row withsource_capture_key). A continued receipt therefore mixes keys:Forest training's ownership checks (#4124, #4200) landed before turn recovery and require every row to be staged under the current attempt's key. Every continued episode with a call from before the checkpoint therefore failed with:
generate_for_finalizationtreats that as a data failure. It countedrollout/data_retry_total/ValueErrorand regenerated the episode from its prompt, without logging why. Training data stayed correct, but turn recovery (and prefix recovery, #4506) saved no work under forest training.Changes
rollout_recovery.py_owned_staging_key(owner, call_id, source_capture_key): the one key a manifest call must be staged under. A call with nosource_capture_keystamp must be under the receipt's own attempt. A carried call must be under exactly the attempt its stamp names, which must be an earlier attempt of the same rollout (the rule Gym'srebuild._staging_ownerapplies). Used by the ledger's_attempt_staging_keys, which runs at seal time and decides which rows cleanup claims.rollout_reassembler_actor.py,rollout_reassembler.pycapture_receipts), selected-call planning (_plan_selected_calls) and logical-row finalization (_finalize_logical_rows).rollout_manager.pyretrying prompt idx=… after deterministic failure n/max (<Error>: …), matching the existing "skipping prompt" line.Rows of another rollout or a later attempt are still refused, and so is a row under an earlier attempt's key without the stamp a restore adds.
Testing
test_rollout_recovery.py: a ledger restore of a continued forest attempt keeps the pre-checkpoint call; rows from a later attempt, another rollout, or an earlier attempt without a stamp are refused.test_selected_forest_boundaries.py: forest finalization through the reassembler actor trains a call staged by the earlier attempt and a call staged after the restore exactly once; a row of another rollout or an unstamped earlier row is refused.mainwith the errors above; the two unstamped cases fail if any earlier attempt's key is accepted without its stamp.test_selected_forest_boundaries.py,test_rollout_recovery.py,test_forest_dispatch.py,test_logical_owner_finalization.py), 241 passed;test_rollout_redispatch.py,test_rollout_generation_failures.py, 89 passed.grpo_async_gym_single_controller_turn_recovery.shlocally:++token_capture.forest_training=true loss_fn.token_level_loss=true loss_fn.sequence_level_importance_ratios=false grpo.calculate_advantages_on_gpu=false: fails onmain("restored Gym episode never completed", 1 data retry); passes with this PR (256 s, no data retry);🤖 Generated with Claude Code