Repository navigation
Conversation
SingleController builds the same ModelOpt policy and vLLM workers and the same weight synchronizers as the legacy entrypoints, so quantization only needed entrypoint wiring: - Real quant: the trainer task publishes the policy's ModelOpt export config right after the policy is built (before any PPO critic), or its own build failure. The driver waits for it once the trainer is submitted and the dataset is loading, then builds vLLM with the config; with NeMo-Gym, the vLLM reservation, router and Gym spin-up move to that point. No build task waits on the config, so a failure cannot hang setup. The config is injected after the policy hf_config_overrides merge, so a conflicting override raises. A rebuilt trainer must produce the same config. Fake-quant and unquantized runs keep their setup order. - Validation: SingleController uses the shared real-quant validator for GRPO and PPO instead of rejecting real quant. - nccl_reshard rejects ModelOpt fake quant (policy or generation quant_cfg): its bulk path skips weight folding and amax export. Closes #5415. Signed-off-by: Meng Xin <[email protected]>
…troller Signed-off-by: Meng Xin <[email protected]>
…trypoint Signed-off-by: Meng Xin <[email protected]>
…ially Address the design challengers: real quant now builds the trainer, reads its ModelOpt config, then builds vLLM, as grpo.py does. This drops the config future, its failure plumbing, the rebuild-equality check and the late generation/Gym submission; real-quant runs give up the dataset-load overlap. - One injection helper: prepare_real_quant_generation_config takes the config. - Nightly: synchronous (zero lookahead, KV recompute after refit) so gen_kl_error measures only quantization error; gate on unfiltered_reward; restore the offload comment; add the copyright header. - Guide: state SC PPO is unit-tested only; explain why an aborted real-quant refit cannot be retried. - Tests: pytest.raises instead of a hang-detector thread; PPO test checks the config is read from a trainer on GPU; split the injection test. Signed-off-by: Meng Xin <[email protected]>
…quant trainer build Signed-off-by: Meng Xin <[email protected]>
…aw unfiltered reward Signed-off-by: Meng Xin <[email protected]>
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test 9c75d69 |
…e fake-quant nccl_reshard limit Signed-off-by: Meng Xin <[email protected]>
Contributor
Author
|
/ok to test 06b5e32 |
…ct the nightly gate comment Signed-off-by: Meng Xin <[email protected]>
Contributor
Author
|
/ok to test c63a341 |
4 of 21 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
#3945 left ModelOpt real-quant rollout working only on the legacy GRPO and distillation entrypoints. SingleController (SC) rejected it, because the vLLM engine is built from a ModelOpt
quantization_configthat only the calibrated trainer can produce. Fake quant already ran on SC, butnccl_reshardsilently broke it.This PR makes SC a plain entrypoint for both modes, for GRPO and PPO alike. The quantization rules stay in the shared ModelOpt code.
get_real_quantization_config(), then builds vLLM, or the NeMo-Gym deferred vLLM reservation, with that config. This is the ordergrpo.pyalready uses. Real-quant runs load the dataset up front, so the trainer is never rebuilt for a step clamp. Fake-quant and unquantized runs keep today's parallel startup unchanged._build_generation(quantization_config=)injects the config through the sharedprepare_real_quant_generation_configconflict check. It runs after the policyhf_config_overridesmerge, so a user override cannot silently replace it.prepare_real_quant_generation_confignow takes the config instead of the policy; thegrpo.pyanddistillation.pycallers are updated.validate_real_quant_policy_config, so SC accepts exactly what the legacy entrypoints accept (non-colocated collective refit). There is no SC-only or algorithm-specific rule.nccl_reshard. GRPO and SC now reject this combination (distillation does not run thenccl_reshardprecondition check, and legacy PPO rejects anyrefit_transport). The bulk path skips ModelOpt weight folding and amax export, which leaves unfolded weights and misplaced amax....-noncolocated-single-controller). It is synchronous (zero lookahead, KV recompute after refit) sogen_kl_errorstill measures only quantization error, and it keeps the same gates. The reward gate moves totrain/unfiltered_reward, because SC'strain/rewardaverages trained rows only. This is a move, not a copy: legacyrun_grpo.pykeeps its colocated real-quant nightly and the functional test, but loses its non-colocated real-quant nightly, following the SC parity plan (SingleController parity with legacy GRPO/PPO: remaining features and validation gaps #5044).refit_timeout_sshould sit above the measured refit time (or benull).Not changed on purpose: no refit-timeout floor, no real-quant fail-fast in refit recovery (the poisoned-worker behaviour is common to every native-reload path), and no refit-metadata memoization. Native KV cache (#5516) needs no SC code: its format rides in the injected config and its scales in the export groups.
Issues
Closes #5415. Part of #5044.
Convergence / perf / functionality proof
All runs use commit
97d589d8f, whose code matches the PR head except for the nightly driver's reward gate. They ran on GB300, 4 GPUs per node, with the nightly's 8 trainer + 8 vLLM GPU split (2 + 2 nodes).End-to-end training: SC vs legacy
run_grpo.py, 150 steps each. Qwen3-8B-Base, NVFP4 W4A16 real quant, DAPO, synchronous, same recipe, data, seed and GPU split. Code is the PR head,c63a341e3. Both jobs were preempted around step 98 and resumed from their step-75 checkpoints, which also exercised SC real-quant resume. Reward is the raw [0, 1] reward over all generated rows (legacy's scaled value is converted back).gen_kl_errorSC / legacytoken_mult_prob_errormedian SC / legacytoken_mult_prob_errorspikes hit both arms: above 1.5 on 11 of 150 steps on SC and 20 on legacy, each of those with a normalgen_kl_error(above 1.04, the plot's marker threshold: 17 vs 25). They are a few outlier tokens on both entrypoints, which is why the nightly gates on the median.Fake-quant training: SC vs legacy
run_grpo.py, 30 steps each. Same setup as the 150-step real-quant pair (Qwen3-8B-Base, DAPO, synchronous, non-colocated collective refit, PR headc63a341e3), but with fake NVFP4 W4A16: vLLM inserts 540–543 ModelOpt simulated quantizers per worker and does not take the native ModelOpt path.gen_kl_errorSC / legacytoken_mult_prob_errormedian SC / legacyBoth arms learn at the same rate, and the mismatch falls identically. The numbers also match the real-quant pair's first 30 steps (
gen_kl_error0.00067 / 0.00062 and median 1.0110 / 1.0102 over steps 21–30). Refit median is 0.32 s on SC and 0.28 s on legacy. There was onetoken_mult_prob_errorstep above 1.5 on SC and none on legacy. W&B: SC zje1dne0, legacy s1v8ea01.Parity: migrated nightly on SC vs legacy
run_grpo.py, Qwen3-8B-Base, NVFP4 W4A16 real quant, non-colocated collective refit, same recipe and data, 10 steps each.train/token_mult_prob_errortrain/gen_kl_error(max)The SC run passes all of the migrated driver's gates, both the log greps and the metrics. Its
max(train/unfiltered_reward)is 0.074. That metric is the raw [0, 1] reward over every generated row, before scaling and shaping, so its gate (> 0.05) is a sanity floor, not an equivalent of the legacy-0.9gate on filtered, scaled rewards. Legacy W&B: a5ex0go9; SC W&B: fhyn00yq.Smokes (control flow, not quality evidence):
SC PPO real quant, shared critic, async lookahead 1 (Qwen2.5-1.5B, W4A16, 2k tokens, 3 steps; the PPO example config's
max_lookahead_versions: 1, so steps 2 and 3 train at lag 1): vLLM is built withquantization=modelopt_fp4from the trainer's config. The critic shares and offloads the trainer GPUs. Refit takes about 0.35 s,gen_kl_erroris about 0.0006 andtoken_mult_prob_errorabout 1.02, inside the real-quant functional-test limits (0.003 and 1.05). qe3rjr3nSC GRPO real quant, async lookahead 1 (the migrated recipe with
max_lookahead_versions: 1, 3 steps): steps 2 and 3 train at lag 1, and each refit pauses in-flight vLLM requests. Refit takes 0.80 s.gen_kl_erroris 0.0010–0.0011 andtoken_mult_prob_error1.017–1.019, the same as the synchronous run. sgoqtws8SC fake quant (Qwen3-8B-Base, fake NVFP4 W4A8 FP8, 3 steps): vLLM inserts ModelOpt fake quantizers and does not take the native ModelOpt path. Refit takes about 0.25 s.
gen_kl_erroris 0.0023–0.0025, inside the fake-W4A8 functional-test limit (0.02).token_mult_prob_erroris 1.03 at steps 1 and 2 and 17.1 at step 3, a single-step outlier whilegen_kl_errorstays flat. z5zp028nSC GRPO real quant with trainer warm-up (the migrated recipe with
async_rl.trainer_warmup.enabled: true, trainer TP4 × DP2, 2 steps): the warm-up's synthetic logprob and train pass runs on the real-quant trainer in 21.9 s while vLLM loads. Both steps complete with refit at 0.8 s,gen_kl_error0.0010 andtoken_mult_prob_error1.0175. pgb25c8aNot run, by design: a colocated SC run, because SC rejects colocated vLLM.
Unit tests:
tests/unit/single_controller,tests/unit/weight_sync, the ModelOpt real-quant config tests, config validation, recipes and test suites, andtest_grpo.py/test_distillation.py(3,863 passed), plus a test that fails if real quant re-enables the dataset-load overlap.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./nightly-ci test-case=<test>: run NVIDIA's nightly CI for the PR head; eligible teams only./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.