[feat] Muon support for multi-LoRA per-slot optimizers#1761
Open
yushengsu-thu wants to merge 1 commit into
Open
[feat] Muon support for multi-LoRA per-slot optimizers#1761yushengsu-thu wants to merge 1 commit into
yushengsu-thu wants to merge 1 commit into
Conversation
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).
yushengsu-thu
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
guapisolo,
jybsuper,
maocheng23 and
yueming-yuan
as code owners
July 22, 2026 00:00
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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 |
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.
Multi-LoRA currently rejects
--optimizer muonat launch. Since the per-slot construction already goes through the stockget_megatron_optimizer, this just opens the same factory to muon:dist_muoncollapses to plainmuon(multi-LoRA applies LayerWise once over all slots itself), each per-slot child now uses its own family-matchedinit_state_fn, and slot-retirement cleanup additionally zeroes muon'smomentum_bufferso 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 theemerging-optimizerspackage, same as the non-LoRA muon path.