Skip to content

feat(automodel): support streaming execution in Single Controller - #5149

Open
yuekaizhang wants to merge 49 commits into
NVIDIA-NeMo:mainfrom
yuekaizhang:yuekaiz/pr5090-automodel-streaming
Open

yuekaizhang wants to merge 49 commits into
NVIDIA-NeMo:mainfrom
yuekaizhang:yuekaiz/pr5090-automodel-streaming

Conversation

@yuekaizhang

@yuekaizhang yuekaizhang commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

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]
Loading

For the eight-prompt Qwen recipe, set async_rl.min_groups_for_streaming_train: 4 and use the in_order sampler with max_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_dispatches records 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 ea55472a passed 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.

Configuration Full batch Streaming Result
3 nodes, LA0 — 2 EP16 training nodes, 1 vLLM TP8 generation node, 8 prompts × 4 rollouts per step, 2,048 max generation tokens W&B run W&B run, 4+4 prompt groups At step 600, AIME accuracy was 42.81% full batch and 41.35% streaming. Streaming dispatched twice per step throughout the run.
4 nodes, LA1 — 2 EP16 training nodes, 2 vLLM generation nodes with 4 TP4 replicas total, 32 prompts × 16 rollouts per step, 4,096 max generation tokens W&B run W&B run, 16+16 prompt groups At step 120, AIME accuracy was 56.25% full batch and 56.46% streaming. Over 103 matched ordinary steps, median step time fell from 199.26 s to 182.82 s, an 8.3% reduction.

Needs upstream changes

None.

@copy-pr-bot

copy-pr-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Nov 10, 2026
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
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]>
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]>
@yuekaizhang
yuekaizhang force-pushed the yuekaiz/pr5090-automodel-streaming branch from 66945f2 to 59f3dcd Compare November 30, 2026 04:35
@github-actions github-actions Bot added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 30, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) labels Nov 30, 2026
@yuekaizhang
yuekaizhang force-pushed the yuekaiz/pr5090-automodel-streaming branch from 59f3dcd to 3d13b55 Compare November 30, 2026 04:44
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify) label Nov 30, 2026
@yuekaizhang
yuekaizhang force-pushed the yuekaiz/pr5090-automodel-streaming branch from 3d13b55 to 90deb51 Compare November 30, 2026 05:10
@yuekaizhang
yuekaizhang marked this pull request as ready for review December 1, 2026 06:57
@yuekaizhang
yuekaizhang force-pushed the yuekaiz/pr5090-automodel-streaming branch from 90deb51 to c0aa722 Compare December 1, 2026 07:48

@yuekaizhang yuekaizhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread docs/guides/single-controller.md Resolved
@yuekaizhang

Copy link
Copy Markdown
Contributor Author

/ok to test ea55472

@yuekaizhang

Copy link
Copy Markdown
Contributor Author
image

Attached results from streaming v.s. full-batch single-controller automodel experiments.

@yuekaizhang

Copy link
Copy Markdown
Contributor Author

@sharonyu-115 Could you help review the PR when you have some time? Thanks!

@sharonyu-115 sharonyu-115 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. (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.
  2. (C9) An existing train-pump test helper breaks. CI is already red at head because of a ray.wait line (covered by C18), and the single-controller unit tests have not run at head.
  3. (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

Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread docs/guides/single-controller.md Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread docs/guides/single-controller.md Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved

@yuki-97 yuki-97 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/guides/single-controller.md Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
@yuekaizhang

Copy link
Copy Markdown
Contributor Author

/ok to test 2fe50df

@yuekaizhang

Copy link
Copy Markdown
Contributor Author

@sharonyu-115 @yuki-97 Thank you for reviewing. I've addressed your previous comments. Could you please check it again?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants