Skip to content

Add MLA support to Muon - #5015

Open
janEbert wants to merge 5 commits into
NVIDIA:mainfrom
janEbert:muon-mla
Open

Add MLA support to Muon#5015
janEbert wants to merge 5 commits into
NVIDIA:mainfrom
janEbert:muon-mla

Conversation

@janEbert

@janEbert janEbert commented May 27, 2026

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do ?

Add MLA support to Muon by extending the existing metadata tagging scheme for splitting the MLA up-projections (and the sole Q-projection when q_lora_rank=None).

The down-projs are deliberately left out of the scope of this PR and will be included in a follow-up PR with the down-proj splitting being off-by-default behind an additional feature flag.

Issue tracking

Fix #4091.

Rebased on top of #4728.

@janEbert
janEbert requested review from a team as code owners May 27, 2026 13:33
@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft May 27, 2026 13:34
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@copy-pr-bot

copy-pr-bot Bot commented May 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@janEbert

Copy link
Copy Markdown
Contributor Author

/ok to test 3cb3990

@ericharper

Copy link
Copy Markdown
Contributor

@Phlip79 , this code is not being covered by an expert group. Can we cover it?

@ericharper
ericharper requested a review from FDecaYed May 28, 2026 20:51

@wujingyue wujingyue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting some expert reviews can help too.

Comment thread megatron/core/optimizer/__init__.py Outdated
Comment thread megatron/core/optimizer/emerging_optimizers.py Outdated
Comment thread megatron/core/optimizer/__init__.py Outdated
@janEbert

Copy link
Copy Markdown
Contributor Author

/ok to test 8df9baa

@janEbert
janEbert removed request for a team June 2, 2026 11:01
@greptile-apps

greptile-apps Bot commented Jun 2, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "Improve documentation" | Re-trigger Greptile

@janEbert

janEbert commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 1e02dc5

@FDecaYed FDecaYed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code change itself looks ok, but at high level I feel splitting fused should be a general thing we support with a refined API. we cannot sustain keep adding new cases as the workload coming. Ideally we should generalize this.

Also kinda related, we had the change in Emerging-optimizers to support batched muon processing. instead of supporting arbitrary batch of different shaped weights, it only support batch of weight all with same shape, and it could be useful for cases where same shape weights are fused in the first place

@skyw

skyw commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

the code change itself looks ok, but at high level I feel splitting fused should be a general thing we support with a refined API. we cannot sustain keep adding new cases as the workload coming. Ideally we should generalize this.

Also kinda related, we had the change in Emerging-optimizers to support batched muon processing. instead of supporting arbitrary batch of different shaped weights, it only support batch of weight all with same shape, and it could be useful for cases where same shape weights are fused in the first place

Specific for that, the plan is for a version of grouped linear has 3d batch shaped weights in TE or other places.

janEbert added 5 commits July 28, 2026 14:40
Signed-off-by: janEbert <janpabloe@nvidia.com>
In the future, we could create an actual enum for this.

Signed-off-by: janEbert <janpabloe@nvidia.com>
Signed-off-by: janEbert <janpabloe@nvidia.com>
Signed-off-by: janEbert <janpabloe@nvidia.com>
Avoid duplicate meanings of `None`:
1. `None` implies that `split_qkv = False`.
2. `None` implies that the parameter should not be split.

The new version separates these cases clearly, which requires
introducing additional nesting.

Signed-off-by: janEbert <janpabloe@nvidia.com>
@janEbert

Copy link
Copy Markdown
Contributor Author

/ok to test 08c7b4c

@buptzyb

buptzyb commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@janEbert Hi, any updates on this PR? Are we going to merge it? And what's the plan for the KV down proj split? Thanks!

@janEbert

janEbert commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Hey @buptzyb, there are sadly still missing expert reviews on this PR. As for the down-proj split, I didn't want to work on it before this PR is actually merged.

@mkhona-nvidia

Copy link
Copy Markdown
Contributor

hi @janEbert

can we merge this PR and #6326 ?

The split_qkv feature of Muon has been a point of contention for a while and newer muon runs do per-head splitting. We can take the opportunity to improve this split_qkv feature

@janEbert

Copy link
Copy Markdown
Contributor Author

Sounds good, but what do you mean by "merge"? It feels like both our PRs don't really address the design point, if I see correctly.

@mkhona-nvidia

Copy link
Copy Markdown
Contributor

Sounds good, but what do you mean by "merge"? It feels like both our PRs don't really address the design point, if I see correctly.

Sorry by merge, I meant unify the PRs into a common interface that is more general than either of the 2 PRs

@janEbert

Copy link
Copy Markdown
Contributor Author

I see, yeah, sounds good! Do you (or some of the others already in the discussion) already have something in mind? If not, I can give it some thought.

@mkhona-nvidia

Copy link
Copy Markdown
Contributor

I see, yeah, sounds good! Do you (or some of the others already in the discussion) already have something in mind? If not, I can give it some thought.

No one else is working on it, though @philipcmonk might have thoughts. There's also an interaction with gated attention, where we split into QKV and also the output_gate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MLA support for Muon optimizer