Skip to main content

Emerging Optimizers

codecov CICD NeMo Python 3.12+ GitHub Repo stars Documentation

Overview

Emerging Optimizers is a research project focused on understanding and optimizing the algorithmic behavior of emerging optimizers (including Shampoo, SOAP, Muon, and others) and their implications to performance of GPU systems in LLM training.

⚠️ Note: Emerging-Optimizers is under active development. All APIs are experimental and subject to change. New features, improvements, and documentation updates are released regularly. Your feedback and contributions are welcome, and we encourage you to follow along as new updates roll out.

Background

What are Emerging Optimizers?

Emerging optimizers represent a class of novel optimization algorithms that go beyond traditional first-order methods like Adam or SGD. These include optimizers that use matrix-based (non-diagonal) preconditioning, orthogonalization techniques, and other innovative approaches to achieve faster convergence and improved training efficiency.

Examples include Shampoo, which uses Kronecker-factored preconditioning (arXiv:1802.09568), and Muon, which uses Newton-Schulz orthogonalization (arXiv:2502.16982).

Why They Matter

Emerging optimizers have demonstrated significant practical impact in large-scale language model training. Most notably, Muon was used to train the Kimi K2 model (arXiv:2507.20534), showcasing the effectiveness of these novel approaches at scale. These optimizers can:

  • Achieve faster convergence, reducing the number of training steps required
  • Improve final model quality through better conditioning of the optimization landscape
  • Enable more efficient hyperparameter tuning due to reduced sensitivity to learning rates

Installation

Prerequisites

  • Python 3.12 (Release v0.1.0 is the last version supports Python 3.10)
  • PyTorch 2.0 or higher

Install from Source

git clone https://github.com/NVIDIA-NeMo/Emerging-Optimizers.git
cd Emerging-Optimizers
pip install .

Usage

Example

Refer to tests for usage of different optimizers, e.g. tests/test_orthogonalized_optimizer.py::MuonTest.

Train the upstream nanoGPT model with absl flags and a choice of optimizers using the minimal-dependency nanoGPT example. It supports checkpoint resume, mixed precision, generation, and PyTorch DDP.

Integration with Megatron Core

Emerging optimizer has been integrated into Megatron Core with tensor parallel support and many other features (split QKV for example), check out emerging_optimizers.py.

Pitfalls

Resuming bf16 training from an optimizer checkpoint

Several optimizers (SOAP, Shampoo, Iso and their KL variants, for example) keep their state in fp32 even when the parameters are bf16. torch.optim.Optimizer.load_state_dict casts floating point state to the parameter dtype, so after loading a checkpoint that state comes back as bf16 and the next step() fails with a dtype mismatch. From PyTorch 2.16 this cast emits a FutureWarning, and loading inside torch.optim.preserve_state_dtype_on_load() keeps the saved dtypes:

with torch.optim.preserve_state_dtype_on_load():
    optimizer.load_state_dict(state_dict)

On older PyTorch versions, copy the saved fp32 state tensors back into optimizer.state after loading.

Benchmarks

Benchmark of Muon can be found in our blog.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Metadata

Release files for emerging-optimizers 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emerging-optimizers 0.5.0
File Size Uploaded Provenance Actions
emerging_optimizers-0.5.0.tar.gz 154.8 kB Without provenance Details for emerging_optimizers-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for emerging-optimizers 0.5.0
File Interpreter ABI Platform Actions
emerging_optimizers-0.5.0-py3-none-any.whl Python 3 none any Details for emerging_optimizers-0.5.0-py3-none-any.whl

Total release size: 308.3 kB

Release files / emerging_optimizers-0.5.0.tar.gz

Download URL emerging_optimizers-0.5.0.tar.gz
Size 154.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b8ac0151fce7a1bd645d1ab5162f39e923ef2ebf460c7f0aca223f5d03518d3b
BLAKE2b-256 checksum
How to use checksums
a98973fc825afc13e55771f68292caff81c6b36e95a6a4c1a83b5ad2194c9aa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.4

Release files / emerging_optimizers-0.5.0-py3-none-any.whl

Download URL emerging_optimizers-0.5.0-py3-none-any.whl
Size 153.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99b0630644b3ce90e105aa519e4578c156d4d1f7aca5fa2d69e8207692839200
BLAKE2b-256 checksum
How to use checksums
b31612edb8e7db43d3622508b9372f6415bbf5385a06f82be6bdd3373349303c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.4

Security for emerging-optimizers 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page