Repository navigation
fix(optim): Muon routing for depthwise conv1d and grouped linear weights - #4120
Closed
faresobeid wants to merge 1 commit into
Closed
faresobeid wants to merge 1 commit into
faresobeid wants to merge 1 commit into
Conversation
…uped linears for Muon
faresobeid
marked this pull request as ready for review
October 16, 2026 17:15
This was referenced Oct 17, 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.
Two fixes to how Muon handles parameters.
nn.Conv1dweights go to AdamW. These are the gated delta net and Mamba short convolutions and the Qwen3.8 PLE convolution, shape [C, 1, K]. Muon treats a 3D tensor as a batch of matrices, so each channel's 1xK filter was orthogonalized on its own. That only normalizes each channel's taps to the same update RMS, whatever its gradient. They are now matched by module type.GroupedLinearweights get one Newton-Schulz per group. DeepSeek-V4o_a_projis [8192, 4096] = 8 independent [1024, 4096] matrices (block-diagonal). It was orthogonalized as one matrix and now getsmatrix_partitions, like the packed qkv and gate_up weights.Affected parameters (meta-device check with the cached configs):
linear_attn.conv1d.weight[6144,1,4]linear_attn.conv1d.weight,ple.conv1d.weight[10240,1,4]mamba.conv1d.weight[6144,1,4]self_attn.o_a_proj.weight[8192,4096]Nothing else changes.
Not changed, open for an A/B:
patch_embedand itspos_embed(annn.Embeddingthat is not namedembed_tokens) go to Muon.Checks
offload = "none", optimizer step only:o_a_projnow runs as (1024, 4096) Newton-Schulz calls and no (8192, 4096) call remains. Step 0.196 s (main 0.195 s).tests/unit/orchestrator+tests/unit/test_configs.py -m "not gpu": 350 passed.ruff check,ruff format --check.Note
Medium Risk
Changes which optimizer and orthogonalization path apply to specific trainable weights on several model families, so training dynamics for those parameters will differ from before.
Overview
Corrects Muon parameter routing so two weight shapes are no longer treated as single large matrices.
Depthwise
nn.Conv1dweights (e.g. linear-attention, Mamba, PLE convs) are excluded from Muon and trained with AdamW. Muon was orthogonalizing each channel’s 1×K taps separately, which is wrong for these per-channel filters.GroupedLinearweights (e.g. DeepSeek-V4o_a_proj) now getmatrix_partitionsso Newton–Schulz runs once per output group—matching how packed fusion weights are handled—instead of one orthogonalization over the full stacked block.Reviewed by Cursor Bugbot for commit 64d9806. Bugbot is set up for automated code reviews on this repo. Configure here.