fix: set moe_permute_fusion default to true for deterministic MoE forward#2258
Merged
terrykong merged 3 commits intoApr 14, 2026
Merged
Conversation
…ward With moe_permute_fusion=false, MoE models produce non-deterministic forward pass results due to scatter_add_ in the unpermute operation, causing train/probs_ratio to deviate from 1.0 in on-policy GRPO. Fixes NVIDIA-NeMo#2255 Signed-off-by: Zhaopeng Qiu <alexq@nvidia.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates example training configs to default moe_permute_fusion: true to avoid non-deterministic MoE forward passes (and resulting train/probs_ratio drift) caused by the unfused unpermute path.
Changes:
- Flip
policy.megatron_cfg.moe_permute_fusionfromfalsetotruein several example configs. - Apply the same default in both standard and Megatron variants of GRPO/distillation configs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| examples/configs/sft.yaml | Sets megatron_cfg.moe_permute_fusion: true in the SFT example config. |
| examples/configs/grpo_math_1B.yaml | Sets megatron_cfg.moe_permute_fusion: true in the GRPO math 1B baseline config. |
| examples/configs/grpo_math_1B_megatron.yaml | Sets megatron_cfg.moe_permute_fusion: true in the Megatron GRPO math 1B config. |
| examples/configs/dpo.yaml | Sets megatron_cfg.moe_permute_fusion: true in the DPO example config. |
| examples/configs/distillation_math.yaml | Sets megatron_cfg.moe_permute_fusion: true in the distillation math config. |
| examples/configs/distillation_math_megatron.yaml | Sets megatron_cfg.moe_permute_fusion: true in the Megatron distillation math config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Zhaopeng Qiu <alexq@nvidia.com>
Contributor
Author
|
/ok to test 48e920e |
@zpqiu, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
Contributor
Author
|
/ok to test 018ca26 |
These recipe configs previously overrode the base default (false) with true. Now that the base default is true, these overrides are redundant and fail the minimize-check lint. Signed-off-by: Zhaopeng Qiu <alexq@nvidia.com>
terrykong
approved these changes
Apr 13, 2026
yfw
approved these changes
Apr 14, 2026
Collaborator
|
/ok to test 4346565 |
terrykong
approved these changes
Apr 14, 2026
snivertynv
pushed a commit
to snivertynv/RL
that referenced
this pull request
May 5, 2026
…ward (NVIDIA-NeMo#2258) Signed-off-by: Zhaopeng Qiu <alexq@nvidia.com>
4 tasks
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 does this PR do ?
With moe_permute_fusion=false, MoE models produce non-deterministic forward pass results due to scatter_add_ in the unpermute operation, causing train/probs_ratio to deviate from 1.0 in on-policy GRPO.
Issues
List issues that this PR closes (syntax):
Fixes #2255
Usage
# Add a code snippet demonstrating how to use thisBefore your PR is "Ready for review"
Pre checks:
Additional Information