AI Logic

Optimizers

Muon

Updated:

How Muon works. Left: one step that builds momentum from the gradient, orthogonalizes it with Newton-Schulz iteration, rescales it according to the matrix shape, and applies the update. Right: a graph showing where singular values from 0.001 to 1 move after 5 Newton-Schulz iterations, comparing Muon's coefficients with a baseline set of coefficients

Background and Overview

Muon is an optimizer that replaces the update for each hidden-layer weight matrix with the "nearest orthogonal matrix" before applying it. The name stands for MomentUm Orthogonalized by Newton-Schulz.

Muon originates not from a paper but from a blog post, "Muon: An optimizer for hidden layers in neural networks," published by Keller Jordan in December 2024. It drew attention by setting records in public competitions for reaching a target accuracy as fast as possible (the CIFAR-10 and NanoGPT "speedruns"). Later, Liu et al. at Moonshot AI released a technical report (2025) with improvements that make it usable for large-scale language model training, and it has been added to PyTorch as torch.optim.Muon.

Muon's main characteristics are as follows.

  • It treats weights as matrices: Whereas Adam and similar methods treat each parameter separately, Muon replaces the update for the whole weight matrix with a matrix close to UV⊤UV^\top, obtained by setting every entry of Σ\Sigma in the singular value decomposition UΣV⊤U\Sigma V^\top to 1.
  • It is used only for 2D hidden-layer weights: The input embeddings, the final output layer, and scalar or vector parameters such as biases are updated with AdamW.
  • The extra computation is small: Orthogonalization can be approximated with a few matrix multiplications, and according to the blog the increase in compute is under 1%.

Theory (Computation in One Step)

Following the official implementation (KellerJordan/Muon on GitHub) and Eq. (1) of the technical report by Liu et al., for a weight matrix WW of shape A×BA \times B, the following computation is performed at each step tt.

  1. Compute the gradient GtG_t and update the momentum BtB_t.
  2. Form the Nesterov-style momentum Mt=Gt+μBtM_t = G_t + \mu B_t (the default in the official implementation).
  3. Divide MtM_t by its Frobenius norm and apply 5 Newton-Schulz iterations to obtain the orthogonalized Ot≈UV⊤O_t \approx UV^\top (where Mt=UΣV⊤M_t = U\Sigma V^\top).
  4. Multiply by a scale factor that depends on the matrix shape, and update together with weight decay.
Bt=μBt−1+Gt,Mt=Gt+μBt,Ot=NewtonSchulz(Mt)≈UV⊤B_t = \mu B_{t-1} + G_t, \qquad M_t = G_t + \mu B_t, \qquad O_t = \mathrm{NewtonSchulz}(M_t) \approx U V^\top Wt=(1−ηλ) Wt−1−η⋅s⋅OtW_t = (1 - \eta\lambda)\, W_{t-1} - \eta \cdot s \cdot O_t

The momentum coefficient is μ=0.95\mu = 0.95. The scale factor ss is max⁡(1,A/B)\sqrt{\max(1, A/B)} in the official implementation and 0.2max⁡(A,B)0.2\sqrt{\max(A, B)} in the technical report by Liu et al. (see below).

Newton-Schulz iteration starts from the normalized X0=Mt/∥Mt∥FX_0 = M_t / \|M_t\|_F and repeats the following update (Eq. (2) of Liu et al.).

Xk=aXk−1+b (Xk−1Xk−1⊤) Xk−1+c (Xk−1Xk−1⊤)2 Xk−1X_k = a X_{k-1} + b\,(X_{k-1} X_{k-1}^\top)\, X_{k-1} + c\,(X_{k-1} X_{k-1}^\top)^2\, X_{k-1}

Each update leaves the singular vectors UU and VV unchanged and is equivalent to applying the polynomial φ(σ)=aσ+bσ3+cσ5\varphi(\sigma) = a\sigma + b\sigma^3 + c\sigma^5 to each singular value σ\sigma. Dividing by the Frobenius norm puts all singular values in [0,1][0, 1], so applying φ\varphi a few times gathers the singular values near 1. The blog uses the coefficients (a,b,c)=(3.4445,−4.7750,2.0315)(a, b, c) = (3.4445, -4.7750, 2.0315) and 5 iterations.

The orthogonalized UV⊤UV^\top is the orthogonal matrix closest to MtM_t (in the Frobenius norm sense). Computing the singular value decomposition directly gives it exactly, but that is too slow on GPUs. Newton-Schulz iteration needs only matrix multiplications and runs stably even in bfloat16, which is why the blog chooses it.

Choosing the Coefficients and Why Orthogonalization Works

The right side of the figure at the top shows, computed from the formula, where each singular value before iteration (after normalization) ends up after 5 Newton-Schulz iterations.

  • Baseline coefficients (2,−1.5,0.5)(2, -1.5, 0.5): These bring singular values exactly toward 1, but small singular values (such as 0.01) do not reach 1 within 5 iterations.
  • Muon's coefficients (3.4445,−4.7750,2.0315)(3.4445, -4.7750, 2.0315): These make the slope aa near 0 as large as possible, so that even small singular values are lifted close to 1 within 5 iterations. In exchange, the result is not exactly 1 but oscillates roughly between 0.7 and 1.2.

According to the blog, the coefficients were chosen to maximize aa subject to the condition that "the final singular values fall in [0.7,1.3][0.7, 1.3]." The blog states that a deviation of about 0.3 from 1 had no effect on the loss curve, and a comment in the official implementation also says that the difference from UV⊤UV^\top does not hurt performance.

Why orthogonalization works: The blog observes that SGD-momentum and Adam updates for the 2D parameters of a Transformer tend to be nearly low-rank (dominated by a few directions). It conjectures that orthogonalization, by making all singular values equal, relatively strengthens learning along directions that are rare but important. Liu et al. likewise explain that orthogonalization prevents the weights from learning only along a few dominant directions.

Relation to Shampoo: Bernstein and Newhouse (2024) showed that if Shampoo stops accumulating its preconditioners (setting Lt=GtGt⊤L_t = G_t G_t^\top and Rt=Gt⊤GtR_t = G_t^\top G_t), the update Lt−1/4GtRt−1/4L_t^{-1/4} G_t R_t^{-1/4} becomes UV⊤UV^\top, which coincides with steepest descent under the spectral norm. The blog positions Muon as this "Shampoo without accumulation" with momentum added before orthogonalization.

Experimental Results

Results reported in the blog (Jordan, 2024)

  • Speed to reach 94% on CIFAR-10: The record improved from 3.3 seconds to 2.6 seconds (on a single A100).
  • NanoGPT speedrun (until reaching a validation loss of 3.28 on FineWeb): 1.35 times faster. The speedup persisted when scaling up to 774M and 1.5B parameters.
  • 1.5B-parameter language model: To reach GPT-2 XL-level HellaSwag performance, Muon took 10 hours versus 13.3 hours for AdamW (on 8 H100s).

Results reported in the technical report by Liu et al. (2025)

  • About 2x compute efficiency: In scaling-law experiments with compute-optimal training, Muon matched AdamW's performance with about 52% of the compute.
  • Large-scale training: The authors released Moonlight, a 3B/16B-parameter MoE model trained with Muon on 5.7T tokens, and report that it outperforms existing models with less training compute, advancing the Pareto frontier of performance versus compute.

The blog argues that new optimizers should be evaluated on competitive training tasks, where the risk of comparing against under-tuned baselines is small. At the same time, it acknowledges that each step takes longer than with AdamW and that it cannot rule out a well-tuned AdamW catching up in sample efficiency.

Additional compute: The blog estimates the extra compute of Newton-Schulz iteration to be at most Tm/BT m / B (TT is the number of iterations, mm the model width, and BB the batch size in tokens). This comes to about 0.7% for the NanoGPT speedrun (m=768m = 768, B=524,288B = 524{,}288) and about 0.5% for a Llama 405B-scale setup (m=16,384m = 16{,}384, B=16B = 16 million).

Practical Considerations

Use Muon only for the 2D weights of hidden layers, and update all other parameters with AdamW. The blog, the official implementation, and the PyTorch documentation all say to use AdamW or a similar method for the input embeddings, the final output layer (classifier head), and scalar or vector parameters such as biases and normalization gains. PyTorch's torch.optim.Muon also accepts only 2D parameters, so the two optimizers are used side by side.

  • Flatten convolution weights: A 4D weight can be treated as a 2D matrix by merging its last three dimensions.
  • Handle Q, K, and V separately: The blog reports that applying Muon to Q, K, and V separately worked better than applying it to a combined QKV matrix.
  • The scale factor differs between implementations: The official implementation multiplies by max⁡(1,A/B)\sqrt{\max(1, A/B)}. Liu et al. showed that the RMS of Muon's update is theoretically 1/max⁡(A,B)\sqrt{1/\max(A, B)} and varies greatly with the matrix shape (Lemma 1), and they multiply by 0.2max⁡(A,B)0.2\sqrt{\max(A, B)} to match the RMS of AdamW's update (about 0.2 to 0.4). This lets the learning rate and weight decay tuned for AdamW be reused as is. In PyTorch, adjust_lr_fn selects between "original" (the default) and "match_rms_adamw".
  • Use weight decay for large-scale or long training: The original implementation had no weight decay. Liu et al. showed that without it, the magnitudes of the weights and layer outputs keep growing until they exceed the range of bfloat16, and performance stops improving in long training runs; they add weight decay of the same form as AdamW. PyTorch's default is weight_decay=0.1.
  • PyTorch defaults: lr=0.001, weight_decay=0.1, momentum=0.95, nesterov=True, ns_coefficients=(3.4445, -4.775, 2.0315), and ns_steps=5. The official implementation's default learning rate is 0.02; note that the suitable learning rate depends on how the scale factor is chosen.
  • More iterations do not help: Liu et al. report that increasing the iterations to 10 makes the orthogonalization more accurate but does not improve performance.
  • Open questions: The blog lists as open questions how Muon behaves at even larger scale (20B+ parameters trained on 1T+ tokens), how to distribute the iteration across large GPU clusters, and whether it is effective beyond pretraining (fine-tuning and reinforcement learning).

Comparison with Other Optimizers

The table below arranges optimizers by how they treat matrix weights (the weight is an A×BA \times B matrix).

MethodHow the update is formedUses matrix structureExtra stateMain extra computation
SGD (momentum)The momentum itselfNo1x parametersNone
AdamWDivide elementwise by the second momentNo2x parametersElementwise operations
ShampooSandwich between the −1/4-1/4 powers of the left and right (accumulated) preconditionersYesA2+B2A^2 + B^2Matrix roots (e.g., eigendecomposition)
MuonOrthogonalize the momentum toward UV⊤UV^\topYes1x parametersAbout 5 matrix multiplications
LionSign of the momentumNo1x parametersElementwise operations

Whereas Lion takes the sign and so equalizes magnitudes elementwise to ±1\pm 1, Muon equalizes all singular values of the matrix to 1. Following the view of Bernstein et al., Liu et al. explain the difference between Adam and Muon as a difference in "under which norm the direction of steepest descent is chosen."

Rough guidelines for choosing are as follows.

  • To train a Transformer language model with less compute than AdamW, use Muon (hidden layers) + AdamW (everything else): Both the blog and the technical report reached the same loss with less compute.
  • To reuse existing AdamW settings, use the RMS-matching scale factor (match_rms_adamw): The learning rate and weight decay can be used as is.
  • Fine-tuning and reinforcement learning: The blog lists these as open questions, so verify against AdamW.

PyTorch example

Show code
python
import torch
import torch.nn as nn


def newton_schulz5(G, steps=5, eps=1e-7):
    # Quintic Newton-Schulz iteration, same as the blog and official implementation (O ≈ UV^T)
    a, b, c = (3.4445, -4.7750, 2.0315)
    X = G / (G.norm() + eps)                 # keep singular values in [0, 1]
    transposed = G.size(0) > G.size(1)
    if transposed:
        X = X.T
    for _ in range(steps):
        A = X @ X.T
        X = a * X + (b * A + c * A @ A) @ X
    return X.T if transposed else X


class MiniMuon(torch.optim.Optimizer):
    # For 2D weights only. Update: B ← μB + G, M = G + μB, W ← (1 − ηλ)W − η·s·NS(M)
    def __init__(self, params, lr=0.02, momentum=0.95, weight_decay=0.0):
        super().__init__(params, dict(lr=lr, momentum=momentum, weight_decay=weight_decay))

    @torch.no_grad()
    def step(self):
        for g in self.param_groups:
            for p in g["params"]:
                if p.grad is None:
                    continue
                st = self.state[p]
                if not st:
                    st["buf"] = torch.zeros_like(p)
                st["buf"].mul_(g["momentum"]).add_(p.grad)               # B_t = μB_{t−1} + G_t
                m = p.grad + g["momentum"] * st["buf"]                    # Nesterov style
                o = newton_schulz5(m)
                scale = max(1.0, p.size(0) / p.size(1)) ** 0.5            # scale factor of the official implementation
                p.mul_(1 - g["lr"] * g["weight_decay"])
                p.add_(o, alpha=-g["lr"] * scale)


model = nn.Sequential(nn.Embedding(1000, 64), nn.Linear(64, 256), nn.GELU(), nn.Linear(256, 64), nn.Linear(64, 1000))
emb, head = model[0], model[4]
hidden = [p for n, p in model.named_parameters() if p.ndim == 2 and not n.startswith(("0.", "4."))]
others = [p for n, p in model.named_parameters() if not (p.ndim == 2 and not n.startswith(("0.", "4.")))]

# Muon for hidden-layer matrices; AdamW for embeddings, output layer, and biases
opt_muon = MiniMuon(hidden, lr=0.02, momentum=0.95)
opt_adamw = torch.optim.AdamW(others, lr=3e-4, weight_decay=0.01)
# With the PyTorch built-in: torch.optim.Muon(hidden, lr=0.02, momentum=0.95)

model.train()
x = torch.randint(0, 1000, (8, 16))
y = torch.randint(0, 1000, (8, 16))
logits = model(x)
loss = nn.functional.cross_entropy(logits.reshape(-1, 1000), y.reshape(-1))
opt_muon.zero_grad(); opt_adamw.zero_grad()
loss.backward()
opt_muon.step(); opt_adamw.step()

FAQ

Q. Is Muon's original source a paper?
A.

No. The original source is a blog post by Keller Jordan (December 2024). The formulas can also be checked against the official implementation (GitHub). Later, the technical report "Muon is Scalable for LLM Training" by Liu et al. (2025) presented improvements for large-scale training (weight decay and adjusting the update magnitude).

Q. Why is Muon not used for embeddings or the output layer?
A.

The blog, the official implementation, and the PyTorch documentation all say to use Muon only for the 2D weights of hidden layers, and to update embeddings, the output layer, and scalar or vector parameters with AdamW. The blog notes that treating the embedding layer separately can be explained by the theory of the "modular norm," whereas the treatment of the output layer is empirical.

Q. What learning rate should I use?
A.

It depends on how the scale factor is chosen. The official implementation (scale factor max⁡(1,A/B)\sqrt{\max(1, A/B)}) defaults to 0.02. With the method of Liu et al. (scale factor 0.2max⁡(A,B)0.2\sqrt{\max(A, B)}, adjust_lr_fn='match_rms_adamw' in PyTorch), the learning rate and weight decay tuned for AdamW can be used as is.

References

  1. K. Jordan, "Muon: An optimizer for hidden layers in neural networks," blog post, 2024.
  2. K. Jordan, "Muon" (official implementation), GitHub.
  3. J. Liu, J. Su, X. Yao, Z. Jiang, G. Lai, Y. Du, et al., "Muon is Scalable for LLM Training," arXiv:2502.16982, 2025.
  4. J. Bernstein and L. Newhouse, "Old Optimizer, New Norm: An Anthology," OPT 2024 Workshop, arXiv:2409.20325, 2024.
  5. PyTorch Documentation, "torch.optim.Muon."