Repository navigation
feat: add router replay (R3) support - #2590
Conversation
062e262 to
e996d94
Compare
terrykong
left a comment
There was a problem hiding this comment.
Router Replay (R3) — PR #2590
Reviewed by a 5-agent team (rl-expert, test-agent, bug-finder, comment-reviewer, devil-advocate).
⚠ Merge conflicts — this PR is CONFLICTING against main. Please rebase and resolve conflicts before further review.
No high-confidence correctness bugs found — the implementation is careful with extensive shape validation, sentinel/fallback handling, and good test coverage. The core concern is the missing convergence/throughput evidence for the unconditional CP partitioning refactor (see inline comment on data.py).
Devil's advocate summary: 6 confirmed, 1 disputed, 3 downgraded. PR is clearly warranted (4,059 insertions for MoE router replay).
Generated by Claude Code
|
great work @zyzhou5 and @pjin-nvidia ! @zyzhou5 can you add some docs on this? |
f6859bb to
a1e223a
Compare
a1e223a to
f2110e3
Compare
|
/ok to test f2110e3 |
1 similar comment
|
/ok to test f2110e3 |
|
/ok to test f2110e3 |
|
/ok to test 0e69818 |
|
/ok to test 0e69818 |
Signed-off-by: Zeyu Zhou <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
|
/ok to test b1a9651 |
Signed-off-by: Zeyu Zhou <[email protected]>
|
/ok to test c37acfd |
|
/ok to test 42ad01e |
|
/ok to test 3dd7c86 |
|
/ok to test 3dd7c86 |
|
/ok to test 21526ea |
Trim the context-parallel changes from this PR: drop the Transformer-Engine THD packed-sequence CP rewrite and keep NeMo-RL's existing per-sequence CP sharding unchanged (byte-identical to main). routed_experts and the R3 forward-trace token identities ride the same _get_tokens_on_this_cp_rank sharding via a small additive helper (_shard_routed_experts_for_cp). This commit also merges current main and resolves the resulting conflicts. Signed-off-by: Zeyu Zhou <[email protected]>
|
/ok to test 1565fe0 |
…-NeMo#2803 quant-worker hook fix) Signed-off-by: Zeyu Zhou <[email protected]>
|
/ok to test 1e7bb71 |
ZhiyuLi-Nvidia
left a comment
There was a problem hiding this comment.
Awesome @zyzhou5. Awesome and thank you for the PR, changes for all the comments.
LGTM!
What does this PR do ?
Adds Router Replay (R3) support for Megatron MoE policy training with vLLM
rollout generation.
R3 records MoE router choices from rollout generation and replays them during
Megatron prev-logprob and train forward passes. This keeps generated tokens on
the same expert routes used during rollout and avoids train-vs-rollout
expert-routing mismatch that is unrelated to the policy update.
The current NeMo RL integration is wired and tested for vLLM rollout
generation. Other inference/generation backends are not wired into this path
and have not been tested with Router Replay.
Configuration
When Router Replay is enabled, NeMo RL configures vLLM rollout generation with
enable_return_routed_experts=Trueand carries the returned routes through thenormal rollout and policy data path as
routed_experts.Example recipe:
examples/configs/recipes/llm/grpo-qwen3-30ba3b-8n8g-megatron-cp2-r3.yamlDocumentation
See docs/guides/router-replay.md for
configuration details, trace debugging, fallback behavior, and validation notes.
Validation
Effectiveness validation report:
https://api.wandb.ai/links/nvidia-nemo-fw-public/m4onwlx8