Repository navigation
feat(automodel): support streaming execution in Single Controller - #5149
yuekaizhang wants to merge 49 commits into
Conversation
Signed-off-by: Yuekai Zhang <[email protected]>
Retain reduced gradient shards and count/metric numerators across aligned dispatches, then normalize once before clipping and a single optimizer/scheduler update. Restore Gate diagnostics and buffers on abort, fence failed dispatches and uncertain commits, and drain issued worker RPCs before cancellation cleanup. Extend the fixed-input harness with normalized preclip gradients, compressed FusedAdam state and exact independent-update oracles. Document the original BF16 parameter-parity gate failure separately from passing gradient/execution checks. Keep in_order LA0, fixed text GRPO, zero auxiliary loss and zero positive NLL restrictions. Signed-off-by: Yuekai Zhang <[email protected]>
Record fixed-input numerical gates and mixed ready/in-flight checkpoint recovery. Include isolated CUDA kernel probes with controlled tail admission, EP16 FusedAdam qualification, and a 300-step streaming LA0 recipe gated on matching qualified sources. Reuse colleague convergence baselines. Signed-off-by: Yuekai Zhang <[email protected]>
Record afterok qualification and continuation jobs, distinguish queued runs from completed checks, and document the read-only monitor limits. Ignore generated Slurm status/log artifacts. Signed-off-by: Yuekai Zhang <[email protected]>
Ray services precede run.sh exports, so set the required non-secret model/cache/interpreter environment explicitly on remote torchrun tasks. Qualification failed before model initialization and the dependent training jobs remained blocked. Signed-off-by: Yuekai Zhang <[email protected]>
…ate failure Keep the original 1%/0.9999 gradient limits and record the failed Qwen3.5 EP16 comparison. Dependent long runs did not start. Add an independent full-input numerator backward versus streaming control with exact gradient/model/compressed-optimizer/scheduler assertions; passing this diagnostic cannot release training. The tiny native EP2/FusedAdam/activation-checkpointing control passed both loss normalizations. EP16 diagnostic is in progress. Preserve rank errors, original gates, and distinguish global-vector measurements from qualification. Signed-off-by: Yuekai Zhang <[email protected]>
…ploration All 16 Qwen3.5 EP16 ranks matched full-input numerator training exactly for normalized preclip gradients, parameters, raw/public FusedAdam state and scheduler, for token and sequence objectives. Early versus late BF16 normalization still differs by 1.34%/1.32%; preserve the failed original gate. Prepare an explicit exploratory LA0 300-step lane with matching qualified source hashes and separate checkpoint/W&B identity. Keep the default original qualification guard unchanged and distinguish additional convergence evidence from acceptance. Signed-off-by: Yuekai Zhang <[email protected]>
The first three 32-sample updates committed as two aligned dispatches each with lag zero; update three has a nonzero gradient. Keep original numerical qualification failure and pending convergence status explicit. Handle Slurm live-controller expiry using accounting rather than terminating the status collector. Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
…outs Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
…rves Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
…ency Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
Untrack local validation artifacts and the session design record while retaining implementation, regression tests, and the user guide. Remove the temporary normalization diagnostic and verbose update dump from the parity harness; keep numerical checks and limits unchanged. Signed-off-by: Yuekai Zhang <[email protected]>
66945f2 to
59f3dcd
Compare
Signed-off-by: Yuekai Zhang <[email protected]>
59f3dcd to
3d13b55
Compare
3d13b55 to
90deb51
Compare
Signed-off-by: Yuekai Zhang <[email protected]>
90deb51 to
c0aa722
Compare
yuekaizhang
left a comment
There was a problem hiding this comment.
The small step-lifecycle helper and typed step state keep ownership explicit and preserve the full-batch default. Seven inline comments cover a lost recovery error, failing checks, test coverage and maintenance. Five agents, including the lead, worked across seven review roles.
At the reviewed head, 73 controller/config/TQ tests passed; the AutoModel split-state suite had 26 passes and two failures; pinned pre-commit reported three type errors. Applying both proposed replacements together on a scratch copy passed every pinned hook and all 28 split-state tests. The disclosed BF16 qualification failure and lack of demonstrated end-to-end speedup remain limitations.
nemo-rl-review: kind=self harness=codex/0.166.0 model=gpt-6.1-sol effort=high review-pr-team=v3 reviewed=c0aa722
Signed-off-by: Yuekai Zhang <[email protected]>
|
/ok to test ea55472 |
|
@sharonyu-115 Could you help review the PR when you have some time? Thanks! |
sharonyu-115
left a comment
There was a problem hiding this comment.
Thanks for this PR. Streaming reuses the existing begin_train_step / train_microbatches_from_meta / finish_train_step / abort_train_step API instead of adding a second one, finish-time scaling comes from the shared get_objective_reduction / metric_normalizer_scales helpers, and the step state is typed. The gradient, loss, step-lifecycle and metric arithmetic was traced end to end with no error found, and the two-GPU FP32 two-dispatch parity test passes in CI.
Before merge
- (C18) Scope: please move the shared-path cancel-and-drain change into its own PR, or name the failure it prevents and show evidence for Megatron.
- (C9) An existing train-pump test helper breaks. CI is already red at head because of a
ray.waitline (covered by C18), and the single-controller unit tests have not run at head. - (C10) Convergence and speed evidence at the current head.
The rest
- Validation: (C12) a config can ask for streaming, pass validation and never split a step.
- Scope question: (C19) why streaming is limited to lookahead 0, and whether this PR can lift that with evidence.
- Tests: (C13) no streaming smoke and no MoE EP2 two-dispatch test; (C14) the lookahead guard has no test.
- Docs: (C17) the new guide section is hard-wrapped.
Self-review check: six of the seven self-review threads hold up against the code at head; the seventh (C6, a guide sentence about abort) depends on C18. Four more findings on the shared-path code are held until C18 is settled.
Six agents, including the lead, worked across eight review roles; no tests were run locally (no GPU on the review node), so runtime statements come from CI at ea55472 or from reading the source.
nemo-rl-review: kind=expert harness=claude-code/2.1.330 model=claude-fable-5-2 effort=medium review-pr-team=v3 reviewed=ea55472
Signed-off-by: Yuekai Zhang <[email protected]>
…ming Signed-off-by: Yuekai Zhang <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
There was a problem hiding this comment.
Merge blockers — please rebase on main and resolve conflicts.
Thanks for adding streaming GRPO support to Automodel in Single Controller.
Scope: Full diff at 8bd857a.
Checked:
- The sampler rounds ready prompt groups down to a size that splits evenly across policy DP ranks and fits local microbatches.
- Partial dispatches accumulate gradients in one open step. The Automodel worker applies step-wide normalization before clipping gradients and updating the policy once.
- Reported two policy training dispatches in each of the two smoke steps, with finite loss and gradient norm.
Remaining comments:
- Validate the MoE auxiliary-loss coefficient during streaming setup.
- Remove the unused gate diagnostic snapshots while preserving cumulative-load restoration.
- Add a streaming twin of the Qwen3.5 EP16 recipe and compare its results with full-batch in the PR body.
- Update the full-batch design doc to reflect streaming support.
nit
- Consolidate the streaming config checks.
- Reuse the shared sequence and token counting logic in the worker.
- Reuse the existing chunk counter for the smoke metric.
nemo-rl-review: kind=expert harness=codex/0.173.0 model=gpt-6.2-astra effort=medium review-pr-team=v3 reviewed=8bd857a
Signed-off-by: Yuekai Zhang <[email protected]>
|
/ok to test 2fe50df |
|
@sharonyu-115 @yuki-97 Thank you for reviewing. I've addressed your previous comments. Could you please check it again? |

What and why
AutoModel SingleController can start training while some prompt groups for the step are still generating. Each dispatch accumulates gradients, and the controller commits one optimizer update after the complete step. Full-batch dispatch remains the default.
flowchart LR A[Prompt groups ready] --> B[Dispatch a microbatch group] B --> C{Step batch complete?} C -- No --> A C -- Yes --> D[Normalize and update once] D --> E[Refit generation workers]For the eight-prompt Qwen recipe, set
async_rl.min_groups_for_streaming_train: 4and use thein_ordersampler withmax_lookahead_versions: 0. With 16 training DP ranks, four responses per prompt and microbatch size 1, the step can dispatch 4+4 groups.train/policy_train_dispatchesrecords the actual number of dispatches.The initial streaming scope is text GRPO with per-prompt advantages, full-parameter FSDP2, TP=CP=1, fixed microbatches and disaggregated async vLLM. See the SingleController guide for the supported configuration.
Issues
Part of #5090, PR3 for streaming AutoModel execution. The AutoModel full-batch foundation in #4963 is on
main.Convergence / perf / functionality proof
Follow-up commit
ea55472apassed 74 controller, configuration and TQ tests and 29 AutoModel tests on H100. The new two-GPU dense FP32 test compares two partial dispatches with synchronous full-batch training for token and sequence normalization, including unequal token masks and a masked row. Loss, gradient norm, per-microbatch metrics and final parameter shards match within the test tolerance. Pyrefly reported zero errors.Historical streaming LA0 runs completed 600 Qwen3.5 steps and 900 Gemma4 E2B IT steps. These are exploratory runs at earlier commits.
The original Qwen BF16 1% gradient-difference gate remains unmet. Matched-layout full versus split dispatch showed approximately 1.1–1.2% gradient difference. In the controlled replay, a full-input reference with deferred normalization matched split dispatch. Gemma fixed-input update parity remains unassessed. Numerical findings
Matched fixed-workload Qwen worker replay took about 5.63 s full versus 8.73 s split, excluding rollout, Ray and network time. Replay results
In the earlier LA0 comparison, mean end-to-end step time over steps 11–300 was 133.30 s with streaming and 133.59 s with full batch, effectively flat. Streaming lets the trainer process ready prompt groups while vLLM is still generating the rest of the step. The gain depends on how much computation can overlap with that wait and how much overhead splitting the batch adds.
In the four-node LA1 comparison (full batch, streaming 16+16), the median step time over 103 matched ordinary steps through step 120 was 199.26 s for full batch and 182.82 s for streaming 16+16, an 8.3% reduction. Both used local experiment commit
c88c303de. The comparison excludes validation steps, checkpoint-save steps, and the first step of each job segment.All seven self-review threads have been answered and resolved.
Qwen3.5 EP16 streaming recipe and run comparison
The three-node streaming recipe inherits the full-batch recipe and uses two dispatches of four prompt groups.
Both comparisons used Qwen3.5-35B-A3B, AutoModel Single Controller, seed 42, and AIME 2024 validation every 10 steps.
Needs upstream changes
None.