Repository navigation
feat(single-controller): SGLang rollout-only simulator (no_op train backend) - #5085
shikicloud wants to merge 57 commits into
Conversation
Signed-off-by: Shiki Wu <[email protected]>
…e data_plane.enabled Signed-off-by: Shiki Wu <[email protected]>
…nly-simulator Signed-off-by: Shiki Wu <[email protected]> # Conflicts: # nemo_rl/algorithms/single_controller_utils/setup.py # tests/unit/single_controller/test_setup.py
Signed-off-by: Shiki Wu <[email protected]>
…imulator driver Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Shiki Wu <[email protected]>
…nly-simulator Signed-off-by: Shiki Wu <[email protected]> # Conflicts: # nemo_rl/algorithms/single_controller.py # nemo_rl/algorithms/single_controller_utils/setup.py
…4/C23/C24) Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Shiki Wu <[email protected]>
…e rollout-only simulator Signed-off-by: Shiki Wu <[email protected]>
… docstrings and the head-node caveat in the guide Signed-off-by: Shiki Wu <[email protected]>
shikicloud
left a comment
There was a problem hiding this comment.
Merge state. GitHub reports this PR as conflicting with main. It is stacked on #4914. Please rebase once #4914 lands (or onto main) and resolve the conflicts.
Scope. This review covers only this PR's own commit 1d4e3a3 (git diff d9298f435..1d4e3a392). The #4914 part was reviewed on #4914.
PR description. It is still the empty template. Please fill in what the PR does, the linked issue, and the test plan (both new functional scripts and their results).
What works well.
- The
_owns_enginesowner/copy split follows the same pattern asMegatronGeneration's_owns_policy, and the branching lives in one place. __getstate__drops only what cannot move between processes.- Rejecting fault tolerance both up front and in
__getstate__covers the config path and any other code that pickles the handle. - The no-op SGLang synchronizer keeps the real order — pause, KV cache flush, resume — so the measured refit pause matches a real one.
Evidence request (non-blocking). The guide now lists SGLang as supported on the SC for training. It would help reviewers to see a short reward and gen_kl_error curve for grpo_math_1B_sglang_single_controller.yaml next to the legacy grpo_math_1B_sglang.yaml, plus passing logs of grpo_dp_single_controller_sglang.sh and grpo_dp_single_controller_rollout_only_sglang.sh.
Inline comments.
- (C1)
needs_offload: trueleaves rollout-only SGLang engines without weights or KV cache. - (C2)
--num-nodesdoes not add SGLang engines. - (C3) Move the SGLang fault-tolerance check into
validate_settings. - (C4) The guide's fleet-health line does not hold for SGLang.
Generated by Claude Code
…fore anything builds - rollout_only rejects sglang_server_config.needs_offload=true: setup's finish_generation releases the engine memory and the no-op refit never restores it. - --num-nodes also sets SGLang's sglang_server_config.num_gpus, since SGLang counts its engines from it rather than from the cluster. - Move the SGLang fault-tolerance rejection from _build_generation into SGLangGeneration.validate_settings, which setup runs before any build, and reject async_rl.generation_fleet_health there too (SGLang has no worker group for it to track). - Docs: fleet health is vLLM-only; list the new rejections. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Shiki Wu <[email protected]>
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
… merging main Signed-off-by: Shiki Wu <[email protected]>
Signed-off-by: Shiki Wu <[email protected]>
…' into shikiw/sc-rollout-only-sglang Signed-off-by: Shiki Wu <[email protected]> # Conflicts: # docs/guides/single-controller.md # nemo_rl/algorithms/single_controller_utils/simulator.py # tests/unit/single_controller/test_setup.py # tests/unit/single_controller/test_simulator.py # tests/unit/test_config_v2.py
…nly-simulator Signed-off-by: Shiki Wu <[email protected]> # Conflicts: # docs/guides/single-controller.md # examples/run_grpo_single_controller.py # nemo_rl/algorithms/single_controller_utils/utils.py # tests/unit/single_controller/test_entrypoint.py
… settings to YAML Signed-off-by: Shiki Wu <[email protected]>
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…' into shikiw/sc-rollout-only-sglang Signed-off-by: Shiki Wu <[email protected]>
…to the simulator YAML Signed-off-by: Shiki Wu <[email protected]>
Signed-off-by: Shiki Wu <[email protected]>
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test 5bbe421 |
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test b03f76b |
…nly-simulator Conflict in examples/run_grpo_single_controller.py: main reworded one comment in the setup code this branch moved to single_controller_utils/entrypoint_utils.py. Kept the branch's file and carried the comment change over. Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test 5ae4da9 |
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test 5410af0 |
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…esolves Review round on NVIDIA-NeMo#4914 (C33, C35, C36): - simulator.num_nodes was written onto the resolved config dict, so keys the recipe computes from cluster.num_nodes (data_plane.simple.num_storage_units, Gym's num_processes) kept the recipe's node count. It is now set on the OmegaConf object before resolving, as a cluster.num_nodes override is. - The load_format='dummy' error names the fix (set load_format=auto) instead of telling the user to drop an override the recipe may have set itself. - Rename the train_backend value cpu to no_op, matching NoOpTrainer and NoOpWeightSynchronizer. Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Carries the NVIDIA-NeMo#4914 review fixes (simulator.num_nodes applied before the recipe resolves, cpu -> no_op). SGLang's num_gpus sizing moves with the node count into apply_simulator_node_count. Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test c2212e2 |
…nly-simulator Signed-off-by: Shiki Wu <[email protected]>
…mulator code - validate_simulator_config reads token_capture.forest.enabled (renamed on main by NVIDIA-NeMo#5068) and names it in the message. - NoOpTrainer no longer takes or holds policy_config; nothing reads it. - Drop the unreachable uses_no_op_trainer early return in validate_simulator_config. - Build the on_policy_distillation test config with keyword arguments. Signed-off-by: Shiki Wu <[email protected]>
…t-only-sglang Signed-off-by: Shiki Wu <[email protected]>
Signed-off-by: Shiki Wu <[email protected]>
Signed-off-by: Shiki Wu <[email protected]>
|
/ok to test 7d18714 |
shikicloud
left a comment
There was a problem hiding this comment.
@dcoapp recheck
What and why
Implement SGLang as the rollout backend of a single-controller simulator (rollout-only mode) for #4860, inspired by #4814.
examples/run_single_controller_simulator.pyruns an SC recipe's rollouts with a GPU-free trainer stand-in (mode: rollout_only). This extends the simulator from #4914 to the SGLang generation backend from #5282. The native environment, SC pumps, TransferQueue data plane and sampler all run as they do in training.The launcher takes two YAML files.
--configselects the SC recipe and--simulator-config(defaultexamples/configs/simulator/rollout_only.yaml) sets the simulator parameters.simulator.num_stepsoverridesmax_num_stepsand raisesmax_num_epochswhen needed. The launcher disables validation for the run. SGLang loads the checkpoint fromsglang_cfg.model_path, which the recipe sets topolicy.model_name.Design
NoOpTrainerreplacesTQPolicyand bootstraps TransferQueue. The train pump consumes each selected chunk and skips logprob evaluation, advantage computation and microbatch training. The native math environment scores the generated rollouts intrain/unfiltered_reward.SGLangNoOpWeightSynchronizerpauses generation, flushes the KV cache, holds forrefit_time_sand resumes generation. The hold stands in for the weight transfer. Afinallyblock resumes the engines if the flush or hold fails.timing/train/weight_synccovers this sequence.setup_single_controller(simulator=...)creates only the inference cluster. Settingsimulator.num_nodesalso setssglang_server_config.num_gpusto the number of inference nodes times the inference GPUs per node.simulate_train_steponce after all chunks arrive. It holds for up totrain_time_swhile rollouts are in flight, records the idle time it skipped, then releases the buffer and advances the policy version as in training.SGLang rollout-only uses the native SC environment path. Setup rejects
sglang_server_config.pause_generation_mode: in_placebecause refit must clear the KV cache. It also rejectssglang_server_config.needs_offload: truebecause restoring offloaded weights requires a real refit. Simulator guideUsage
uv run python examples/run_single_controller_simulator.py \ --config examples/configs/grpo_math_1B_sglang_single_controller.yaml \ --simulator-config examples/configs/simulator/rollout_only.yaml \ simulator.num_steps=4 simulator.num_nodes=1 \ simulator.train_time_s=10 simulator.refit_time_s=3 \ policy.model_name=Qwen/Qwen3-0.6B \ 'policy.tokenizer.chat_template_kwargs={enable_thinking:false}' # Reproduce the four-step smoke in the L1 SGLang lane. bash tests/functional/grpo_dp_single_controller_rollout_only_sglang.shTrack
train/simulated_train_time_s,train/simulated_train_idle_skipped_s,timing/train/weight_sync,timing/train/exposed_generationandtrain/unfiltered_reward.Issues
Part of #4860. The issue also tracks
train_onlyand theno_oprollout backend.Convergence / perf / functionality proof
On
8608d7cd, SC training and rollout-only each ran the same SGLang native math recipe for 20 steps on one GB200 node. Both used Qwen3-0.6B, four prompts per step, four generations per prompt and one SGLang GPU. The training run used Megatron TP1 on a second GPU.train_time_s=10,refit_time_s=3timing/train/exposed_generations, mean of steps 2-20timing/train/total_step_times, mean of steps 2-20timing/train/weight_syncs, meantiming/train/policy_trainings, mean of steps 2-20train/simulated_train_idle_skipped_s, meantrain/token_mult_prob_error, rangetrain/gen_kl_error, rangetrain/max_seq_mult_prob_error, maxtrain/unfiltered_reward, mean of 20 stepsThe mean wait for generation differed by 28 ms per step. The simulated refit accounted for most of the rollout-only step time. With generation idle at the training boundary, the pump skipped almost all of the 10 s training hold.
On
7d18714045, the GB200 smoke passed all six metric checks across four steps with two prompts and four generations per prompt. It disabled Qwen thinking to fit the final answer in the 512-token context. Step rewards were 0.25, 0.00, 0.50 and 0.50, and the shortest weight-sync pause was 3.009 s. All 487 selected simulator, setup, entrypoint and train-pump tests passed.Curves
Needs upstream changes
None
PR commands and CI
CI:Lfast: the default for most PRs. Runs a fast test subset.CI:L1: dependency or container changes (pyproject.toml,uv.lock,Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.CI:docs: docs-only changes. Runs doc tests only./ok to test <full-commit-sha>: start CI for that commit. Post again after each push./review: automated review comments. Addmode=strictfor a stricter review,reset=truefor a fresh full review./resolve-conflict: Autobot mergesmaininto this PR and resolves the conflicts. PRs from forks must allow edits by maintainers./review-pr-team <pr-number>for a team review before you ask for human review.