Repository navigation
Conversation
Add a contributor skill for diagnosing and optimizing rollout (generation) performance in recipes and CI tests. It covers: - reading the bottleneck from metrics.json and the vLLM log; - the validated levers by regime (PIECEWISE CUDA graphs for hybrid Mamba models, replica count over TP for tail-bound decode, prefix reuse for prefill-heavy runs); - a same-window A/B through tools/launch; - logprob-consistency and accuracy gates; - setting NUM_MINUTES from the measured wall time. rollout_perf_report.py is a stdlib-only helper that prints the diagnosis for one run or a paired-step comparison for two. The testing skill now points nightly-test authors to it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
- Graph mode depends on the vLLM version. PIECEWISE-only was a workaround for
the vLLM 0.20 FULL-graph accuracy bug. On vLLM 0.29, decide by A/B, starting
from the default FULL_AND_PIECEWISE.
- Record the exceptions found in the sweep:
- dapo-nanov3.5: FULL_AND_PIECEWISE was no faster and had more
token_mult_prob_error spikes.
- qwen3.5-fp8: FULL graphs left fewer Mamba cache blocks than max_num_seqs,
so vLLM failed at startup.
- Record that backend: eager fixes logprob regressions caused by
Inductor-compiled kernels (gspo-deepscaler).
- A/B commands now cover the eager, FULL_AND_PIECEWISE and PIECEWISE arms.
- Recipes should delete enforce_eager: true rather than set it to false,
because minimize-check rejects keys that repeat a default.
- Add the measured nightly results table.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Jonas Yang <[email protected]>
77e0375 to
1d603d6
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
…he cw_dfw sweep Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
Rewrite the rollout-perf skill around an engine-neutral process: characterize the workload, find where the time goes, prove the effective engine configuration, pick a lever, A/B it, gate it, land it. The engine-specific detail moves into reference files: - references/levers.md: nine levers, each with its NeMo-RL key for vLLM, SGLang, TRT-LLM, Megatron inference and Dynamo, graded evidence and traps. - references/engines.md: per backend, how the config reaches the engine, the log lines that prove what ran, which metrics reach NeMo-RL, and known landmines. - references/measurement.md: evidence grades, metric scopes, correctness gates, the A/B protocol, comparison scopes, provenance and gap decomposition. The helper now: - parses effective settings from each backend's startup lines; - reports the step-phase breakdown and vLLM queue/KV stats; - compares several runs per arm. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
Each lever is now an engine-independent mechanism. levers.md gives a method and a matrix for applying any lever to a backend, including one not covered here or an upgraded engine whose knobs were renamed. The matrix covers: - the mechanism; - the engine-neutral signal that the lever applies; - the concept terms that locate its knob; - the semantics that differ between engines; - the proof that the setting took effect. The helper now maps each backend's startup lines onto engine-neutral settings: CUDA graphs, prefix reuse, token budget, chunked prefill, admission cap, memory fraction and KV capacity. It diagnoses against those settings, so the same rules apply to vLLM, SGLang, TRT-LLM, Megatron inference and Dynamo. Settings that a backend does not log are reported as unproven. Checked against real H100 CI logs: - SGLang grpo-qwen2.5-math-1.5b-instruct-2n8g-fsdp2tp1-sglang; - Megatron grpo-llama3.2-1b-instruct-1n8g-megatron_generation (adds MCore's CUDA-graph capture lines); - Dynamo grpo-nanov3-30ba3b-3n8g-megatron-dynamo-swe1; - the vLLM A/B runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
…ecipes dapo-qwen2.5-7b.v2 (16n8g) and grpo-minimax-m3-32n8g-automodel-cp8ep128- noncolocated ran vLLM with enforce_eager: true. Same-window A/Bs on cw_dfw H100, with eager, PIECEWISE and FULL_AND_PIECEWISE arms sharing one container and one code snapshot: - dapo-qwen2.5-7b.v2: generation per step 165 -> 74 s (-55%), wall 204 -> 156 min. token_mult_prob_error spikes went 4/20 -> 5/20; the CI eager run spiked on 7/20. FULL_AND_PIECEWISE was slower (161 min) and spiked on 8/20 steps. - minimax-m3: generation per step 521 -> 266 s (-49%), wall 82 -> 58 min. token_mult_prob_error spikes went 0/5 -> 2/5, within eager noise (the CI eager run spiked on 1/5). FULL_AND_PIECEWISE was 3% faster in wall time (7% in generation) but raised the median token_mult_prob_error. check_metrics passes in every arm and gen_kl_error is unchanged. minimax NUM_MINUTES drops from 240 to 120, and checkpoint_must_save_by drops to 01:45. The MiniMax-M3 guide now describes the graph setting and notes that its reference curves were produced in eager mode. The GB200 child dapo-qwen2.5-7b-16n4g-fsdp2cp2.v2 now pins enforce_eager: true, so its behaviour is unchanged until it gets its own A/B. The recipe comments cite the rollout-perf skill (#4556). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]>
…ecipes dapo-qwen2.5-7b.v2 (16n8g) and grpo-minimax-m3-32n8g-automodel-cp8ep128- noncolocated ran vLLM with enforce_eager: true. Same-window A/Bs on cw_dfw H100, with eager, PIECEWISE and FULL_AND_PIECEWISE arms sharing one container and one code snapshot: - dapo-qwen2.5-7b.v2: generation per step 165 -> 74 s (-55%), wall 204 -> 156 min. token_mult_prob_error spikes went 4/20 -> 5/20; the CI eager run spiked on 7/20. FULL_AND_PIECEWISE was slower (161 min) and spiked on 8/20 steps. - minimax-m3: generation per step 521 -> 266 s (-49%), wall 82 -> 58 min. token_mult_prob_error spikes went 0/5 -> 2/5, within eager noise (the CI eager run spiked on 1/5). FULL_AND_PIECEWISE was 3% faster in wall time (7% in generation) but raised the median token_mult_prob_error. check_metrics passes in every arm and gen_kl_error is unchanged. minimax NUM_MINUTES drops from 240 to 120, and checkpoint_must_save_by drops to 01:45. The MiniMax-M3 guide now describes the graph setting and notes that its reference curves were produced in eager mode. The GB200 child dapo-qwen2.5-7b-16n4g-automodel-cp2.v2 now pins enforce_eager: true, so its behaviour is unchanged until it gets its own A/B. The recipe comments cite the rollout-perf skill (#4556). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonas Yang <[email protected]> Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
There was a problem hiding this comment.
Thanks for the PR. The engine references match the code; two issues need fixing before merge.
Scope: the full diff at head 23b8499.
Checked:
- Metric names, async GRPO timing keys, the SGLang whitelist, the vLLM and TRT-LLM config paths, and the
token_mult_prob_errordefinition all match the code.
Remaining comments are on:
- Fix the
max_new_tokenscap check for multi-turn and NeMo Gym runs. - Update the Nano V3.5 evidence, which #4569 withdrew.
Non-blocking
- Open a follow-up issue for the silently dropped SGLang keys.
The main CI test jobs have not run on this head. Validation here covered source inspection, the 13 unit tests run locally, and a repro with a hand-built metrics.json. The helper was not run on real CI logs, and no GPU training was run.
Generated by Claude
| cap = max_new_tokens or ( | ||
| int(config["max_new_tokens"]) if "max_new_tokens" in config else None | ||
| ) | ||
| hits = None | ||
| if max_gen and cap: | ||
| hits = sum(v >= cap for v in max_gen.values()) / len(max_gen) | ||
| print(f"steps whose longest sample hit max_new_tokens={cap}: {hits:.0%}") |
There was a problem hiding this comment.
bug: the max_new_tokens cap check misreads multi-turn runs and never runs on NeMo Gym runs.
train/max_gen_tokens_per_sample sums tokens over all turns (rollouts.py L1271, L1633), but max_new_tokens caps one turn. So a sample with 4 turns × 600 tokens "hits" a 1024 cap and "Decode-tail-bound" fires. Gym runs log turns_per_sample/mean and max_gen_tokens_per_turn/max instead (rollouts.py L3346–3369), so this check and the multi-turn branch of prefill_heavy (L431–433) never run there.
Suggest fix: compare the cap with the per-turn max, read turns from either key, and add tests for both cases.
turns = series(metrics, TURNS) or series(metrics, "train/turns_per_sample/mean")
...
per_turn_max = series(metrics, "train/max_gen_tokens_per_turn/max")
multi_turn = bool(turns) and med(turns.values()) > 1
cap_series = per_turn_max or ({} if multi_turn else max_gen)
if cap_series and cap:
hits = sum(v >= cap for v in cap_series.values()) / len(cap_series)| H100 nightly A/Bs, eager → graphs (grade C). The PR reports unchanged | ||
| logprob metrics for these comparisons, with one explicit exception to gate | ||
| passing: the Nano V3.5 DAPO test failed its pre-existing step-20 | ||
| `token_mult_prob_error` gate in both arms. PR #4459 addresses that gate; the | ||
| speedup alone does not establish that the test passes. |
There was a problem hiding this comment.
The Nano V3.5 DAPO evidence here is out of date.
#4569 withdrew Nano's graph change after a rerun found much larger token_mult_prob_error spikes under PIECEWISE (tracked in #4777, still open). On main the recipe, now dapo-nanov3.5-30BA3B-4n8g-automodel-ep8.yaml, still runs eager. This paragraph and the −69% row (L94) still present it as a clean win.
Suggest fix: drop the Nano row, change "9 H100 nightly tests" to 8 in SKILL.md L142, and reword:
| H100 nightly A/Bs, eager → graphs (grade C). The PR reports unchanged | |
| logprob metrics for these comparisons, with one explicit exception to gate | |
| passing: the Nano V3.5 DAPO test failed its pre-existing step-20 | |
| `token_mult_prob_error` gate in both arms. PR #4459 addresses that gate; the | |
| speedup alone does not establish that the test passes. | |
| H100 nightly A/Bs, eager → graphs (grade C). Every shipped arm passed the | |
| test's own `check_metrics` (#4569). Exception: on the Nano V3.5 DAPO test, a | |
| later rerun found much larger intermediate `token_mult_prob_error` spikes | |
| under PIECEWISE, so its graph change was withdrawn and the test still runs | |
| eager (#4777). |
| Declared but **not forwarded**: `disable_radix_cache`, `enable_nccl_nvls`, | ||
| `disable_custom_all_reduce`, `enable_dp_attention`, `enable_mixed_chunk`, | ||
| `num_continuous_decode_steps`, `enable_torch_compile` and `sglang_kwargs`. | ||
| Setting them has no effect until the whitelist is extended. |
There was a problem hiding this comment.
Non-blocking: existing code silently drops these keys; this PR did not introduce that.
They are declared in sglang/config.py but missing from the ServerArgs whitelist in sglang_worker.py (L525–546).
Suggest fix: open a follow-up issue to forward them or reject them at config validation, and link it here.
What does this PR do?
Adds
rollout-perf, a contributor skill for diagnosing and optimizing rollout (generation) performance on every generation backend: vLLM, SGLang, TensorRT-LLM, Megatron inference and Dynamo. It covers batch GRPO-style training and multi-turn agentic (NeMo Gym) rollouts. It also adds a stdlib-only helper that reads a run'smetrics.jsonand driver log.Why
Generation is often most of a GRPO/DAPO step. Some of our CI tests run vLLM eager with no recorded reason.
For example,
dapo-nanov3.5-30BA3B-4n8g-automodeland its router-replay variant (#4458) were run as a same-window A/B on cw_dfw: 4n8g H100, frozen containerrl.70859871.sqsh, identical code. The only change wasenforce_eager: true→enforce_eager=false,cudagraph_mode=PIECEWISE,fuse_allreduce_rms=false.token_mult_prob_errormedian /gen_kl_errormeanThe per-step generation ratio stayed between 0.30 and 0.33 across all 40 paired steps. The non-R3 test failed its pre-existing step-20
token_mult_prob_errorgate in both arms (5.7e8 before, 1.056 after); that failure is the one #4459 addresses. The recipe change itself will come in a separate PR.Changes
skills/rollout-perf/SKILL.md(discovered through the shared.claude/skillsand.agents/skillslinks):metrics.jsonand the vLLM engine log.compilation_config.backend: eager.tools/launch(CODE_SNAPSHOT_DIRNAME,EXTRA_SCRIPT_ARGS), checked against the engine log.token_mult_prob_error,gen_kl_error, generation length, accuracy against step-0 noise).NUM_MINUTESfrom the measured wall time, and adjustcheckpoint_must_save_by.skills/rollout-perf/rollout_perf_report.py: diagnoses one run, or compares two runs paired by step. Standard library only.skills/testing/SKILL.md: the nightly-test checklist now points to the skill.Testing
dapo-nanov3.5-30BA3B-4n8g-automodel± R3, eager and PIECEWISE) in both modes. Its output matches the analysis above. It reads the effectivecudagraph_modefrom the engine line ('cudagraph_mode': <CUDAGraphMode.PIECEWISE: 1>) and skips theOverrides:echo.ruff checkandruff formatpass. The script has the 2026 copyright header and runs on Python 3.9+ (from __future__ import annotations).vllm_worker.py,tools/launch,code_snapshot.sh,ray.sub,loss_functions.py).Update: cw_dfw A/B sweep (second commit)
The skill guidance now reflects same-window A/Bs on 13 cw_dfw tests (vLLM 0.29, H100):
dapo-nanov3.5-30BA3B-4n8g-automodel: same speed, buttoken_mult_prob_errorspiked on 6/20 steps instead of 1/20.grpo-qwen3.5-35ba3b-2n8g-megatron-ep16tp2-fp8: FULL graphs left fewer Mamba cache blocks thanmax_num_seqs, so vLLM failed at startup.grpo-math-qwen3-30ba3b-megatron-tp4-32k,dapo-qwen2.5-7b.v2andgrpo-minimax-m3: FULL_AND_PIECEWISE gave moretoken_mult_prob_errorspikes or a higher median, for at most 3% speed (dapo-qwen2.5-7b.v2was 3% slower).token_mult_prob_error.backend: eager. Ongrpo-gspo-deepscaler-1.5b-8K, Inductor raised the mediantoken_mult_prob_errorfrom 1.013 to 1.040 and failed thegen_kl_errorgate. Withbackend: eager, generation was still 48% faster and the gates passed.The recipe changes are in a separate PR.
Update: cross-engine rewrite (third commit)
Review feedback: the first version covered only vLLM CUDA-graph mode. The skill is now engine-neutral. Its core is the process; engine-specific knobs live in reference files.
SKILL.mddescribes the process:references/levers.mdcovers nine levers. For each one it gives the NeMo-RL key in every backend, graded evidence and traps. The levers are:references/engines.mdcovers each backend:disable_radix_cacheis declared but not forwarded);references/measurement.mdcovers:--base/--treat, and warns when an arm has fewer than 3 runs.The evidence for the cross-engine levers comes from an internal multi-turn SWE-agent rollout benchmark (Nemotron Nano V3.5; vLLM, SGLang, TRT-LLM, Megatron inference and Dynamo; 3–5 runs per profile) and from the H100 nightly A/B sweep. Every number carries its evidence grade.
Update: generalizing across engines (fourth commit)
levers.mdnow opens with "Applying a lever to any engine": a five-step method and a matrix. For every lever, the matrix gives:This applies to backends not listed here, and to upgraded engines whose knobs were renamed.
The helper maps each backend's startup lines onto engine-neutral settings: CUDA graphs, prefix reuse, token budget, chunked prefill, admission cap, memory fraction and KV capacity. It diagnoses against those, so the same rules fire for every backend. Settings a backend doesn't log are reported as unproven.
Validated on real H100 CI logs from SGLang (
grpo-qwen2.5-math-1.5b-instruct-2n8g-fsdp2tp1-sglang), Megatron (grpo-llama3.2-1b-instruct-1n8g-megatron_generation), Dynamo (grpo-nanov3-30ba3b-3n8g-megatron-dynamo-swe1) and the vLLM A/B runs.Report validation
The helper reports inclusive timing percentiles, discloses unequal step coverage before comparing common steps, and compares exposed (non-overlapped) generation when both arms are async. Timing percentiles describe per-step medians across runs, not pooled run tails. Engine config dumps cannot populate another engine's settings, and driver config echoes do not establish engine identity.
tests/unit/tools/test_rollout_perf_report.py; six reproduce failures in the previous helper.uv run --no-project --with pytest pytest --confcutdir=tests/unit/tools -q tests/unit/tools/test_rollout_perf_report.py. The isolated invocation avoids the unrelated Ray/GPU unit-test conftest.Follow-ups
A read-only audit of the 185 tests that cw_dfw runs (nightly, release and performance) found 24 tests running vLLM eager. Switching the 15 that have CI timing to CUDA graphs is estimated to save about 630–870 GPU-hours per suite run. Each recipe change will come as its own PR with a same-window A/B, following this skill.
🤖 Generated with Claude Code