← ml-viz Muon & MuonClip post optimizers guide

Muon & MuonClip: Matrix-Aware Optimizers

Adam treats a neural network as one flat vector, so 2D weight updates collapse onto a handful of dominant singular directions. Muon orthogonalizes the momentum matrix with five quintic Newton-Schulz iterations so rare directions get equal step size, and MuonClip caps runaway per-head attention logits without disturbing healthy heads. Every matrix, singular value, trajectory, and logit curve below is computed live in pure JavaScript.

Start with a rank-skewed 4×4 momentum matrix G = U S VT, normalize by its Frobenius norm (X0 = G / (||G||F + 10−7)), and iterate the odd quintic polynomial Xk+1 = aXk + b(XkXkT)Xk + c(XkXkT)2Xk. Because odd polynomials preserve U and V, every iteration acts purely on each singular value σi → p(σi).
seed 42

Exact singular values σ1 … σ4

Ghost bars show X0; solid bars show Xk computed via exact Jacobi eigendecomposition of XTX.
iter 0 (after Frobenius norm) iter k singular value ideal polar factor (σ = 1)

Composed polynomial transfer p(k)(s)

How k applications of p(s) = as + bs³ + cs5 warp [0, 1] toward the ideal step sgn(s) = 1.
p(k)(s) ideal sgn(s) = 1 current matrix σ1…σ4

Gram matrix XkT Xk → I4

An orthogonal matrix satisfies XTX = I: diagonal entries approach 1.00 and off-diagonals stay 0.00.

Orthogonality error & amplification