-
Notifications
You must be signed in to change notification settings - Fork 122
[Train] Provide muon optimizer #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Yangyang0906C, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the Muon optimizer, a new optimization algorithm that employs orthogonalization via Newton-Schulz iteration, into the Megatron-LM codebase. This integration includes comprehensive distributed training support, enabling the optimizer to scale effectively across multiple devices. Additionally, new configuration parameters and command-line arguments have been introduced to provide flexible control over Muon's behavior, making this advanced optimization technique accessible for large-scale model training. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the Muon optimizer, a novel optimizer that uses Newton-Schulz iteration for orthogonalization. The changes include the core Muon optimizer implementation, its integration into Megatron's distributed optimizer framework, and the necessary configuration and command-line arguments.
The implementation is comprehensive, including support for distributed and tensor-parallel training. My review focuses on ensuring correctness, especially in the complex distributed logic, and improving code clarity and maintainability. I've identified a couple of critical issues in the distributed optimizer integration that could lead to incorrect behavior or break existing features. I've also pointed out several medium-severity issues like typos and opportunities for code clarification.
|
|
|
|
||
| # For precision_aware_optimizer, the empty tensors should also be | ||
| # initialized with the correct dtype. | ||
| - tensors = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the init dtype
PR Category
Train
PR Types
New Features
PR Description
Provide the implementation of muon referring to NVIDIA/Megatron-LM#1428