Optimisers · a visual explainer
Muon vs AdamW, one update at a time
A teammate, Shaurya, trained the same speech recognition model twice this week, once with AdamW and once with Muon. He tuned the learning rate only for AdamW and reused it for Muon, and Muon still won on 23 of his 29 test sets. That made me want to understand what Muon actually does differently. This page starts from what an optimiser is for, goes through momentum, Adam and AdamW, and then spends the second half on Muon.
What an optimiser does
A neural network is a long list of numbers called weights. Training is a loop that nudges those numbers so the model's mistakes get smaller. Each pass through the loop does four things, and the optimiser owns only the last one. Click through the steps.
The simplest optimiser takes each weight and moves it a little in the opposite direction of its gradient. That is plain gradient descent, or SGD when the gradient comes from a random batch. The size of the move is the learning rate, usually written η.
So why do we need anything fancier? Because the loss surface of a real network is a bad shape to walk down. Some directions are very steep and others are almost flat. One learning rate is too big for the steep directions and too small for the flat ones. Every optimiser after SGD is a way of fixing that.
Walking down a long narrow valley
Here is the problem in two dimensions. The loss is a valley that is a hundred times steeper across than along. Every optimiser starts at the same point on the left and gets 60 steps to reach the bottom at the centre. Press play, or drag the slider to scrub through the steps.
Momentum dates back to Boris Polyak in 1964, and Sutskever and colleagues showed in 2013 that it matters a lot for deep networks. It is still inside every optimiser on this page, Muon included.
Adam gives every number its own step size
Adam, from Diederik Kingma and Jimmy Ba in 2014, keeps two running averages for each weight. The first, m, is momentum. The second, v, is the average of the squared gradient, which tells you how big that weight's gradients usually are. Adam divides one by the square root of the other.
The division is the whole trick. If a weight's gradients are large, the step is divided by something large. If they are tiny, it is divided by something tiny. When the gradient is steady, m̂ / √v̂ comes out close to ±1, so every weight moves by roughly η no matter how big its gradient was. When the gradient keeps flipping sign, the average in m cancels out while v stays large, and the step shrinks. The figure below shows three weights that get very different gradients.
The cost. Adam stores two extra numbers, m and v, for every weight. A model with 7 billion weights carries 14 billion more numbers of optimiser state. Muon keeps only m.
One way to read Adam that becomes useful later: if you turn off the averaging, g / √g² is just the sign of g. Adam is a smoothed version of "move every number by the same amount in the direction of its gradient." Each number is treated on its own. Adam has no idea that the 4,096 × 4,096 numbers in one attention projection belong together as a matrix.
AdamW fixes how Adam shrinks weights
Weight decay pulls every weight slightly towards zero on each step. It stops weights from growing without bound and acts as a regulariser. With SGD, the usual way to do it is to add λw to the gradient, which is the same as adding ½λw² to the loss. Ilya Loshchilov and Frank Hutter noticed in 2017 that this stops being the same thing once Adam is involved.
The decay term is added to the gradient, g + λw, and then the whole thing goes through Adam's division by √v. A weight that gets large gradients has a large √v, so its decay is divided away to almost nothing. Weights that are pushed hardest get regularised least.
m, v ← from (g + λw)w ← w − η · m̂/√v̂
Adam only sees the real gradient. The decay is applied separately, straight to the weight, after the Adam step. Every weight shrinks by the same fraction ηλ, whatever its gradients look like.
m, v ← from gw ← w − η · (m̂/√v̂ + λw)
That is the baseline Muon is up against. AdamW is robust, well understood, and has a decade of tuning folklore behind it. It is also elementwise. Every one of the millions of numbers in a weight matrix gets its own step, worked out without looking at any of the others.
Muon treats a weight matrix as a matrix
Muon was written up by Keller Jordan in December 2024, after it set records in the NanoGPT and CIFAR-10 speedruns. The name stands for MomentUm Orthogonalized by Newton–Schulz. It applies only to the 2D weight matrices inside the network, and it does one thing differently from SGD with momentum: before applying the momentum, it replaces it with the nearest orthogonal matrix.
To see why that helps, picture what a weight update does. A matrix maps input vectors to output vectors. If you feed it every unit-length input, the outputs trace out an ellipse (in many dimensions, an ellipsoid). The lengths of the ellipse's axes are the matrix's singular values. Gradient updates for Transformer layers turn out to have very lopsided singular values. A few directions dominate and the rest are close to zero, so the update is nearly low rank.
Each entry is normalised on its own, so roughly every entry moves by the same amount. In the language of Bernstein and Newhouse, that is steepest descent when you measure the size of a step by its largest entry.
The whole matrix is normalised, so every singular direction moves by the same amount. That is steepest descent when you measure the size of a step by its largest singular value, the spectral norm. For a layer that maps vectors to vectors, that is the natural way to measure how much the layer's behaviour changed.
Orthogonalising without an SVD
The obvious way to compute U Vᵀ is a singular value decomposition, which is far too slow to run on every weight matrix at every step. Muon uses a Newton–Schulz iteration instead. It is five rounds of the same small polynomial, built only from matrix multiplications, and it runs fine in bfloat16 on a GPU.
The trick is that this polynomial acts on each singular value separately and leaves the directions alone. Each round sends a singular value σ to aσ + bσ³ + cσ⁵. Near zero that is about 3.4 times bigger, so small values grow fast, while values near 1 stay near 1. Drag the slider to watch sixteen singular values from a lopsided update go through the five rounds.
This is the core of the PyTorch reference code, lightly trimmed. It transposes tall matrices so X Xᵀ is the smaller of the two products.
def newton_schulz(G, steps=5): a, b, c = 3.4445, -4.7750, 2.0315 X = G.bfloat16() tall = G.size(-2) > G.size(-1) if tall: X = X.mT X = X / (X.norm(dim=(-2, -1), keepdim=True) + 1e-7) for _ in range(steps): A = X @ X.mT B = b * A + c * A @ A X = a * X + B @ X if tall: X = X.mT return X
Muon does not replace AdamW, it shares the model with it
Orthogonalising only means something for a matrix that maps one hidden vector to another. The embedding table is a lookup, not a linear map in that sense, and the output head behaves differently too. Norm gains and biases are vectors. So every Muon setup I have seen runs two optimisers side by side.
| Parameter | Shape | Optimiser | Why |
|---|---|---|---|
| Attention Q, K, V, output projections | 2D, hidden × hidden | Muon | Hidden-to-hidden maps. Keller Jordan reports Q, K and V work better orthogonalised separately than as one fused matrix. |
| Feed-forward / expert matrices | 2D | Muon | Most of the model's weights live here, so most of the benefit does too. |
| Conv filters | 4D | Muon, flattened to 2D | Used in the CIFAR-10 speedrun and in ASR encoders with conv modules. |
| Token embedding | 2D, vocab × hidden | AdamW | Each step only touches the rows for tokens in the batch. It is a table, not a map between hidden spaces. |
| Output head / classifier | 2D, hidden × vocab | AdamW | Empirically better with AdamW in the original speedrun work. |
| Norm gains, biases, scalars | 1D or 0D | AdamW | There is nothing to orthogonalise in a vector. |
# PyTorch has shipped torch.optim.Muon since 2.9; it only accepts 2D params hidden = [p for n, p in model.named_parameters() if p.ndim == 2 and "embed" not in n and "head" not in n] ids = {id(p) for p in hidden} rest = [p for p in model.parameters() if id(p) not in ids] opt_muon = torch.optim.Muon(hidden, lr=0.02, momentum=0.95, weight_decay=0.1) opt_adamw = torch.optim.AdamW(rest, lr=3e-4, betas=(0.9, 0.95), weight_decay=0.1) # every step: loss.backward(); opt_muon.step(); opt_adamw.step(); zero both
The learning rates above are placeholders to show that the two groups usually have different values. PyTorch's adjust_lr_fn="match_rms_adamw" option rescales Muon's update so the two can share one learning rate, which is the Moonshot trick in the next section.
Does it actually work?
Muon started on small speedrun benchmarks, and the obvious worry was whether it would hold up at scale. Over 2025 and 2026 several large training runs answered that.
| When | Who | What they found |
|---|---|---|
| Oct–Dec 2024 | Keller Jordan et al. | NanoGPT speedrun about 1.35× faster than AdamW. CIFAR-10 to 94% in 2.6 A100-seconds, down from 3.3. A 1.5B model hit GPT-2 XL HellaSwag in 10 8×H100-hours against 13.3 for AdamW. |
| Feb 2025 | Moonshot AI, "Muon is Scalable for LLM Training" | Two changes were needed at scale. They added AdamW-style weight decay, and scaled each update by 0.2·√max(A, B) for an A × B matrix so its RMS matches a typical AdamW update. Muon needed about 52% of AdamW's FLOPs to reach the same loss. They trained Moonlight, a 16B-total, 3B-active MoE, on 5.7T tokens. |
| Jul 2025 | Moonshot AI, Kimi K2 | A 1T-parameter MoE (32B active) trained on 15.5T tokens with MuonClip, which adds QK-clip to stop attention logits from blowing up. The report says "zero loss spike". |
| 2026 | DeepSeek V4 and V4.1 Flash | Muon for matrix parameters, AdamW for the rest. Their reports list momentum 0.95 and weight decay 0.1. |
| Oct 2026 | Shaurya Sharthak, ASR | Two-epoch run on a streaming ASR model with CTC and RNN-T heads. Learning rate swept for AdamW only. Muon WER 20.64 against 21.11, better on 23 of 29 sets. |
Things that are still open. Muon needs the full gradient matrix to orthogonalise it, which complicates sharded training where each GPU holds a slice. Fine-tuning a model that was pre-trained with AdamW using Muon has given mixed results, and Moonshot's fine-tuning experiments did best when pre-training and fine-tuning used the same optimiser. And the learning rate does not transfer one-to-one from AdamW unless you use the RMS-matching scale.
Papers and posts
- Keller Jordan et al., "Muon: An optimizer for hidden layers in neural networks", December 2024
The algorithm, Newton–Schulz coefficients, the parameter split, speedrun numbers and the FLOP overhead estimate. Code at github.com/KellerJordan/Muon.
- Bernstein and Newhouse, "Old Optimizer, New Norm: An Anthology", 2024
Reads Adam, Shampoo and others as steepest descent under different norms, and proposed Newton–Schulz for the orthogonalisation step. Also see Jeremy Bernstein's "Deriving Muon".
- Liu et al. (Moonshot AI), "Muon is Scalable for LLM Training", 2025
Weight decay and RMS-matched update scale (their Eq. 4), the 52% FLOPs figure, and Moonlight.
- Kimi Team, "Kimi K2: Open Agentic Intelligence", 2025
MuonClip and the 15.5T-token run.
- Kingma and Ba, "Adam: A Method for Stochastic Optimization", 2014
The update rule and bias correction in section 03.
- Loshchilov and Hutter, "Decoupled Weight Decay Regularization", 2017
The AdamW paper and the L2 versus decoupled argument in section 04.
- Sutskever, Martens, Dahl and Hinton, "On the importance of initialization and momentum in deep learning", ICML 2013
Momentum and Nesterov momentum for deep networks.
- Gupta, Koren and Singer, "Shampoo: Preconditioned Stochastic Tensor Optimization", 2018
Keller Jordan notes that Shampoo without its preconditioner accumulation gives the same orthogonalised update.
- PyTorch documentation, torch.optim.Muon
Defaults (momentum 0.95, Nesterov, 5 steps, the same coefficients) and the 2D-only restriction.
Figures 2, 3 and 4 are toy problems I computed in this page so the mechanism is easy to see. They are not measurements of real training. Figure 6 runs Muon's actual polynomial on a made-up set of singular values. Figure 7 copies numbers from Shaurya's screenshots.