Skip to content

[feat] Muon support for multi-LoRA per-slot optimizers#1761

Open
yushengsu-thu wants to merge 1 commit into
radixark:mainfrom
yushengsu-thu:multi-lora-muon-support
Open

[feat] Muon support for multi-LoRA per-slot optimizers#1761
yushengsu-thu wants to merge 1 commit into
radixark:mainfrom
yushengsu-thu:multi-lora-muon-support

Conversation

@yushengsu-thu

Copy link
Copy Markdown
Collaborator

Multi-LoRA currently rejects --optimizer muon at launch. Since the per-slot construction already goes through the stock get_megatron_optimizer, this just opens the same factory to muon: dist_muon collapses to plain muon (multi-LoRA applies LayerWise once over all slots itself), each per-slot child now uses its own family-matched init_state_fn, and slot-retirement cleanup additionally zeroes muon's momentum_buffer so a reused slot doesn't inherit the previous adapter's momentum. The adam/AdamW path is unchanged, and the stepping machinery and per-adapter LR scheduler were already optimizer-agnostic. Selecting muon requires the emerging-optimizers package, same as the non-LoRA muon path.

Allow --optimizer muon (and the deprecated dist_muon alias) alongside
adam/AdamW for multi-LoRA. Per-slot construction already goes through the
stock get_megatron_optimizer, so Muon slots come out of the same factory:
the child config collapses dist_muon to plain muon and forces per-child
layer-wise off (multi-LoRA applies LayerWise once over all slots), each
child now supplies its own family-matched init_state_fn (Adam moments or
Muon's _init_group), slot-retirement cleanup additionally zeroes Muon's
per-param momentum_buffer, and the multi-LoRA branch takes precedence over
the plain Muon path in setup_model_and_optimizer. The stepping machinery
(prepare_grads / per-slot clip / step_with_ready_grads) and the per-adapter
LR scheduler are already optimizer-agnostic. Requires the emerging-optimizers
package at runtime when muon is selected (same as non-LoRA Muon).
Copilot AI review requested due to automatic review settings July 22, 2026 00:00
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Zhichenzzz

Copy link
Copy Markdown
Contributor

I think current radixark/megatron version did not support muon well (we will upstream the latest one soon). so maybe after that we could check this muon for multi-lora then

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants