Skip to content

Support Muon optimizer#1

Open
Kai-46 wants to merge 3 commits intomainfrom
muon
Open

Support Muon optimizer#1
Kai-46 wants to merge 3 commits intomainfrom
muon

Conversation

@Kai-46
Copy link
Owner

@Kai-46 Kai-46 commented Aug 18, 2025

Original Muon write-up

Muon has been shown to be scalable for LLM training. We support this optimizer in the DiT training context under FSDP2 implementation. The Muon implementation is borrowed from the dion repo with some modifications to force bfloat16 dtype in NewtonSchulz5 iterations.

Early signals seem very positive by training the FLUX tiny model on imagenet, where Muon leads to more rapid drop in validation loss than Adam.
image

Copy link
Contributor

@Totoro97 Totoro97 left a comment

Choose a reason for hiding this comment

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

Excited to see such a performance boost using Muon!! 🚀 🚀 🚀 🚀 (Leave some minor comments)

# AdamW Optimizer Settings
max_lr: 0.0001 # Maximum learning rate for AdamW optimizer
min_lr: 0.00001 # Minimum learning rate for cosine decay schedule
adam_max_lr: 0.0001 # Maximum learning rate for AdamW optimizer
Copy link
Contributor

Choose a reason for hiding this comment

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

adam_max_lr-> adamw_max_lr?

# Optimizer Settings
adam_max_lr: 0.0003 # Maximum learning rate for AdamW optimizer
adam_betas: [ 0.9, 0.95 ] # Beta coefficients for AdamW momentum terms [beta1, beta2]
use_muon: true
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥 🚀

Comment on lines +21 to +22
matched_param_names: list[str]
matched_params: list[nn.Parameter]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to directly define a dictionary of parameters, such as matched_params_dict: Dict[str, nn.Parameter]?

Kai-46 added 2 commits August 19, 2025 23:53
Properly handle grad scale in the case of gradient accumulation
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.

2 participants