fix: make Muon gradient clipping configurable - #2047
Merged
Conversation
Denny991
force-pushed
the
fix/muon-clip-grad-mode
branch
from
August 26, 2026 06:49
80364c8 to
f557f2a
Compare
jayhenry
reviewed
Aug 26, 2026
| clip_grad_mode: Annotated[ | ||
| Literal["all", "adamw_only"], | ||
| Parameter(help="Gradient clipping policy: clip all parameters or only the AdamW parameter groups"), | ||
| ] = "all" |
Collaborator
There was a problem hiding this comment.
默认改为更正确的 adamw_only, 在端到端测试中显式设置为 all 来对齐baseline
Collaborator
Author
There was a problem hiding this comment.
默认情况下是更正确的
adamw_only,在最终测试中显着方式设置为所有的横向基线
好,已经修改了
Denny991
force-pushed
the
fix/muon-clip-grad-mode
branch
from
August 26, 2026 10:14
f557f2a to
75aa651
Compare
Denny991
force-pushed
the
fix/muon-clip-grad-mode
branch
from
September 3, 2026 03:34
75aa651 to
d74c89c
Compare
jayhenry
approved these changes
Sep 3, 2026
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.
Summary
This PR makes the Muon gradient clipping policy configurable.
adamw_onlyremains the default policy. The historicalqwen3-5-sft-ep2-mtp4-vlE2E case explicitly usesallto align with its existing baseline.Problem
After
d1ecfdd, the Qwen3.5 E2E case showed largergrad_normfluctuations and persistent loss differences, while LR and token counts remained identical.The existing baseline was generated with all-group clipping, but
d1ecfddchanged the default to AdamW-only clipping.Failing run: https://github.com/InternLM/xtuner/actions/runs/32438896110
Changes
MuonConfig.clip_grad_mode:adamw_only: clip only AdamW parameter groups.all: clip both Muon and AdamW parameter groups.adamw_onlyas the default.clip_grad_mode="all"only for the historical Qwen3.5 E2E case.Validation
grad_normdifferences.allreproduced the pre-change behavior within observed run-to-run noise.Related change: #2001