No Muon optimizer for embeding and lm_head layer #7641
Merged
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.
This PR follow the suggestion in this artical https://kellerjordan.github.io/posts/muon/#empirical-considerations that non-hidden layers ('embedding' and 'lm_head') needs to be excluded from Muon optimizer. It check parameter name for
embedandlm_headand not apply'use_muon'attribute if any of these string present in the name.Note in nanochat it also take the same approach (put embedding and lm_head in
adam_groupsto avoid using Muon) https://github.com/karpathy/nanochat/blob/2e938530ce7f38d51052b4e5b37cf5613d0a45fb/nanochat/gpt.py#L226 , so this should be a common practice.