The Newton-Muon Optimizer

June 5, 2026 · View on GitHub

Paper: arXiv:2604.01472

This repository is adapted from modded-nanogpt. Thanks to Keller Jordan and all contributors.

What Is Newton-Muon?

Newton-Muon modifies standard Muon by right-preconditioning each layer gradient with an inverse activation second moment before the usual Muon pipeline.

Newton-Muon algorithm

In this codebase, different matrix types are handled as follows:

  • Packed attention QKV matrices share one full d×dd\times d activation second-moment estimate across the QQ, KK, and VV blocks.
  • Attention output matrices and MLP expansion matrices use one full d×dd\times d estimate.
  • The MLP contraction matrix uses a four-block diagonal approximation: it is split into four d×dd\times d blocks, with four separate second-moment estimates and four separate inverses applied blockwise.

This is the only algorithmic change: standard Muon is applied after the right-preconditioner refresh/apply step.

Install

pip install numpy tqdm torch huggingface-hub kernels setuptools typing-extensions

Download training data

python data/cached_fineweb10B.py 50

Newton-Muon-1 (record #4, single H100)

GPU requirement: single GPU with >=80 GB RAM.

Muon baseline code reference:

Note: the following baseline is different from the original record file because Triton kernels were added, but the ML pipeline was not changed.

Run Muon baseline:

python train_gpt_muon_1.py

Run AdamW:

python train_gpt_adam_1.py

Run Newton-Muon:

python train_gpt_newton_muon_1.py
MethodLossTime (s)
AdamW3.38017228.4
Muon3.27937314.1
Newton-Muon3.26117443.3

Muon-1 plot

Newton-Muon-2 (near record #28, single L40S)

GPU requirement: single GPU with compute capability ≥ NVIDIA L40S.

Muon baseline code reference:

Run Muon baseline:

torchrun --standalone --nproc_per_node=1 train_gpt_muon_2.py

Run AdamW:

torchrun --standalone --nproc_per_node=1 train_gpt_adam_2.py

Run Newton-Muon:

torchrun --standalone --nproc_per_node=1 train_gpt_newton_muon_2.py

Note: the code is designed to run on only one GPU, so use nproc_per_node=1.

MethodRun 1Run 2Run 3Run 4Avg. lossAvg. time (s)
AdamW3.46773.46313.46403.45663.46284272.0
Muon3.27583.27773.27833.28303.27874305.9
Newton-Muon3.27333.27363.27403.27453.27394342.4

Muon-2 plot

Source mapping

triton_kernels.py is based on triton_kernels.py @ 71af620.

Citation

@article{du2026newton,
  title={The {N}ewton-{M}uon optimizer},
  author={Du, Zhehang and Su, Weijie},
  journal={arXiv preprint arXiv:2604.01472},
  year={2026}
}