← notes Optimisation

Muon: give every direction of a matrix the same step

Muon replaces the momentum of each weight matrix with its nearest orthogonal matrix: the steepest step under the spectral norm. Five cheap polynomial steps stand in for an SVD.

21 min read 7 interactive

Every optimiser is steepest descent under some norm

Adam treats a weight matrix as a bag of independent numbers. Muon (“MomentUm Orthogonalized by Newton–Schulz”, Keller Jordan et al., December 2024) treats it as a matrix. For one hidden weight matrix W∈Rm×nW \in \mathbb{R}^{m\times n}, the whole optimiser is six lines:

Mt=μMt−1+Gtmomentum, μ=0.95M~t=Gt+μMtNesterov look-aheadX0=M~t/∥M~t∥FnormaliseXk+1=aXk+b (XkXk⊤)Xk+c (XkXk⊤)2Xk5 times, (a,b,c)=(3.4445,−4.775,2.0315)Ot=X5≈UV⊤orthogonalised updateWt=(1−ηλ)Wt−1−η s(m,n) Otshape factor s, weight decay λ\begin{aligned} &M_t=\mu M_{t-1}+G_t &&\text{momentum, } \mu=0.95\\ &\tilde M_t=G_t+\mu M_t &&\text{Nesterov look-ahead}\\ &X_0=\tilde M_t/\|\tilde M_t\|_F &&\text{normalise}\\ &X_{k+1}=aX_k+b\,(X_kX_k^\top)X_k+c\,(X_kX_k^\top)^2X_k &&\text{5 times, } (a,b,c)=(3.4445,-4.775,2.0315)\\ &O_t=X_5\approx UV^\top &&\text{orthogonalised update}\\ &W_t=(1-\eta\lambda)W_{t-1}-\eta\,s(m,n)\,O_t &&\text{shape factor } s\text{, weight decay } \lambda \end{aligned}

To see why the update is UV⊤UV^\top, start with the question that every optimiser answers. Near the current weights the loss is about linear: L(W+Δ)≈L(W)+⟨G,Δ⟩L(W+\Delta)\approx L(W)+\langle G,\Delta\rangle, with ⟨G,Δ⟩=∑ijGijΔij\langle G,\Delta\rangle=\sum_{ij}G_{ij}\Delta_{ij}. A linear function has no minimum, so you must limit the size of the step with a norm and a radius η\eta:

Δ⋆=arg⁡min⁡∥Δ∥≤η ⟨G,Δ⟩.\Delta^\star=\arg\min_{\|\Delta\|\le\eta}\ \langle G,\Delta\rangle .

The gradient alone does not fix the step. The norm (the “ruler”) does. Bernstein and Newhouse showed that Adam, Shampoo and Prodigy, with their moving averages switched off, are exactly this rule with different norms:

  • Frobenius norm (the matrix as one long vector): the best step is −η G/∥G∥F-\eta\,G/\|G\|_F, normalised gradient descent.
  • Max-entry norm (no single weight moves more than η\eta): the best step is −η sign(G)-\eta\,\mathrm{sign}(G). Adam with β1=β2=0\beta_1=\beta_2=0 is g/g2=sign(g)g/\sqrt{g^2}=\mathrm{sign}(g), so Adam is a smoothed sign descent.
  • Spectral norm ∥D∥op=σ1(D)\|D\|_{op}=\sigma_1(D), the largest stretch of the matrix: the best step is −η UV⊤-\eta\,UV^\top. That is Muon.

The Frobenius, spectral and nuclear norms depend only on the singular values: they are the ℓ2\ell_2, ℓ∞\ell_\infty and ℓ1\ell_1 norms of (σ1,…,σr)(\sigma_1,\dots,\sigma_r). So gradient descent against Muon is ℓ2\ell_2 against ℓ∞\ell_\infty steepest descent, applied to the singular values instead of the entries. This is why UV⊤UV^\top is also written msign(G)\mathrm{msign}(G), the matrix sign.

playground

Three rulers, three steepest steps

Drag the gradient tip anywhere on the plot. Switch the axes from singular directions to entries.

Axes are

In the circle the budget is shared, so the best step leans towards the stronger direction (gradient descent). In the square each direction has its own budget, so the best step is a corner: equal steps (Muon, or sign descent on entries). Each step wins only under its own ruler, so compare ⟨G, D⟩ only inside one ball.

The spectral norm is the right ruler for a linear layer

Every matrix turns, stretches, and turns again: G=UΣV⊤=∑iσiuivi⊤G=U\Sigma V^\top=\sum_i\sigma_iu_iv_i^\top, and Gvi=σiuiGv_i=\sigma_iu_i. Orthogonalisation keeps both turns and replaces every nonzero stretch by 1. Take G=(3045)G=\left(\begin{smallmatrix}3&0\\4&5\end{smallmatrix}\right). It has singular values 6.7086.708 and 2.2362.236, and UV⊤=15(2−112)UV^\top=\tfrac{1}{\sqrt5}\left(\begin{smallmatrix}2&-1\\1&2\end{smallmatrix}\right), a pure rotation by 26.57∘26.57^\circ. The same matrix has two other names. It is the nearest semi-orthogonal matrix to GG in Frobenius norm. It is also Shampoo with its memory switched off: (GG⊤)−1/4G(G⊤G)−1/4=UV⊤(GG^\top)^{-1/4}G(G^\top G)^{-1/4}=UV^\top.

Bernstein’s argument for this ruler is about the layer’s output. After a step, y=Wxy=Wx changes by ΔW x\Delta W\,x, and ∥ΔW x∥≤∥ΔW∥op∥x∥\|\Delta W\,x\|\le\|\Delta W\|_{op}\|x\| with equality for the top singular vector. Activations have entries of size about 1, so measure vectors by their RMS. The worst-case output change per unit input is then n/m ∥ΔW∥op\sqrt{n/m}\,\|\Delta W\|_{op}, the RMS→RMS norm. If no input may see its output change by more than η\eta in RMS, the steepest step is

ΔW=−η mn  UV⊤=−η fan-outfan-in  msign(G).\Delta W=-\eta\,\sqrt{\frac{m}{n}}\;UV^\top=-\eta\,\sqrt{\frac{\text{fan-out}}{\text{fan-in}}}\;\mathrm{msign}(G).

Now η\eta has a meaning that does not depend on width: it is the largest RMS change of the layer’s output. This is why Muon’s learning rate transfers across model widths more easily than SGD’s.

The argument needs a matrix that multiplies dense activation vectors. An embedding table has one-hot inputs, so a different norm applies. Biases and norm gains are vectors, and for a vector Muon is only g/∥g∥g/\|g\|. For the output head, AdamW works better, and Keller Jordan says that this choice is “driven by empirics”. So Muon trains the hidden matrices only, and AdamW trains the rest. Convolution filters are first reshaped to (out, in⋅khkw)(\text{out},\ \text{in}\cdot k_hk_w) matrices.

Equal steps for loud and quiet directions

For one token, the gradient of a linear layer is an outer product δx⊤\delta x^\top. A batch gives a sum of such products. Many tokens have similar inputs and errors, so a few directions get most of the weight. Keller Jordan: the updates of SGD-momentum and Adam for transformer matrices “typically have very high condition number. That is, they are almost low-rank matrices.” Write a step as D=∑iciuivi⊤D=\sum_ic_iu_iv_i^\top. Gradient descent has ci∝σic_i\propto\sigma_i. Muon has ci=1c_i=1 for every ii. For singular values (10,1,0.1)(10,1,0.1), the relative steps are 1:0.1:0.011:0.1:0.01 for SGD and 1:1:11:1:1 for Muon.

The walkthrough builds a clean case where equal steps are exactly right. A matrix must store three key→value facts, seen with frequencies 90%, 9% and 1%. With strengths aia_i, the gradient is already an SVD, with singular values pi∣1−ai∣p_i|1-a_i|. The condition number of 90 comes only from the frequencies. Frequency says nothing about how important a fact is.

animation

Three facts, seen 90%, 9% and 1% of the time

Press Play. Then set the Muon rate to 0.30, or push the GD rate above 2.

Speed
gradient descent Muon target a = 1
step
GD: steps until fact 3 ≥ 0.9
Muon: steps until all ≥ 0.9
Gradient descent at rate 1/0.9 learns fact 1 in one step, but it needs 22 steps for fact 2 and 207 for fact 3. Muon moves every fact by exactly η and learns all three in 4 steps. At η = 0.30 Muon never settles (1.2 → 0.9 → 1.2 …): its step does not shrink near the answer.

So Muon removes how strongly the batch pushes each direction and keeps which direction. In this toy problem that is exactly the right thing to remove. For real networks it is a hypothesis: Keller Jordan writes “We speculate that” orthogonalisation increases the scale of “rare directions” that are small in the update but important for learning. The price is visible in the race. The step size no longer shrinks when the gradient shrinks, so Muon needs a decaying learning rate.

Three more properties explain details of the algorithm:

  • Scale invariance. msign(cG)=msign(G)\mathrm{msign}(cG)=\mathrm{msign}(G) for c>0c>0. A momentum sum and a momentum average give the same update, and the size of the gradient never enters the step.
  • Rotation equivariance. Rotate the inputs or outputs of the layer and Muon’s update rotates with them. Sign descent and Adam act entry by entry, so they depend on the coordinate system.
  • Momentum first. An earlier method, Orthogonal-SGDM, orthogonalised each gradient and then applied momentum. Keller Jordan reports that Muon’s order “performs better empirically”. Momentum first averages out the batch noise, so only the consistent directions get full-size steps.

Newton–Schulz: an SVD made of matrix products

An SVD of a large matrix is a sequential algorithm that GPUs run slowly. The coupled Newton iterations in Shampoo implementations need float32. Matrix products are the one operation that GPUs do at full speed in bf16. The key fact is that an odd matrix polynomial acts on each singular value separately and never touches the singular vectors:

aX+b (XX⊤)X+c (XX⊤)2X=U (aΣ+bΣ3+cΣ5) V⊤.aX+b\,(XX^\top)X+c\,(XX^\top)^2X=U\,(a\Sigma+b\Sigma^3+c\Sigma^5)\,V^\top .

Apply it NN times and each σ\sigma goes through the scalar map pNp^N. If pN(σ)≈1p^N(\sigma)\approx1 for every σ\sigma in range, the result is about UV⊤UV^\top. First divide by the Frobenius norm. Since σ1≤∥G∥F\sigma_1\le\|G\|_F, every singular value is then in (0,1](0,1].

The classic cubic p(x)=1.5x−0.5x3p(x)=1.5x-0.5x^3 has p(1)=1p(1)=1 and p′(1)=0p'(1)=0, so near 1 the error squares at every step. Near 0 its slope is only 1.5. A value of 0.01 needs 13 steps to pass 0.9. Jordan gave up exactness to buy a steep start. His rule was to maximise the slope at 0, subject to the values ending in about [0.7,1.3][0.7, 1.3]. An “ad-hoc gradient based” search gave

φ(x)=3.4445 x−4.7750 x3+2.0315 x5,φ′(0)=3.4445,φ(1)=0.701.\varphi(x)=3.4445\,x-4.7750\,x^3+2.0315\,x^5,\qquad \varphi'(0)=3.4445,\quad \varphi(1)=0.701 .

So 1 is not even a fixed point. The map has a trapping band [0.682,1.134][0.682, 1.134]. Once a singular value enters it, the value stays there and zig-zags between about 0.7 and 1.1 forever.

playground

Where each singular value goes

Drag the orange start point along the left plot. Compare Cubic, Jordan and Polar Express, and change N.

Coefficients
polynomial p (one step) path of the start value x₀ (drag it) band [0.68, 1.13]
a = slope at 0 (step 1)
x₀ after N steps
range, inputs ≥ 0.01
range, inputs ≥ 0.001

After 5 steps the cubic leaves an input of 0.01 at 0.076. Jordan's quintic puts every input above 0.01 in [0.682, 1.134]. Polar Express changes the polynomial at each step and puts every input above 0.001 in [0.840, 1.124].

Below about 10−4∥G∥F10^{-4}\|G\|_F, even the quintic cannot lift a value. That is acceptable: bf16 has a relative precision of about 2−8≈0.0042^{-8}\approx0.004, so such directions are close to round-off noise.

The same iteration on a whole 2×22\times2 matrix shows what “keep the turn, drop the stretch” looks like.

animation

Rounding the ellipse

Press Play. Then drag the two column tips of G close together (a nearly singular G) and play again.

Coefficients
image of e₁ (drag on the left) image of e₂ unit circle
σ of G
σ of Xₖ
turn of UVᵀ
‖Xₖ − UVᵀ‖_F
The axes of the ellipse keep their directions, because U and V never change; only their lengths move towards 1. The dashed rings mark the exact UVᵀ, a 26.57° turn for the default G. This G is well conditioned, so the cubic ends closest; Jordan's quintic ends at 1.13 and 0.75, inside its band. Make G nearly singular and the cubic leaves the short axis short.

The inexact output is good enough. The NS output is 15–30% away from UV⊤UV^\top in Frobenius norm, and bf16 adds almost nothing on top of that. Training does not care much. Moonlight reports that 10 steps give a more accurate result than 5 “but it won’t lead to better performances”. The Polar Express authors found that even the exact SVD “does not improve the optimization quality”. A better 5-step polynomial helps a little, though. Polar Express (Amsel et al., ICLR 2026) uses a different odd quintic at each step and chooses them greedily, which they prove optimal. The first step has a slope of about 8.2, and later steps flatten towards a convergent quintic. On GPT-2-Large with 1B FineWeb tokens, the best validation loss was 3.340 against 3.398 with Jordan’s coefficients. The NanoGPT speedrun adopted it at record #38. DeepSeek-V4 uses another fix: 8 of Jordan’s steps, then 2 steps of (2,−1.5,0.5)(2,-1.5,0.5), which land every input in [10−3,1][10^{-3},1] in [1.0000,1.0005][1.0000, 1.0005].

One full Muon step, and what it costs

The released code (muon.py) adds three details to the six lines. It writes momentum as an average, which msign\mathrm{msign} makes equivalent. It transposes tall matrices so that XX⊤XX^\top is the small Gram matrix. It scales the result by max⁡(1, rows/cols)\sqrt{\max(1,\,\text{rows}/\text{cols})}. The defaults are learning rate 0.02 (“in units of spectral norm per update”), momentum 0.95, Nesterov on, and 5 NS steps. The README says: “Only the learning rate and weight decay must be tuned.” The animation below runs the walkthrough’s hand example. A 2×32\times3 layer starts at W=0W=0 with two tokens, so the gradient has rank 2.

animation

One Muon step, stage by stage

Press Play, or Step through the stages. Watch the two singular values: they grow, are normalised, then zig-zag towards 1.

Speed

    optimiser step t
    loss
    σ₁ / σ₂ of this matrix
    At step 1 the loss goes 1.0 → 0.9443; the exact UVᵀ would give 0.9324. After NS5 the strong direction gets 0.726 and the weak one 1.049, so the first-order gain is 82% of the exact one. From step 2 the momentum mixes in old gradients.

    Cost. For an m×nm\times n matrix with m≤nm\le n, one quintic step is three products: 2m2n2m^2n for A=XX⊤A=XX^\top, 2m32m^3 for A⋅AA\cdot A, and 2m2n2m^2n for B⋅XB\cdot X. The forward and backward pass through the same matrix cost 6mnB6mnB FLOPs for a batch of BB tokens. So the overhead of TT steps is

    T (4m2n+2m3)6mnB ≤ TmB.\frac{T\,(4m^2n+2m^3)}{6mnB}\ \le\ \frac{Tm}{B}.

    calculator

    Newton–Schulz overhead calculator

    Pick a preset, or type a shape. Lower the batch to see when the overhead stops being small.

    NS FLOPs per step
    fwd + bwd FLOPs, 6mnB
    overhead
    bound Tm / B
    NanoGPT's 768×3072 MLP at 524k tokens: 0.55%. Llama-405B-like shapes at about 16.8M tokens: 0.38% and 0.49%. This counts arithmetic only. In distributed training NS needs the whole matrix on one device, which costs communication.

    Moonlight: weight decay and one update size for every shape

    Moonshot AI (“Muon is Scalable”, February 2025) found two problems when it trained large LLMs with Muon.

    The weights grow. Without weight decay, “both the weight and the layer output’s RMS keep growing to a large scale, exceeding the high-precision range of bf16”. The fix is AdamW-style decoupled decay, Wt=(1−ηλ)Wt−1−ηOtW_t=(1-\eta\lambda)W_{t-1}-\eta O_t. With Muon it has a clean meaning. Each update has spectral norm about ss, so ∥Wt∥op\|W_t\|_{op} stays below a ceiling of about s/λs/\lambda. Chen, Li and Liu prove that Muon with decoupled weight decay implicitly solves min⁡L(W)\min L(W) subject to ∥W∥op≤1/λ\|W\|_{op}\le1/\lambda. On an 800M model trained for 100B tokens, vanilla Muon led early, but Muon with weight decay led at the end.

    The update size depends on the shape. UV⊤UV^\top has rr singular values equal to 1, so its RMS over all entries is 1/max⁡(m,n)1/\sqrt{\max(m,n)}. That is too small for a big MLP matrix and too large when each KV head is a separate parameter. Moonlight scales the update by 0.2max⁡(m,n)0.2\sqrt{\max(m,n)}, which gives every matrix an update RMS of 0.2, close to AdamW’s. Then “Muon can directly reuse the learning rate and weight decay tuned for AdamW.” In their sweep, RMS 0.2 and 0.4 were the best (validation loss 3.325 and 3.314, against 3.679 for AdamW), and they chose 0.2.

    The conventions disagree only in step size per matrix, not in direction. For an MLP with dmodel=1024d_\text{model}=1024 and dff=4096d_\text{ff}=4096, the RMS→RMS norm of the update before η\eta is:

    conventionfactorup, 4096×1024down, 1024×4096
    none, UV⊤UV^\top10.52
    Jordan’s codemax⁡(1,m/n)\sqrt{\max(1,m/n)}12
    Bernsteinm/n\sqrt{m/n}11
    Moonlight0.2max⁡(m,n)0.2\sqrt{\max(m,n)}6.425.6

    Only Bernstein’s factor gives every layer the same output change. Moonlight instead equalises the per-entry size, which lets you reuse AdamW settings. PyTorch’s torch.optim.Muon (since 2.9) offers both rules.

    Distributed Muon. AdamW is element-wise, so with ZeRO-1 each rank updates its own slice. msign\mathrm{msign} needs the whole matrix, so Moonlight gathers the momentum slices, runs NS on the full matrix, and keeps the local slice. The communication is between 1 and 1.25 times AdamW’s, and the optimiser latency is “usually 1% to 3%” of the forward–backward time.

    Results. In scaling-law runs from 399M to 1.5B parameters, with AdamW hyperparameters reused, Muon reached AdamW’s loss with 0.519× the FLOPs. Moonlight itself is a 16B-total / 3B-active MoE trained on 5.7T tokens. Against its AdamW twin after about 1.2T tokens, it was better on 6 of 7 benchmarks, most clearly on code and math, and worse on BBH. Fine-tuning shows an “optimizer mismatch”: Muon pre-training plus Muon SFT was best, and Muon SFT on an AdamW-pretrained model was equal or worse.

    MuonClip: a per-head thermostat for attention logits

    When Kimi scaled Muon towards a trillion parameters, the largest query–key logits in a few heads grew past 1000 in a 9B-active / 53B-total test model. The K2 report says this happens “more frequently with Muon but less with AdamW”. The usual fix, QK-Norm, does not apply to Multi-head Latent Attention (MLA), because the keys “are not fully materialized during inference”. Logit soft-capping limits the logits, but the dot products can still grow below the cap.

    The report’s explanation is labelled a hypothesis. The logit is bounded by ∥Wq∥op ∥Wk∥op\|W_q\|_{op}\,\|W_k\|_{op}. A Muon update adds the same amount along every singular direction, so it is more likely to line up with an existing large direction of WW, and the spectral norms can grow. The product then grows with the square.

    QK-Clip. The logit is bilinear in WqW_q and WkW_k. After each optimiser step, read each head’s largest logit Smax⁡hS^h_{\max}, which the forward pass already computed. If it is above τ\tau, set γh=τ/Smax⁡h\gamma_h=\tau/S^h_{\max} and scale WqhW_q^h and WkhW_k^h by γh\sqrt{\gamma_h} each. That head’s largest logit becomes exactly τ\tau, and no other head changes. In MLA, the rotary key kRk^R is shared by all heads, so it must stay fixed. The head’s rotary query qRq^R takes the full factor γh\gamma_h instead.

    playground

    QK-Clip on eight heads

    Drag the top of any dashed bar to change that head's largest logit. Move τ. Switch to the global rule.

    Rule
    content part qC·kC rotary part qR·kR before clipping
    heads clipped
    healthy heads changed
    largest logit after

    Per head, only the heads above τ shrink, each by its own γ, and each ends exactly at τ. A global γ = τ / max S also shrinks every healthy head. Toy numbers; head 3 repeats the walkthrough's MLA example (250 = 180 + 70 → 72 + 28).

    In the K2 run (τ=100\tau=100), the max logit rose fast to the cap and decayed to a stable range after about 30% of training. In the first 70,000 steps, 12.7% of heads triggered QK-Clip at least once. After that, all heads stayed below 100 and the clip switched itself off. K2 is a 1T-total / 32B-active MoE trained on 15.5T tokens “with zero loss spike”. A small model with a low τ=30\tau=30 showed “no statistically significant degradation”. Other large Muon users control logits differently: QK-Norm (GLM-4.5, Arcee Trinity), per-head orthogonalisation of MLA (“Muon Split”, GLM-5), or RMSNorm on queries and KV entries (DeepSeek-V4). The walkthrough’s own reading: QK-Clip is not specific to Muon. It is a weight-space limit on one quantity, and it would work with any optimiser.

    How large is the gain

    Four studies give four different numbers, and the baseline explains most of the spread.

    studysetupfinding
    Moonlight399M–1.5B, AdamW settings reusedabout 52% of AdamW’s FLOPs for the same loss
    Essential AI100M–4B10–15% fewer tokens; the advantage stays or grows with batch size
    Wen et al.10 optimisers, 0.1B–1.2B, each tuned separatelyspeedup over AdamW falls from 1.4× at 0.1B to 1.1× at 1.2B
    NVIDIA (2026)multi-billion, batches up to 100M tokensSOAP and Muon beat AdamW; AdamW “fails to scale” with batch size

    Theory now explains precisely what Muon does: it is the steepest-descent (or trust-region) step in the spectral norm, and with weight decay it solves a constrained problem. Why it helps on real networks is still open. Equal steps for rare directions, the right norm for linear layers, low-rank curvature and the implicit constraint are all candidate explanations. They are compatible, but none is proven to be the main cause in large models. Other questions are also open: which matrices to orthogonalise together (Q, K and V separately, per head, or pairs of heads), and how to pay for the full-matrix step in distributed training.