Module contents
Lesson 25 of 25Research 110 min

Low rank and orthogonalization in modern deep learning

Connect randomized SVD, singular-mode learning, low-rank optimizers, spectral steepest descent and Newton–Schulz orthogonalization.

After this lesson you can

  • Derive randomized range-finder bounds and the effect of power iterations.
  • Explain singular-mode dynamics in deep linear networks.
  • Compare LoRA and GaLore gradient geometry and optimizer memory.
  • Derive spectral-norm steepest descent and Newton–Schulz convergence.
  • Distinguish optimizer theorems from empirical and speculative claims.

Before you start

Motivation: linear algebra inside the optimizer

A transformer is primarily a collection of matrices W∈Rdout×din\mat{W} \in \R^{d_{\text{out}} \times d_{\text{in}}}. During training each receives at every step a same-shaped gradient G\mat{G} and the optimizer turns it into update ΔW\Delta\mat{W}. Until recently optimizers treated matrices as long vectors: Adam scales each entry separately and does not know G\mat{G} has rows and columns. Several influential recent ideas for training large models restore matrix structure to G\mat{G}:

  • LoRA (Hu et al., 2021) adapts a pretrained model by restricting updates to low rank, ΔW=BA\Delta\mat{W} = \mat{B}\mat{A} with B∈Rdout×r\mat{B} \in \R^{d_{\text{out}} \times r}, A∈Rr×din\mat{A} \in \R^{r \times d_{\text{in}}} and r≪dr \ll d. This is low-rank approximation as a design constraint.
  • GaLore (Zhao et al., 2024) restricts optimizer state rather than weights: it projects each gradient onto leading singular vectors and stores Adam moments in that small subspace.
  • Muon (Jordan, 2024) replaces the update with −UV⊤-\mat{U}\mat{V}\T, the orthogonal factor of the gradient’s polar decomposition, computing it without SVD using only matrix products.

Behind all three is familiar linear algebra: SVD, the Eckart–Young theorem, Schatten norms and matrix functions. This lesson develops five pieces: randomized SVD for enormous matrices, the order in which deep linear networks learn target singular modes, why layer gradients have low-rank structure, which descent direction belongs to each matrix norm, and how a polynomial applied to a matrix sends all its singular values to 1.

A methodological note before starting. This is active research where precise theorems, well-executed large-scale experiments and unreplicated blog claims coexist. We distinguish the three in each section and summarize them in a final table. The lesson follows gradient descent and the multilayer perceptron; if you have not studied them, follow the algebra and return to training later.

Capturing range with randomness: randomized SVD

The full SVD of A∈Rm×n\mat{A} \in \R^{m \times n} costs O(mnmin⁡(m,n))\bigO(mn\min(m, n)) operations and, worse, requires many irregular matrix accesses. For an 105×10410^5 \times 10^4 matrix this is order 101310^{13} operations, and usually only the first kk singular values matter, with kk between 10 and a few hundred. Halko, Martinsson and Tropp (2011) split the problem in two:

  1. Find the range. Seek a matrix Q∈Rm×ℓ\mat{Q} \in \R^{m \times \ell} with orthonormal columns, ℓ\ell slightly greater than kk, such that A≈QQ⊤A\mat{A} \approx \mat{Q}\mat{Q}\T\mat{A}: a subspace of dimension ℓ\ell containing nearly all action of A\mat{A}.
  2. Factorize the small problem. Form B=Q⊤A∈Rℓ×n\mat{B} = \mat{Q}\T\mat{A} \in \R^{\ell \times n}, which is small, calculate its exact SVD B=U~ΣV⊤\mat{B} = \tilde{\mat{U}}\mat{\Sigma}\mat{V}\T and return U=QU~\mat{U} = \mat{Q}\tilde{\mat{U}}. Since QQ⊤A=QB=(QU~)ΣV⊤\mat{Q}\mat{Q}\T\mat{A} = \mat{Q}\mat{B} = (\mat{Q}\tilde{\mat{U}})\mat{\Sigma}\mat{V}\T, factorization error is exactly that of step 1.

Step 2 is cheap deterministic algebra. All interest lies in step 1, and the answer is surprising: multiplying A\mat{A} by a few Gaussian vectors suffices.

Why randomness works

Write A=UΣV⊤\mat{A} = \mat{U}\mat{\Sigma}\mat{V}\T and take ω∼N(0,In)\vb{\omega} \sim \Normal(\vb{0}, \mat{I}_n). Then

Aω=∑jσj(vj⊤ω) uj=∑jσjgj uj,gj=vj⊤ω.\mat{A}\vb{\omega} = \sum_{j} \sigma_j (\vb{v}_j\T\vb{\omega})\, \vb{u}_j = \sum_j \sigma_j g_j\, \vb{u}_j, \qquad g_j = \vb{v}_j\T\vb{\omega}.

By rotational invariance of the multivariate Gaussian, V⊤ω\mat{V}\T\vb{\omega} is again N(0,I)\Normal(\vb{0}, \mat{I}): gjg_j are independent and typically size 1. Thus Aω\mat{A}\vb{\omega} is a random combination of uj\vb{u}_j weighted by σj\sigma_j: large-singular-value directions dominate. With ℓ\ell vectors, the span of Aω1,…,Aωℓ\mat{A}\vb{\omega}_1, \dots, \mat{A}\vb{\omega}_\ell mainly points to leading singular directions. The same invariance has a practical consequence: algorithm behavior depends only on singular values of A\mat{A}, not vectors. To study it, diagonal A=Σ\mat{A} = \mat{\Sigma} suffices, as in the next figure.

Products by A\mat{A} are batched, as m×nm\times n by n×ℓn\times\ell matrix multiplication, the most efficient operation on processors. If A\mat{A} is sparse or known only through a function computing Ax\mat{A}\vb{x} (a Hessian, a network operator), the algorithm still works: it never needs entries of A\mat{A}.

InteractiveCapturing range with randomness
Small SVD (rank k): weight of each column on singular direction j10 col.fraction of each eⱼ retained by the rank-k approximation10kk + p1e−11σₖ₊₁ (optimal)resulting error120406080100120singular direction index j
  • sketch (stage columns)
  • true σj\sigma_j
  • estimated σ~i\tilde\sigma_i and resulting error
  • optimal σk+1\sigma_{k+1}
Spectrum of A\mat{A}
10
5
0
Small SVD (rank k)
∥A−QQ⊤A∥2/σk+1\|\mat{A} - \mat{Q}\mat{Q}\T\mat{A}\|_2 / \sigma_{k+1} (k+pk + p columns)1.752
∥A−A~k∥2/σk+1\|\mat{A} - \tilde{\mat{A}}_k\|_2 / \sigma_{k+1} (rank kk)1.754
∥A−A~k∥F\|\mat{A} - \tilde{\mat{A}}_k\|_F versus optimal1.166 ×
Relative error of σ~1\tilde\sigma_1 and σ~k\tilde\sigma_k5.9 %, 32.8 %
Matrix-vector products with A\mat{A} or A⊤\mat{A}\T15
HMT bound for E∥⋅∥2/σk+1\E\|\cdot\|_2 / \sigma_{k+1}13.49
Error is far from σk+1\sigma_{k+1}: the spectral tail weighs too much. Power iterations (qq) help more than oversampling here.
The matrix has 120 singular values and is shown in its singular-vector basis (rotational invariance makes this equivalent to a dense matrix with that spectrum). Above, each row is a column of the current stage’s sketch and its intensity is that column’s weight on each singular direction jj, on a logarithmic scale. In the middle, the fraction of each ej\vb{e}_j lying in the generated space. Below are true spectrum, estimated σ~i\tilde\sigma_i and error against optimum σk+1\sigma_{k+1}. Play the stages with slow spectrum and q=0q = 0: Ω\mat{\Omega} does not distinguish directions, AΩ\mat{A}\mat{\Omega} already favors the leading ones, but the tail is so heavy that error stays far from optimum. Increase pp and then qq: which improves more per product with A\mat{A}? Switch to low-rank-plus-noise spectrum, where the effect of qq is clearer still.

The figure shows the two ingredients theory will justify. Oversampling is cheap and always helps: with p=0p = 0 some of the leading kk directions are only half captured, while with p=5p = 5 or 1010 nearly fully. Power iterations replace A\mat{A} with (AA⊤)qA(\mat{A}\mat{A}\T)^q\mat{A}, with the same singular vectors and singular values σj2q+1\sigma_j^{2q+1}: the spectral tail sinks and the sketch concentrates on leading directions. Which is preferable for equal products with A\mat{A}? It depends on the spectrum. For 1000×5001000\times500 matrices, k=20k = 20 and 60 products (mean of five seeds), in slow spectrum σj=j−1/2\sigma_j = j^{-1/2} one power iteration without oversampling leaves error 1.21 σk+11.21\,\sigma_{k+1} and 40 extra columns without powers 1.44 σk+11.44\,\sigma_{k+1}; with low rank plus noise floor, 1.061.06 versus 3.833.83. For a fast-decaying spectrum the reverse holds: 40 extra columns reach optimum and one power iteration without oversampling remains at 1.271.27.

A deterministic bound

To see these effects, split Σ\mat{\Sigma} into its leading kk singular-value block Σ1\mat{\Sigma}_1 and remainder Σ2\mat{\Sigma}_2, and similarly split V⊤Ω\mat{V}\T\mat{\Omega} into Ω1∈Rk×ℓ\mat{\Omega}_1 \in \R^{k \times \ell} (projection onto the leading kk right singular vectors) and Ω2\mat{\Omega}_2 (onto the rest).

Proof

Since Ω1\mat{\Omega}_1 has full row rank, its pseudoinverse satisfies Ω1Ω1+=Ik\mat{\Omega}_1\mat{\Omega}_1\pinv = \mat{I}_k. Define Z=YΩ1+\mat{Z} = \mat{Y}\mat{\Omega}_1\pinv. Its columns combine those of Y\mat{Y}, so col⁡(Z)⊆col⁡(Y)\col(\mat{Z}) \subseteq \col(\mat{Y}) and projecting onto the larger space leaves less residual: ∥(I−PY)A∥2≤∥(I−PZ)A∥2\norm{(\mat{I} - \mat{P}_{\mat{Y}})\mat{A}}_2 \le \norm{(\mat{I} - \mat{P}_{\mat{Z}})\mat{A}}_2. Calculate Z\mat{Z}:

Y=UΣV⊤Ω=U[Σ1Ω1Σ2Ω2],Z=U[Σ1F],F=Σ2Ω2Ω1+.\mat{Y} = \mat{U}\mat{\Sigma}\mat{V}\T\mat{\Omega} = \mat{U}\begin{bmatrix} \mat{\Sigma}_1\mat{\Omega}_1 \\ \mat{\Sigma}_2\mat{\Omega}_2 \end{bmatrix}, \qquad \mat{Z} = \mat{U}\begin{bmatrix} \mat{\Sigma}_1 \\ \mat{F} \end{bmatrix}, \quad \mat{F} = \mat{\Sigma}_2\mat{\Omega}_2\mat{\Omega}_1\pinv .

Call it R=I−PZ\mat{R} = \mat{I} - \mat{P}_{\mat{Z}}. Since RZ=0\mat{R}\mat{Z} = \mat{0}, RU[Σ10]=−RU[0F]\mat{R}\mat{U}\begin{bmatrix} \mat{\Sigma}_1 \\ \mat{0} \end{bmatrix} = -\mat{R}\mat{U}\begin{bmatrix} \mat{0} \\ \mat{F} \end{bmatrix}. Write AV=UΣ\mat{A}\mat{V} = \mat{U}\mat{\Sigma} by column blocks, the first kk and the rest:

RAV=[ RU[Σ10]  ∣  RU[0Σ2] ]=RU[00−FΣ2].\mat{R}\mat{A}\mat{V} = \Big[\ \mat{R}\mat{U}\begin{bmatrix} \mat{\Sigma}_1 \\ \mat{0} \end{bmatrix}\ \ \Big|\ \ \mat{R}\mat{U}\begin{bmatrix} \mat{0} \\ \mat{\Sigma}_2 \end{bmatrix}\ \Big] = \mat{R}\mat{U}\begin{bmatrix} \mat{0} & \mat{0} \\ -\mat{F} & \mat{\Sigma}_2 \end{bmatrix}.

R\mat{R} is a projector and U\mat{U}, V\mat{V} are orthogonal, so ∥RA∥2≤∥[−F  Σ2]∥2\norm{\mat{R}\mat{A}}_2 \le \norm{[-\mat{F}\ \ \mat{\Sigma}_2]}_2. For a horizontal block matrix, [X W][X W]⊤=XX⊤+WW⊤[\mat{X}\ \mat{W}][\mat{X}\ \mat{W}]\T = \mat{X}\mat{X}\T + \mat{W}\mat{W}\T, hence ∥[X W]∥22≤∥X∥22+∥W∥22\norm{[\mat{X}\ \mat{W}]}_2^2 \le \norm{\mat{X}}_2^2 + \norm{\mat{W}}_2^2. With X=−F\mat{X} = -\mat{F} and W=Σ2\mat{W} = \mat{\Sigma}_2 the bound follows.

∎

The two terms have direct interpretations. First, ∥Σ2∥2=σk+1\norm{\mat{\Sigma}_2}_2 = \sigma_{k+1} is the Eckart–Young optimum: no kk-dimensional subspace improves it. Second is the price of randomness. It contains Σ2Ω2\mat{\Sigma}_2\mat{\Omega}_2, the whole spectral tail mixed by the Gaussian, large for a heavy tail; and ∥Ω1+∥2=1/σmin⁡(Ω1)\norm{\mat{\Omega}_1\pinv}_2 = 1/\sigma_{\min}(\mat{\Omega}_1), the reciprocal of the smallest singular value of Gaussian k×(k+p)k\times(k + p). With p=0p = 0 that matrix is square and its smallest singular value is order 1/k1/\sqrt{k} with a tail toward zero; a few units of pp move it away from zero (by Marchenko–Pastur, for large kk and fixed p/kp/k it approaches k+p−k\sqrt{k + p} - \sqrt{k}). Oversampling controls ∥Ω1+∥\norm{\mat{\Omega}_1\pinv}; power iterations control the tail.

The mean bound and power iteration effect

Taking expectations over the Gaussian, Halko, Martinsson and Tropp obtain explicit bounds (their theorems 10.5 and 10.6). For k≥2k \ge 2 and p≥2p \ge 2:

E∥(I−PY)A∥F≤(1+kp−1)1/2(∑j>kσj2)1/2,\E\norm{(\mat{I} - \mat{P}_{\mat{Y}})\mat{A}}_F \le \Big(1 + \frac{k}{p - 1}\Big)^{1/2}\Big(\sum_{j > k}\sigma_j^2\Big)^{1/2}, E∥(I−PY)A∥2≤(1+kp−1)σk+1+ek+pp(∑j>kσj2)1/2.\E\norm{(\mat{I} - \mat{P}_{\mat{Y}})\mat{A}}_2 \le \Big(1 + \sqrt{\frac{k}{p - 1}}\Big)\sigma_{k+1} + \frac{e\sqrt{k + p}}{p}\Big(\sum_{j > k}\sigma_j^2\Big)^{1/2}.

The Frobenius bound is striking: with p=k+1p = k + 1 mean error is at most 2\sqrt{2} times the Eckart–Young optimum in that norm. The spectral bound shows the slow-spectrum problem: the final term contains the tail Frobenius norm, potentially much greater than σk+1\sigma_{k+1}. With σj=j−1/2\sigma_j = j^{-1/2} and large nn, ∑j>kσj2\sum_{j > k}\sigma_j^2 grows as log⁡(n/k)\log(n/k) and the bound deteriorates without limit. Power iterations fix this: since Aq=(AA⊤)qA\mat{A}_q = (\mat{A}\mat{A}\T)^q\mat{A} has singular values σj2q+1\sigma_j^{2q+1} and, for any orthogonal projector P\mat{P}, ∥(I−P)A∥22q+1≤∥(I−P)Aq∥2\norm{(\mat{I} - \mat{P})\mat{A}}_2^{2q+1} \le \norm{(\mat{I} - \mat{P})\mat{A}_q}_2 (proposition 8.6 of the same paper), apply the spectral bound with σj2q+1\sigma_j^{2q+1} instead of σj\sigma_j and take the (2q+1)(2q+1)-th root. The effective ratio between tail and σk+1\sigma_{k+1} is raised to 2q+12q + 1: with q=2q = 2 a gap 0.90.9 between neighboring singular values becomes 0.95≈0.590.9^5 \approx 0.59.

In practice p=10p = 10 and qq between 1 and 3 nearly always suffice. scikit-learn defaults to p=10p = 10 and q=4q = 4 (or q=7q = 7 if k<0.1min⁡(m,n)k < 0.1\min(m, n)), normalizing between iterations with LU when q>2q > 2.

Learning by modes: deep linear networks

SVD is not only computational. It also describes how a network learns. The provable case is deep linear networks, f(x)=WL⋯W2W1xf(\vb{x}) = \mat{W}_L\cdots\mat{W}_2\mat{W}_1\vb{x}: without activations the represented function is linear, but loss is nonconvex in weights and training dynamics are surprisingly rich. Saxe, McClelland and Ganguli (2014) solved it exactly.

Take whitened inputs E[xx⊤]=I\E[\vb{x}\vb{x}\T] = \mat{I} and input–output correlation S=E[yx⊤]\mat{S} = \E[\vb{y}\vb{x}\T] with SVD S=∑αsαuαvα⊤\mat{S} = \sum_\alpha s_\alpha\vb{u}_\alpha\vb{v}_\alpha\T. Expanding the square, population squared loss is

L=12E∥y−WL⋯W1x∥2=12∥S−WL⋯W1∥F2+cte.\Loss = \tfrac12\E\norm{\vb{y} - \mat{W}_L\cdots\mat{W}_1\vb{x}}^2 = \tfrac12\norm{\mat{S} - \mat{W}_L\cdots\mat{W}_1}_F^2 + \text{cte}.

Gradient descent with small step η\eta is approximated by gradient flow W˙ℓ=−∂L/∂Wℓ\dot{\mat{W}}_\ell = -\partial\Loss/\partial\mat{W}_\ell with time t=η⋅(pasos)t = \eta\cdot(\text{pasos}). With linear-layer gradients, for two layers:

W˙1=W2⊤(S−W2W1),W˙2=(S−W2W1)W1⊤.\dot{\mat{W}}_1 = \mat{W}_2\T(\mat{S} - \mat{W}_2\mat{W}_1), \qquad \dot{\mat{W}}_2 = (\mat{S} - \mat{W}_2\mat{W}_1)\mat{W}_1\T.

The two equations couple all weights. The key is to seek solutions respecting the geometry of S\mat{S}.

Proof

Substitute ansatz W1=Rdiag⁡(a)V⊤\mat{W}_1 = \mat{R}\diag(a)\mat{V}\T, W2=Udiag⁡(a)R⊤\mat{W}_2 = \mat{U}\diag(a)\mat{R}\T into the flow. Since R⊤R=I\mat{R}\T\mat{R} = \mat{I}, W2W1=Udiag⁡(a2)V⊤\mat{W}_2\mat{W}_1 = \mat{U}\diag(a^2)\mat{V}\T and S−W2W1=Udiag⁡(s−a2)V⊤\mat{S} - \mat{W}_2\mat{W}_1 = \mat{U}\diag(s - a^2)\mat{V}\T. Then

W2⊤(S−W2W1)=Rdiag⁡(a(s−a2))V⊤,(S−W2W1)W1⊤=Udiag⁡(a(s−a2))R⊤.\mat{W}_2\T(\mat{S} - \mat{W}_2\mat{W}_1) = \mat{R}\diag\big(a(s - a^2)\big)\mat{V}\T, \qquad (\mat{S} - \mat{W}_2\mat{W}_1)\mat{W}_1\T = \mat{U}\diag\big(a(s - a^2)\big)\mat{R}\T.

Both derivatives exactly match the ansatz form with a˙α=aα(sα−aα2)\dot a_\alpha = a_\alpha(s_\alpha - a_\alpha^2), so the ODE solution in aαa_\alpha generates, via the ansatz, a matrix-flow solution; uniqueness for ODEs with locally Lipschitz field makes it the solution. For u=a2u = a^2: u˙=2aa˙=2u(s−u)\dot u = 2a\dot a = 2u(s - u), a logistic equation with the stated solution (check by differentiation). With LL layers, Wℓ=Rℓdiag⁡(a)Rℓ−1⊤\mat{W}_\ell = \mat{R}_\ell\diag(a)\mat{R}_{\ell-1}\T with R0=V\mat{R}_0 = \mat{V}, RL=U\mat{R}_L = \mat{U}; the same calculation gives a˙=aL−1(s−aL)\dot a = a^{L-1}(s - a^L) and, with u=aLu = a^L, u˙=La2L−2(s−u)=Lu2−2/L(s−u)\dot u = L a^{2L - 2}(s - u) = L u^{2 - 2/L}(s - u).

∎

The logistic equation says much. If uα(0)u_\alpha(0) is small, the mode spends a long time near zero (a plateau), then grows abruptly and saturates at sαs_\alpha. Time to halfway is

t1/2=12sαlog⁡(sαuα(0)−1)≈12sαlog⁡sαuα(0),t_{1/2} = \frac{1}{2s_\alpha}\log\Big(\frac{s_\alpha}{u_\alpha(0)} - 1\Big) \approx \frac{1}{2s_\alpha}\log\frac{s_\alpha}{u_\alpha(0)},

inversely proportional to sαs_\alpha. Strong modes are learned first and weak ones wait. This is singular-mode learning dynamics: a deep linear network with small initialization learns input–output modes one by one, in decreasing singular-value order, and loss decreases in steps with plateaus at 12∑β>αsβ2\tfrac12\sum_{\beta > \alpha}s_\beta^2. One layer behaves differently: W˙=S−W\dot{\mat{W}} = \mat{S} - \mat{W} is linear, each mode follows uα=sα+(uα(0)−sα)e−tu_\alpha = s_\alpha + (u_\alpha(0) - s_\alpha)e^{-t} and all advance with the same time constant. Depth changes dynamics even without adding expressive capacity.

InteractiveStepwise learning
Strength of each mode, uα(t)=uα⊤WL⋯W1vαu_\alpha(t) = \vb{u}_\alpha\T\mat{W}_L\cdots\mat{W}_1\vb{v}_\alpha
0123402468time tloss1572.50
WL⋯W1\mat{W}_L\cdots\mat{W}_1 now
target: diag(4, 3, 2, 1, 0, 0, 0, 0); blue positive, red negative
  • mode s1=4s_1 = 4
  • mode s2=3s_2 = 3
  • mode s3=2s_3 = 2
  • mode s4=1s_4 = 1
  • exact solution, aligned and balanced network
Depth
0.010
t = 8.3
Time t=η⋅stepst = \eta \cdot \text{steps}8.26
Loss 12∥S−WL⋯W1∥F2\tfrac12\|\mat{S} - \mat{W}_L\cdots\mat{W}_1\|_F^20.000
Modes learned (over 90%)4 of 4
t1/2t_{1/2} per mode1.50, 2.10, 2.60, 5.40
Norm outside target modes0.001
Small initialization: plateaus and steps. Each mode waits on the order of 1slog⁡su0\frac{1}{s}\log\frac{s}{u_0} (two layers) and is then learned abruptly, in order of sαs_\alpha.
A width-8 linear network trains by gradient descent toward S=diag⁡(4,3,2,1,0,0,0,0)\mat{S} = \diag(4, 3, 2, 1, 0, 0, 0, 0) from an unaligned Gaussian initialization with deviation g/8g/\sqrt{8}. Solid curves show each mode’s strength; dashed curves show the theorem’s exact solution for an aligned balanced network with uα(0)=gLu_\alpha(0) = g^L. Play training with two layers and g=0.01g = 0.01: the mode with s=4s = 4 is learned first and the one with s=1s = 1 waits; in the loss each step is a mode. Switch to one layer and enable “normalize by sαs_\alpha”: the curves nearly coincide. Return to two or three layers and increase gg toward 1: plateaus vanish. On the right, product WL⋯W1\mat{W}_L\cdots\mat{W}_1: watch diagonal entries light up one after another as the rest fade.

Three qualifications separate proof from observation:

  • Exact is the theorem with aligned balanced initialization. The figure shows that small random initialization with two layers closely resembles the prediction with order-one time offsets; with three layers plateaus and steps remain but times differ more from the aligned curve, and ordering among modes with similar sαs_\alpha can change depending on initialization projection onto each. Saxe et al. argue the approximation heuristically. Later rigorous results relax assumptions for two-layer networks with vanishing initialization, such as Gidel, Bach and Lacoste-Julien (2019) for discrete gradient descent, but do not cover arbitrary initialization or depth.
  • Large initialization. When gg is order 1, the initial product is already comparable to target, the network moves little relative to its size and modes advance in parallel. This is a linear relative of lazy training (Chizat, Oyallon and Bach, 2019), where a network behaves almost like its linearization around initialization.
  • Nonlinear networks. Stepwise learning and preference for low-effective-rank solutions are often observed with activations, and broad literature studies implicit low-rank bias in deep factorizations (e.g. Arora, Cohen, Hu and Luo, 2019). But extending Saxe’s theorem to a transformer is a hypothesis, not a result.

Another theorem detail matters later: with orthogonal balanced initialization, all product singular values begin equal and each mode’s dynamics depend only on its sαs_\alpha. Saxe et al. proposed orthogonal initialization from this analysis.

Low-rank gradients: from LoRA to GaLore

What does a layer gradient look like? For z=Wx\vb{z} = \mat{W}\vb{x} in a network and a batch of BB examples, the chain rule with the vector–Jacobian product gives

G=∂L∂W=∑i=1Bδixi⊤=Δ⊤X,δi=∂L∂zi.\mat{G} = \frac{\partial\Loss}{\partial\mat{W}} = \sum_{i=1}^{B}\vb{\delta}_i\vb{x}_i\T = \mat{\Delta}\T\mat{X}, \qquad \vb{\delta}_i = \frac{\partial\Loss}{\partial\vb{z}_i}.

The gradient is a sum of BB outer products, so rank⁡G≤min⁡(B,dout,din)\rank\mat{G} \le \min(B, d_{\text{out}}, d_{\text{in}}). In a transformer, BB counts tokens and usually exceeds dd, so the gradient is not literally low-rank. Empirically its spectrum decays quickly: a few directions contain most Frobenius norm, and its effective rank is small relative to dd. Two ways exploit this.

LoRA freezes W0\mat{W}_0 and trains only ΔW=αrBA\Delta\mat{W} = \frac{\alpha}{r}\mat{B}\mat{A}, with B=0\mat{B} = \mat{0} initially so the starting model is unchanged. For a matrix 4096×40964096\times4096 and r=8r = 8, 2⋅4096⋅8=65 5362\cdot 4096\cdot 8 = 65\,536 numbers are trained instead of 16.816.8 million. Prior empirical motivation is that pretrained-model fine-tuning has low intrinsic dimension: Aghajanyan, Zettlemoyer and Gupta (2020) find, for example, that tuning RoBERTa on MRPC by optimizing only 200 parameters projected to full space by a random linear map reaches 90 % of full-tuning performance. The restriction is strong: total weight change has rank rr forever.

GaLore does something else. It allows full-rank weight changes but compresses optimizer memory. For W∈Rm×n\mat{W} \in \R^{m\times n} with m≤nm \le n:

  1. Every TT steps, calculate the leading rr left singular vectors of the current gradient, P∈Rm×r\mat{P} \in \R^{m\times r}.
  2. Each step project R=P⊤G∈Rr×n\mat{R} = \mat{P}\T\mat{G} \in \R^{r\times n} and update Adam moments on R\mat{R}, obtaining direction N∈Rr×n\mat{N} \in \R^{r\times n}.
  3. Return the update to full space: ΔW=−η α PN\Delta\mat{W} = -\eta\,\alpha\,\mat{P}\mat{N}.

Adam moments occupy 2rn2rn numbers instead of 2mn2mn, a factor m/rm/r less, at the cost of storing P\mat{P} (mrmr numbers) and an SVD of G\mat{G} every TT steps (or the preceding randomized SVD). Since P\mat{P} changes over time, the sum of many updates can be full rank, unlike LoRA. Zhao et al. (2024) report up to 65.5 % reduction in optimizer-state memory while maintaining loss in pretraining 1B and 7B LLaMA models, and pretraining a 7B model on a 24 GB consumer GPU by combining an 8-bit optimizer. Their theoretical analysis proves gradient low-rankness during training for a restricted network class (reversible, with certain losses), excluding transformers: for those evidence is empirical.

Steepest descent by norm

Gradient descent is usually presented as “move in direction −∇L-\grad\Loss”. But steepest descent depends on how step size is measured. If the budget is Euclidean length η\eta, the best direction is −G/∥G∥F-\mat{G}/\norm{\mat{G}}_F. Another norm changes the answer.

If step size is penalized as well as budgeted, minimizing model ⟨G,ΔW⟩+λ2∥ΔW∥2\inner{\mat{G}}{\Delta\mat{W}} + \tfrac{\lambda}{2}\norm{\Delta\mat{W}}^2 yields ΔW=−∥G∥†λD⋆\Delta\mat{W} = -\frac{\norm{\mat{G}}_\dagger}{\lambda}\mat{D}^\star: write ΔW=−cD\Delta\mat{W} = -c\mat{D} with ∥D∥=1\norm{\mat{D}} = 1, maximize first in D\mat{D} then minimize −c∥G∥†+λc2/2-c\norm{\mat{G}}_\dagger + \lambda c^2/2 in c≥0c \ge 0. Bernstein and Newhouse (2024) show that several known optimizers with moving averages disabled are exactly this for different norms: Euclidean gives gradient descent; maximum-entry norm gives sign descent −sign⁡(G)-\operatorname{sign}(\mat{G}), Adam without moving averages; and spectral norm gives Shampoo without accumulation. Spectral norm is our focus.

This is spectral-norm steepest descent. You will prove it in the first guided exercise using SVD and unit-vector inequality ∣u⊤Dv∣≤∥D∥2\abs{\vb{u}\T\mat{D}\vb{v}} \le \norm{\mat{D}}_2. The point is what it says: UV⊤\mat{U}\mat{V}\T preserves singular directions of G\mat{G} but sets every singular value to 1. If the gradient has σ1=10\sigma_1 = 10 and σ50=0.01\sigma_{50} = 0.01, Euclidean descent moves direction 50 a thousand times less than the first; spectral descent moves them equally. Whether that helps training is a hypothesis (weak gradient directions are no longer overwhelmed by dominant ones), not a theorem consequence.

InteractiveSteepest descent by norm
Plane of singular values (d1,d2)(d_1, d_2) of D\mat{D}
Image of the unit circle under each D\mat{D}
  • gradient (σ1,σ2)(\sigma_1, \sigma_2)
  • Frobenius: disk, G/∥G∥F\mat{G}/\|\mat{G}\|_F
  • spectral: square, UV⊤\mat{U}\mat{V}\T
  • nuclear: diamond, u1v1⊤\vb{u}_1\vb{v}_1\T
Singular values of G\mat{G}1.35, 0.50
Frobenius: max⁡⟨G,D⟩=∥G∥F\max\langle\mat{G},\mat{D}\rangle = \|\mat{G}\|_F1.440
Spectral: max⁡⟨G,D⟩=∥G∥∗\max\langle\mat{G},\mat{D}\rangle = \|\mat{G}\|_*1.850
Nuclear: max⁡⟨G,D⟩=∥G∥2\max\langle\mat{G},\mat{D}\rangle = \|\mat{G}\|_21.350
Ratio d2/d1d_2/d_1: Frobenius, spectral, nuclear0.37, 1.00, 0.00
By von Neumann’s trace inequality, the maximizer shares singular vectors with G\mat{G}, and the problem reduces to the singular-value plane (d1,d2)(d_1, d_2) of D\mathbf{D}, where ⟨G,D⟩=σ1d1+σ2d2\inner{\mat{G}}{\mat{D}} = \sigma_1d_1 + \sigma_2d_2. The unit Frobenius, spectral and nuclear balls are disk, square and diamond; each norm chooses its ball’s furthest point in the direction of G\mat{G} (dashed lines show maximum level). Drag G\mat{G} toward the horizontal axis: Frobenius nearly ignores the second direction, while spectral stays at corner (1,1)(1, 1). Move it to diagonal σ1=σ2\sigma_1 = \sigma_2, where the nuclear maximizer ceases to be unique. Enable the Schatten ball pp and move pp from 1 to 12: the maximizer travels from diamond vertex to square corner. At right, how each direction transforms the unit circle: UV⊤\mat{U}\mat{V}\T maps it to itself, rotated.

The figure shows the general structure. In singular-value space Schatten norms are ℓp\ell^p norms and the problem reduces to vectors: Frobenius (p=2p = 2) gives d∝σ\vb{d} \propto \vb{\sigma}; spectral (p=∞p = \infty), d=(1,…,1)\vb{d} = (1, \dots, 1); nuclear (p=1p = 1), d=e1\vb{d} = \vb{e}_1. Readouts confirm attained value is the dual norm: Frobenius is self-dual, spectral and nuclear are mutually dual.

Why spectral norm for network layers? It directly controls layer-output change: ∥ΔWx∥2≤∥ΔW∥2∥x∥2\norm{\Delta\mat{W}\vb{x}}_2 \le \norm{\Delta\mat{W}}_2\norm{\vb{x}}_2 for every input. If activations have typical size ∥x∥2≈din\norm{\vb{x}}_2 \approx \sqrt{d_{\text{in}}} (order-one inputs), the natural norm is the operator norm between RMS norms, ∥W∥RMS→RMS=din/dout ∥W∥2\norm{\mat{W}}_{\text{RMS}\to\text{RMS}} = \sqrt{d_{\text{in}}/d_{\text{out}}}\,\norm{\mat{W}}_2, and steepest descent under it is −dout/din UV⊤-\sqrt{d_{\text{out}}/d_{\text{in}}}\,\mat{U}\mat{V}\T. Original Muon implementation uses that shape factor clipped below, max⁡(1,dout/din)\sqrt{\max(1, d_{\text{out}}/d_{\text{in}})}.

Orthogonalizing without SVD: Newton–Schulz iteration

Computing UV⊤\mat{U}\mat{V}\T by SVD at every step for every matrix is expensive and on GPU is also sequential, unable to exploit matrix-multiplication units. The alternative is a classical numerical-analysis idea: approximate the polar factor by an iteration using only matrix multiplication.

Proof

XX⊤X=UΣV⊤VΣU⊤UΣV⊤=UΣ3V⊤\mat{X}\mat{X}\T\mat{X} = \mat{U}\mat{\Sigma}\mat{V}\T\mat{V}\mat{\Sigma}\mat{U}\T\mat{U}\mat{\Sigma}\mat{V}\T = \mat{U}\mat{\Sigma}^3\mat{V}\T because V⊤V=U⊤U=Ir\mat{V}\T\mat{V} = \mat{U}\T\mat{U} = \mat{I}_r. Similarly (XX⊤)2X=UΣ5V⊤(\mat{X}\mat{X}\T)^2\mat{X} = \mat{U}\mat{\Sigma}^5\mat{V}\T. Summing with coefficients gives U(aΣ+bΣ3+cΣ5)V⊤\mat{U}(a\mat{\Sigma} + b\mat{\Sigma}^3 + c\mat{\Sigma}^5)\mat{V}\T.

∎

This is a matrix function applied to singular values rather than eigenvalues, and works only for odd polynomials (an even term such as XX⊤\mat{X}\mat{X}\T would change matrix shape). If an iterated odd polynomial sends every σ∈(0,1]\sigma \in (0, 1] toward 1, iteration Xk+1=p(Xk)\mat{X}_{k+1} = p(\mat{X}_k) converges to UV⊤\mat{U}\mat{V}\T without calculating U\mat{U} or V\mat{V}.

The name combines two ideas. Newton iteration for the polar factor is Xk+1=12(Xk+Xk−T)\mat{X}_{k+1} = \tfrac12(\mat{X}_k + \mat{X}_k^{-\mathsf{T}}), requiring inversion; Schulz approximates the inverse with Taylor expansion (X⊤X)−1≈2I−X⊤X(\mat{X}\T\mat{X})\inv \approx 2\mat{I} - \mat{X}\T\mat{X} when X⊤X≈I\mat{X}\T\mat{X} \approx \mat{I}. Substitution gives 12(X+X(2I−X⊤X))=32X−12XX⊤X\tfrac12\big(\mat{X} + \mat{X}(2\mat{I} - \mat{X}\T\mat{X})\big) = \tfrac32\mat{X} - \tfrac12\mat{X}\mat{X}\T\mat{X}. Björck and Bowie (1971) studied it for the nearest orthogonal matrix, precisely the polar factor.

Three properties of p(σ)=32σ−12σ3p(\sigma) = \tfrac32\sigma - \tfrac12\sigma^3 determine everything:

  • Quadratic convergence near 1. p(1+e)=1−32e2−12e3p(1 + e) = 1 - \tfrac32e^2 - \tfrac12e^3: error is squared each step because p′(1)=0p'(1) = 0.
  • Slow growth near 0. p(σ)≈1.5σp(\sigma) \approx 1.5\sigma: a small singular value is multiplied only by 1.51.5 per step. From σ=10−3\sigma = 10^{-3}, 16 iterations merely exceed 0.50.5 and 20 come within 10−310^{-3} of 1.
  • A limited basin. p(3)=0p(\sqrt3) = 0 and pp is positive on (0,3)(0, \sqrt3). If σ∈(3,5)\sigma \in (\sqrt3, \sqrt5), p(σ)p(\sigma) is negative and iteration can converge to −1-1 in that direction; if σ>5\sigma > \sqrt5, ∣p(σ)∣>σ\abs{p(\sigma)} > \sigma and it diverges. Frobenius normalization guarantees σ1≤∥G∥F/∥G∥F=1\sigma_1 \le \norm{\mat{G}}_F/\norm{\mat{G}}_F = 1 because ∥⋅∥2≤∥⋅∥F\norm{\cdot}_2 \le \norm{\cdot}_F.
InteractiveSending all singular values to 1
p(σ)p(\sigma) and the cobweb for a test σ\sigma
σ\sigma test: 0.060→1.00000.060 \to 1.0000 after k=12k = 12 iterations
The ten σi\sigma_i of Xk\mat{X}_k (log scale)
1e−31e−21e−11024681012iteration k
  • p(σ)p(\sigma)
  • diagonal p(σ)=σp(\sigma) = \sigma
  • basin boundary
  • test σ\sigma cobweb
  • σi\sigma_i: largest (blue) to smallest (orange); hollow if negative
Polynomial
1.00
k = 12
Iteration kk12
σmin⁡\sigma_{\min} and σmax⁡\sigma_{\max} of Xk\mat{X}_k0.217, 1.000
max⁡i∣σi−1∣=∥Xk−UV⊤∥2\max_i |\sigma_i - 1| = \|\mat{X}_k - \mat{U}\mat{V}\T\|_20.783
p′(0)=ap'(0) = a: growth of small σ\sigma× 1.500
Useful basin boundary1.732
Matrix products so far24
At left, polynomial p(σ)p(\sigma) with the diagonal, horizontal line at 1 (target), useful basin edge, and staircase for a test σ\sigma draggable along the axis: each stair is an iteration. At right are ten singular values of a typical gradient (ratio 0.50.5 between neighbors) across iterations on a logarithmic scale. With the cubic, large values reach 1 in few iterations and small ones rise slowly, at rate 1.51.5 per step. Switch to Muon’s quintic: small values shoot up (p′(0)=3.4p'(0) = 3.4), but none settles at 1. Disable normalization and increase scale above 3\sqrt3, or design your own polynomial with “Custom”: can you get a large slope at 0 without leaving the basin?

Muon’s quintic

An optimizer does not need exact UV⊤\mat{U}\mat{V}\T; it needs something close in few iterations and low precision (bf16). Keller Jordan empirically chose quintic polynomial

p(σ)=3.4445 σ−4.7750 σ3+2.0315 σ5,p(\sigma) = 3.4445\,\sigma - 4.7750\,\sigma^3 + 2.0315\,\sigma^5,

with slope 3.44453.4445 at the origin so small singular values grow rapidly. The price is that iteration does not converge: its positive fixed points are 0.8680.868 and 1.2641.264, both unstable, and singular values eventually oscillate in a band. Computing with the polynomial, five iterations move any σ∈[10−3,1]\sigma \in [10^{-3}, 1] into interval [0.47,1.20][0.47, 1.20], one more leaves them in [0.68,1.20][0.68, 1.20], and pp maps that interval into itself: they do not escape, but do not stay still. The result is US′V⊤\mat{U}\mat{S}'\mat{V}\T with diagonal S′\mat{S}' near identity, empirically just as effective as an update direction. That last claim is empirical, not a theorem. Its basin also ends at 1.2641.264, closer to 1 than the cubic’s: prior normalization is even more necessary.

With all this, Muon (MomentUm Orthogonalized by Newton–Schulz) for hidden matrix W∈Rdout×din\mat{W} \in \R^{d_{\text{out}}\times d_{\text{in}}} is:

Mt=μMt−1+Gt,Ot=NS⁡5(Gt+μMt),Wt+1=Wt−ηmax⁡(1,dout/din)  Ot,\mat{M}_t = \mu\mat{M}_{t-1} + \mat{G}_t, \qquad \mat{O}_t = \operatorname{NS}_5\big(\mat{G}_t + \mu\mat{M}_t\big), \qquad \mat{W}_{t+1} = \mat{W}_t - \eta\sqrt{\max(1, d_{\text{out}}/d_{\text{in}})}\;\mat{O}_t,

with Nesterov momentum μ=0.95\mu = 0.95 and five quintic bf16 steps. It applies only to hidden-layer 2D matrices; embeddings, output head and vector parameters (biases, normalization gains) remain on AdamW. Liu et al. (2025) identified two adjustments to scale it to large language models: adding weight decay and scaling the update by 0.2max⁡(dout,din)0.2\sqrt{\max(d_{\text{out}}, d_{\text{in}})} to match typical AdamW update magnitude. From scaling-law experiments they report Muon reaches the same loss as AdamW with about half the compute.

Orthogonality at initialization and in parameterization

Saxe’s theorem suggests starting the layer product with equal singular values. With Gaussian matrices of variance 1/n1/n each layer preserves vector norm on average, but singular values follow Marchenko–Pastur between 00 and 22, and dispersion multiplies across a product of LL layers: the ratio of largest to smallest singular value grows exponentially with LL (measured below: with L=40L = 40 layers of 64×6464\times 64 it exceeds 101710^{17}). With orthogonal matrices the product is orthogonal and all singular values equal 1 exactly at any depth. Having all input–output Jacobian singular values near 1 is dynamical isometry; Pennington, Schoenholz and Ganguli (2017) studied it in nonlinear networks. In PyTorch it is torch.nn.init.orthogonal_.

Sometimes a matrix must remain orthogonal throughout training, for example in recurrent networks to avoid exploding or vanishing gradients, or normalizing flows to make the determinant ±1\pm 1. Direct optimization over orthogonal matrices needs manifold methods; an alternative is to parameterize: write Q=ϕ(A)\mat{Q} = \phi(\mat{A}) with free A\mat{A} and ϕ\phi mapping to orthogonal matrices. Two classical constructions start with antisymmetric A⊤=−A\mat{A}\T = -\mat{A}:

  • Exponential. Q=eA\mat{Q} = e^{\mat{A}} with the matrix exponential. Since A\mat{A} and A⊤=−A\mat{A}\T = -\mat{A} commute, Q⊤Q=eA⊤eA=e−A+A=I\mat{Q}\T\mat{Q} = e^{\mat{A}\T}e^{\mat{A}} = e^{-\mat{A} + \mat{A}} = \mat{I} and det⁡Q=etr⁡A=1\det\mat{Q} = e^{\tr\mat{A}} = 1. It covers all rotations.
  • Cayley. Q=(I−A)(I+A)−1\mat{Q} = (\mat{I} - \mat{A})(\mat{I} + \mat{A})\inv. Eigenvalues of A\mat{A} are purely imaginary, so I+A\mat{I} + \mat{A} is invertible; since I−A\mat{I} - \mat{A} and (I+A)−1(\mat{I} + \mat{A})\inv commute, Q⊤Q=(I−A)−1(I+A)(I−A)(I+A)−1=I\mat{Q}\T\mat{Q} = (\mat{I} - \mat{A})\inv(\mat{I} + \mat{A})(\mat{I} - \mat{A})(\mat{I} + \mat{A})\inv = \mat{I}. It is cheaper (one linear solve), but cannot reach orthogonal matrices with eigenvalue −1-1.

torch.nn.utils.parametrizations.orthogonal implements both (and a third using Householder reflections), letting the optimizer work on A\mat{A}.

Implementation from scratch

First randomized SVD. To construct dense matrices with known spectrum without QR of n×nn\times n, mix diag⁡(s)\diag(\vb{s}) with a few Householder reflections on each side: the result is Udiag⁡(s)V⊤\mat{U}\diag(\vb{s})\mat{V}\T with orthogonal U\mat{U} and V\mat{V}, and exact σj\sigma_j is known. Residual spectral norm is estimated by the power method, much cheaper than SVD of 1000×5001000\times500.

[ ]Randomized SVD from scratchBrowser
import numpy as np
import time

def householder_mix(M, n_refl, rng, lado):
    """Aplica n_refl reflexiones de Householder aleatorias por la izquierda (lado=0) o por la derecha (lado=1)."""
    M = M.copy()
    for _ in range(n_refl):
        v = rng.standard_normal(M.shape[lado])
        v /= np.linalg.norm(v)
        if lado == 0:
            M -= 2.0 * np.outer(v, v @ M)
        else:
            M -= 2.0 * np.outer(M @ v, v)
    return M

def matriz_con_espectro(m, n, s, rng):
    """A = U diag(s) V^T densa, con U y V ortogonales (productos de reflexiones) y valores singulares s."""
    A = np.zeros((m, n))
    A[np.arange(n), np.arange(n)] = s
    return householder_mix(householder_mix(A, 4, rng, 0), 4, rng, 1)

def buscador_de_rango(A, l, q, rng):
    """Base ortonormal Q (m x l) del rango aproximado de A, con q iteraciones de potencia reortogonalizadas."""
    Omega = rng.standard_normal((A.shape[1], l))
    Q, _ = np.linalg.qr(A @ Omega)
    for _ in range(q):
        Z, _ = np.linalg.qr(A.T @ Q)      # reortogonalizar tras cada producto: sin esto,
        Q, _ = np.linalg.qr(A @ Z)        # los modos pequeños se pierden en el redondeo
    return Q

def svd_aleatorizada(A, k, p=10, q=1, rng=None):
    rng = np.random.default_rng() if rng is None else rng
    Q = buscador_de_rango(A, k + p, q, rng)
    B = Q.T @ A                            # (k + p) x n: pequeña
    Ub, s, Vt = np.linalg.svd(B, full_matrices=False)
    return (Q @ Ub)[:, :k], s[:k], Vt[:k]

def norma2(E, iters=60, seed=0):
    """Estimación de ||E||_2 por iteración de la potencia sobre E^T E (cota inferior que converge deprisa)."""
    x = np.random.default_rng(seed).standard_normal(E.shape[1])
    for _ in range(iters):
        x = E.T @ (E @ x)
        x /= np.linalg.norm(x)
    return np.linalg.norm(E @ x)

m, n, k = 1000, 500, 20
j = np.arange(1, n + 1)
espectros = {"rápido": np.exp(-(j - 1) / 8), "lento": 1 / np.sqrt(j)}
rng = np.random.default_rng(0)
mats = {nombre: matriz_con_espectro(m, n, s, rng) for nombre, s in espectros.items()}

print(f"{'espectro':8s} {'p':>3s} {'q':>2s}   ||A - A_k|| / sigma_k+1   err. rel. sigma_1   err. rel. sigma_k")
for nombre, s in espectros.items():
    A = mats[nombre]
    for p, q in [(0, 0), (10, 0), (10, 1), (10, 2)]:
        U, sk, Vt = svd_aleatorizada(A, k, p, q, np.random.default_rng(1))
        e = norma2(A - (U * sk) @ Vt)
        print(f"{nombre:8s} {p:3d} {q:2d}   {e / s[k]:22.3f}   {abs(sk[0] - s[0]) / s[0]:17.2e}   {abs(sk[-1] - s[k-1]) / s[k-1]:17.2e}")

The table reproduces the figure. With fast spectrum, p=10p = 10 and one power iteration already reach the Eckart–Young optimum to three digits. With slow spectrum, without powers error is over twice optimum even with p=10p = 10, and estimated σ~1\tilde\sigma_1 errs by 8 %: the heavy tail contaminates even the first direction. With q=2q = 2 error falls to 1.004 σk+11.004\,\sigma_{k+1}. σ~k\tilde\sigma_k is always least accurately estimated: it competes with the tail.

[ ]How much is gained over full SVD?Browser
A = mats["lento"]
t0 = time.perf_counter(); U_, s_, Vt_ = np.linalg.svd(A, full_matrices=False); t_svd = time.perf_counter() - t0
t0 = time.perf_counter(); svd_aleatorizada(A, k, 10, 2, np.random.default_rng(2)); t_rsvd = time.perf_counter() - t0
print(f"SVD completa: {t_svd:.2f} s    SVD aleatorizada (k=20, p=10, q=2): {t_rsvd:.3f} s    cociente: {t_svd / t_rsvd:.0f}x")
print("¿coinciden los valores singulares exactos con los construidos?", np.allclose(s_, espectros["lento"]))

In the browser randomized SVD is about six times faster on this 1000×5001000\times500 matrix (somewhat more with native NumPy), and the advantage grows with size: full SVD cost scales as mn2mn^2 and randomized as mnℓmn\ell. On the machine used to write this lesson, with 2000×10002000\times1000, full SVD took 1.5 s and randomized 0.05 s.

Now Newton–Schulz. Construct an 64×12864\times128 “gradient” with singular values from 1 to 10−310^{-3} on a logarithmic scale, apply both iterations and measure distance of Xk\mat{X}_k from the polar factor.

[ ]Newton–Schulz versus the polar factorBrowser
import numpy as np
import time

def newton_schulz(G, pasos, coef=(1.5, -0.5, 0.0), normalizar=True):
    """X <- aX + b(XX^T)X + c(XX^T)^2 X. Devuelve la lista de iterados X_0, ..., X_pasos."""
    a, b, c = coef
    X = G / np.linalg.norm(G) if normalizar else G.copy()   # ||G||_F >= ||G||_2: todos los sigma <= 1
    traspuesta = X.shape[0] > X.shape[1]
    if traspuesta:                       # trabajar con la cara corta: XX^T es min(m, n) x min(m, n)
        X = X.T
    iterados = [X]
    for _ in range(pasos):
        S = X @ X.T
        P = b * S + c * (S @ S) if c else b * S
        X = a * X + P @ X
        iterados.append(X)
    return [Y.T for Y in iterados] if traspuesta else iterados

rng = np.random.default_rng(0)
m, n = 64, 128
U, _ = np.linalg.qr(rng.standard_normal((m, m)))
V, _ = np.linalg.qr(rng.standard_normal((n, m)))
s = np.logspace(0, -3, m)                          # de 1 a 1e-3, como un gradiente con cola larga
G = (U * s) @ V.T
polar = U @ V.T                                     # el objetivo: el factor polar U V^T

MUON = (3.4445, -4.7750, 2.0315)
for nombre, coef in [("cúbica", (1.5, -0.5, 0.0)), ("quíntica de Muon", MUON)]:
    its = newton_schulz(G, 12, coef)
    print(nombre)
    for k in [0, 1, 2, 4, 6, 8, 12]:
        sv = np.linalg.svd(its[k], compute_uv=False)
        # X_k = U p(Σ) V^T, así que ||X_k - UV^T||_2 = max |σ_i - 1| (lo comprobamos en la celda siguiente)
        print(f"  k = {k:2d}   sigma en [{sv.min():.4f}, {sv.max():.4f}]   ||X_k - UV^T||_2 = {np.max(np.abs(sv - 1)):.3f}")

Two facts stand out. Frobenius normalization, which guarantees the basin, shrinks the whole spectrum: σ1\sigma_1 starts at 0.440.44, not 1, and σmin⁡\sigma_{\min} at 4⋅10−44\cdot10^{-4}. With cubic, after 12 iterations the smallest singular value only reaches 0.060.06. Quintic moves it into band [0.68,1.20][0.68, 1.20] in six iterations and it remains there: polar-factor distance plateaus at 0.3180.318, namely 1−0.6821 - 0.682, the lower band edge. Neither reaches UV⊤\mat{U}\mat{V}\T in few steps with such a broad spectrum; quintic instead gives a matrix with all singular values order 1, what the optimizer needs.

[ ]Checks and costBrowser
# ¿actúa de verdad sobre cada valor singular por separado? Comparar con el polinomio aplicado a s
p3 = lambda x: 1.5 * x - 0.5 * x**3
s_pred = s / np.linalg.norm(G)
for _ in range(5):
    s_pred = p3(s_pred)
s_med = np.linalg.svd(newton_schulz(G, 5)[5], compute_uv=False)
print("máx |sigma medido - p^5(sigma)|:", np.max(np.abs(np.sort(s_med) - np.sort(s_pred))))
print("||X_5 - UV^T||_2 directa:", np.linalg.norm(newton_schulz(G, 5)[5] - polar, 2), "  max|sigma - 1|:", np.max(np.abs(s_med - 1)))

# coste: productos de matrices frente a una SVD, en este Python (CPU, sin BLAS en el navegador)
X = rng.standard_normal((256, 512))
t0 = time.perf_counter(); newton_schulz(X, 5, MUON); t_ns = time.perf_counter() - t0
t0 = time.perf_counter(); Ux, sx, Vtx = np.linalg.svd(X, full_matrices=False); t_svd = time.perf_counter() - t0
mm, nn = X.shape
print(f"5 pasos quínticos: {t_ns:.3f} s, unos {5 * (4 * mm * mm * nn + 2 * mm**3) / 1e9:.2f} GFLOP")
print(f"SVD reducida:      {t_svd:.3f} s")

The first check confirms the theorem up to rounding (10−1510^{-15}). The second teaches honesty: in the browser, without BLAS, SVD wins. Five quintic steps on an 256×512256\times512 matrix cost about 0.840.84 GFLOP and take roughly three times as long as reduced SVD, which does a similar operation count; with native CPU NumPy the times are comparable. Newton–Schulz’s advantage is operation type, not count: dense matrix products execute in bf16 near GPU peak and batch together, versus sequential SVD requiring fp32 or fp64. The next section measures this on GPU.

Finally, layer products and orthogonal parameterizations.

[ ]Stacked layers and orthogonal parameterizationsBrowser
import numpy as np
from scipy.linalg import expm

rng = np.random.default_rng(0)
n, L = 64, 40

def espectro_del_producto(fabrica):
    P = np.eye(n)
    for _ in range(L):
        P = fabrica() @ P
    s = np.linalg.svd(P, compute_uv=False)
    return s.max(), s.min()

gauss = lambda: rng.standard_normal((n, n)) / np.sqrt(n)        # varianza 1/n: escala "correcta" en media
orto = lambda: np.linalg.qr(rng.standard_normal((n, n)))[0]       # Q de una QR gaussiana
for nombre, f in [("gaussiana 1/sqrt(n)", gauss), ("ortogonal", orto)]:
    smax, smin = espectro_del_producto(f)
    print(f"{nombre:20s}  producto de {L} capas: sigma_max = {smax:.3g}, sigma_min = {smin:.3g}, cociente = {smax / smin:.3g}")

# parametrizaciones ortogonales: Cayley y exponencial de una antisimétrica
M = rng.standard_normal((5, 5))
A = (M - M.T) / 2                                   # antisimétrica: A^T = -A
I = np.eye(5)
Q_cay = (I - A) @ np.linalg.inv(I + A)
Q_exp = expm(A)
for nombre, Q in [("Cayley", Q_cay), ("exponencial", Q_exp)]:
    print(f"{nombre:12s} ||Q^T Q - I|| = {np.linalg.norm(Q.T @ Q - I):.1e}   det = {np.linalg.det(Q):+.6f}")

The product of 40 Gaussian layers has an extreme singular-value ratio of order 101810^{18}: numerically it is rank deficient, as is a gradient passing through. The orthogonal product’s ratio is exactly 1.

The library version

Randomized SVD is in scikit-learn (sklearn.utils.extmath.randomized_svd) and PyTorch (torch.svd_lowrank, also accepting sparse matrices). scikit-learn normalizes power iterations with LU (cheaper than QR and sufficient to avoid overflow); its documentation recommends increasing oversampling before iterations, adding that 0 or 1 iterations suffice if component count reaches effective rank and the spectrum does not decay slowly. This is what you measured: oversampling pays for fast spectra and powers for slow ones.

from sklearn.utils.extmath import randomized_svd
import torch

A = mats["lento"]   # la matriz de 1000 x 500 de espectro lento de la primera celda

# scikit-learn: n_oversamples es p y n_iter es q
U, s, Vt = randomized_svd(A, n_components=20, n_oversamples=10, n_iter=2, random_state=0)

# PyTorch: q es el número de columnas del sketch (k + p) y niter las iteraciones de potencia
U, s, V = torch.svd_lowrank(torch.as_tensor(A), q=30, niter=2)   # devuelve V, no V^T

On the previous slow-spectrum matrix, scikit-learn randomized_svd gives error 2.03 σk+12.03\,\sigma_{k+1} with n_iter=0 and 1.02 σk+11.02\,\sigma_{k+1} with n_iter=2, consistent with our implementation. Importing scikit-learn in the browser takes seconds, so this block does not execute here; try local Python.

For Muon and GaLore the lab runs on GPU. A character MiniGPT (4 blocks, dmodel=128d_{\text{model}} = 128, context 128) trains on source code from Python standard-library modules, present in any installation. This is the usual training loop, with correspondence between hand-written operations and PyTorch.

[ ]A character MiniGPTLocal GPU
import math, time, inspect
import json.decoder, json.encoder, collections, argparse, textwrap, statistics, fractions, dataclasses
import torch
import torch.nn as nn
import torch.nn.functional as F

dev = "cuda" if torch.cuda.is_available() else "cpu"
# corpus: código fuente de la biblioteca estándar (está en cualquier instalación de Python)
modulos = [json.decoder, json.encoder, collections, argparse, textwrap, statistics, fractions, dataclasses]
texto = "".join(inspect.getsource(m) for m in modulos)
vocab = sorted(set(texto))
stoi = {c: i for i, c in enumerate(vocab)}
datos = torch.tensor([stoi[c] for c in texto], dtype=torch.long)
corte = int(0.9 * len(datos))
train, val = datos[:corte].to(dev), datos[corte:].to(dev)
print(f"{len(texto)} caracteres, vocabulario {len(vocab)}, dispositivo {dev}")

T, B, D, CAPAS, CABEZAS = 128, 32, 128, 4, 4

class Bloque(nn.Module):
    def __init__(self):
        super().__init__()
        self.ln1, self.ln2 = nn.LayerNorm(D), nn.LayerNorm(D)
        self.qkv = nn.Linear(D, 3 * D, bias=False)
        self.proj = nn.Linear(D, D, bias=False)
        self.fc = nn.Linear(D, 4 * D, bias=False)
        self.fc2 = nn.Linear(4 * D, D, bias=False)

    def forward(self, x):
        q, k, v = self.qkv(self.ln1(x)).split(D, dim=-1)
        sep = lambda t: t.view(x.shape[0], x.shape[1], CABEZAS, D // CABEZAS).transpose(1, 2)
        a = F.scaled_dot_product_attention(sep(q), sep(k), sep(v), is_causal=True)
        x = x + self.proj(a.transpose(1, 2).reshape(x.shape))
        return x + self.fc2(F.gelu(self.fc(self.ln2(x))))

class MiniGPT(nn.Module):
    def __init__(self):
        super().__init__()
        self.emb = nn.Embedding(len(vocab), D)
        self.pos = nn.Parameter(0.02 * torch.randn(T, D))
        self.bloques = nn.ModuleList([Bloque() for _ in range(CAPAS)])
        self.ln = nn.LayerNorm(D)
        self.cabeza = nn.Linear(D, len(vocab), bias=False)

    def forward(self, idx):
        x = self.emb(idx) + self.pos[: idx.shape[1]]
        for b in self.bloques:
            x = b(x)
        return self.cabeza(self.ln(x))

def lote(fuente, gen):
    i = torch.randint(len(fuente) - T - 1, (B,), generator=gen).to(dev)
    off = torch.arange(T, device=dev)
    return fuente[i[:, None] + off], fuente[i[:, None] + off + 1]

@torch.no_grad()
def perdida_val(modelo, n=20):
    gen = torch.Generator().manual_seed(123)
    tot = 0.0
    for _ in range(n):
        x, y = lote(val, gen)
        tot += F.cross_entropy(modelo(x).flatten(0, 1), y.flatten()).item()
    return tot / n
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.

All three optimizers share model, seed, data and step count. Muon and GaLore apply only to block matrices; remaining parameters use AdamW. Our GaLore always projects on the left for simplicity (the original chooses the short side) and resets moments on subspace change. Finally torch.optim.Muon, PyTorch’s official implementation, is added with our configuration.

[ ]AdamW, Muon and GaLore in miniatureLocal GPU
def ns5(G, pasos=5, eps=1e-7):
    """Iteración quíntica de Newton-Schulz de Muon, en bf16 si hay GPU."""
    a, b, c = 3.4445, -4.7750, 2.0315
    X = G.to(torch.bfloat16 if G.is_cuda else torch.float32)
    X = X / (X.norm() + eps)
    alta = X.shape[0] > X.shape[1]
    if alta:
        X = X.T
    for _ in range(pasos):
        S = X @ X.T
        X = a * X + (b * S + c * S @ S) @ X
    return (X.T if alta else X).to(G.dtype)

class Muon(torch.optim.Optimizer):
    """Momento de Nesterov y ortogonalización: W <- W - lr * escala * NS5(M)."""
    def __init__(self, params, lr=0.02, momento=0.95):
        super().__init__(params, dict(lr=lr, momento=momento))

    @torch.no_grad()
    def step(self):
        for g in self.param_groups:
            for p in g["params"]:
                st = self.state[p]
                if "M" not in st:
                    st["M"] = torch.zeros_like(p)
                M = st["M"].mul_(g["momento"]).add_(p.grad)
                O = ns5(p.grad + g["momento"] * M)                  # variante de Nesterov
                escala = max(1.0, p.shape[0] / p.shape[1]) ** 0.5   # misma RMS de actualización para toda forma
                p.add_(O, alpha=-g["lr"] * escala)
                st["ultima"] = O

class GaLoreAdam(torch.optim.Optimizer):
    """Adam sobre R = PᵀG, con P los r primeros vectores singulares izquierdos de G (renovado cada `cada` pasos)."""
    def __init__(self, params, lr=1e-2, rango=32, cada=100, alfa=0.25, betas=(0.9, 0.999), eps=1e-8):
        super().__init__(params, dict(lr=lr, rango=rango, cada=cada, alfa=alfa, betas=betas, eps=eps))

    @torch.no_grad()
    def step(self):
        for g in self.param_groups:
            b1, b2 = g["betas"]
            for p in g["params"]:
                st = self.state[p]
                G = p.grad
                if "t" not in st:
                    st["t"] = 0
                if st["t"] % g["cada"] == 0:               # nuevo subespacio: SVD del gradiente actual
                    U, _, _ = torch.linalg.svd(G.float(), full_matrices=False)
                    st["P"] = U[:, : g["rango"]].to(G.dtype)
                    st["m"] = torch.zeros(g["rango"], G.shape[1], device=G.device)
                    st["v"] = torch.zeros_like(st["m"])
                st["t"] += 1
                R = st["P"].T @ G                           # r x n: aquí vive el estado del optimizador
                st["m"].mul_(b1).add_(R, alpha=1 - b1)
                st["v"].mul_(b2).addcmul_(R, R, value=1 - b2)
                t = (st["t"] - 1) % g["cada"] + 1            # corrección de sesgo desde el último reinicio
                N = (st["m"] / (1 - b1**t)) / ((st["v"] / (1 - b2**t)).sqrt() + g["eps"])
                upd = g["alfa"] * (st["P"] @ N)             # de vuelta al espacio completo
                p.add_(upd, alpha=-g["lr"])
                st["ultima"] = upd

def entrenar(metodo, pasos=600, semilla=0):
    torch.manual_seed(semilla)
    modelo = MiniGPT().to(dev)
    es_oculta = lambda n, p: p.ndim == 2 and "bloques" in n
    ocultas = [p for n, p in modelo.named_parameters() if es_oculta(n, p)]
    resto = [p for n, p in modelo.named_parameters() if not es_oculta(n, p)]
    adamw_resto = torch.optim.AdamW(resto, lr=3e-3, weight_decay=0.0)
    if metodo == "AdamW":
        opts = [torch.optim.AdamW(ocultas, lr=3e-3, weight_decay=0.0), adamw_resto]
    elif metodo == "Muon":
        opts = [Muon(ocultas, lr=0.02), adamw_resto]
    elif metodo == "torch Muon":
        opts = [torch.optim.Muon(ocultas, lr=0.02, weight_decay=0.0, momentum=0.95, nesterov=True), adamw_resto]
    else:
        opts = [GaLoreAdam(ocultas, lr=1e-2, rango=D // 4), adamw_resto]
    gen = torch.Generator().manual_seed(semilla)
    curva, t0 = [], time.perf_counter()
    for paso in range(pasos + 1):
        if paso % 100 == 0:
            curva.append((paso, perdida_val(modelo)))
        if paso == pasos:
            break
        x, y = lote(train, gen)
        loss = F.cross_entropy(modelo(x).flatten(0, 1), y.flatten())
        for o in opts:
            o.zero_grad(set_to_none=True)
        loss.backward()
        for o in opts:
            o.step()
    if dev == "cuda":
        torch.cuda.synchronize()
    segundos = time.perf_counter() - t0
    # números que guarda el optimizador para las matrices ocultas (sin contar la última actualización)
    estado = sum(v.numel() for p in ocultas for k, v in opts[0].state[p].items() if torch.is_tensor(v) and v.ndim > 0 and k != "ultima")
    W = modelo.bloques[1].fc.weight                      # una matriz oculta de 512 x 128
    st = opts[0].state[W]
    if metodo == "AdamW":
        upd = (st["exp_avg"] / (1 - 0.9**pasos)) / ((st["exp_avg_sq"] / (1 - 0.999**pasos)).sqrt() + 1e-8)
    elif metodo == "torch Muon":
        upd = ns5(st["momentum_buffer"])
    else:
        upd = st["ultima"]
    s = torch.linalg.svdvals(upd.float())
    rango_estable = ((s**2).sum() / s[0] ** 2).item()
    return curva, estado, rango_estable, segundos

n_ocultas = sum(p.numel() for n, p in MiniGPT().named_parameters() if p.ndim == 2 and "bloques" in n)
print(f"parámetros en matrices ocultas: {n_ocultas / 1e3:.0f}k")
res = {}
for metodo in ["AdamW", "Muon", "GaLore", "torch Muon"]:
    res[metodo] = curva, estado, re, seg = entrenar(metodo)
    print(f"{metodo:10s} val: " + "  ".join(f"{p}:{l:.3f}" for p, l in curva)
          + f"  | estado {estado / 1e3:.0f}k | rango estable {re:.1f} | {seg:.1f} s")
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.

In the run used to write this lesson (laptop RTX 4060), validation loss at 600 steps was 1.56 with AdamW, 1.45 with our Muon (and 1.45 with torch.optim.Muon, implementing the same algorithm and following nearly the same curve), and 2.02 with rank-32 GaLore. Repetition changes the third digit because GPU operations are nondeterministic. Hidden-matrix optimizer state occupied 1573k numbers with AdamW (two moments), 786k with Muon (one) and 377k with GaLore. Stable rank ∥ΔW∥F2/∥ΔW∥22\norm{\Delta\mat{W}}_F^2/\norm{\Delta\mat{W}}_2^2 of the last update of layer fc of 512×128512\times128 was about 80 with Muon versus 6 with AdamW and GaLore: Muon distributes the step across many directions, exactly as UV⊤\mat{U}\mat{V}\T predicts. Read these as one seed, 600 steps, a tiny model and untuned learning rates. The experiment cannot conclude Muon is better than AdamW or GaLore worse; it shows implementation works and each method’s spectral effect is expected. The next section explains what stronger conclusions require.

Finally, the cost argument on hardware for which Muon was designed:

[ ]NS5 versus SVD on GPULocal GPU
def cronometrar(f, rep=10):
    f()
    if dev == "cuda":
        torch.cuda.synchronize()
    t0 = time.perf_counter()
    for _ in range(rep):
        f()
    if dev == "cuda":
        torch.cuda.synchronize()
    return (time.perf_counter() - t0) / rep

for m, n in [(1024, 1024), (1024, 4096)]:
    G = torch.randn(m, n, device=dev)
    t_ns = cronometrar(lambda: ns5(G))
    t_svd = cronometrar(lambda: torch.linalg.svd(G, full_matrices=False), rep=3)
    O = ns5(G).float()
    U, s, Vt = torch.linalg.svd(G, full_matrices=False)
    sv = torch.linalg.svdvals(O)
    print(f"{m}x{n}: NS5 en bf16 {1e3 * t_ns:7.2f} ms   SVD en fp32 {1e3 * t_svd:8.2f} ms   "
          f"cociente {t_svd / t_ns:5.1f}x   sigma(NS5) en [{sv.min():.2f}, {sv.max():.2f}]   "
          f"||NS5 - UV^T||_F / ||UV^T||_F = {((O - U @ Vt).norm() / (U @ Vt).norm()).item():.2f}")
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.

On GPU the order reverses: in our runs NS5 was 20 to 65 times faster than SVD for these shapes (the exact number depends on GPU and load, but the gap exceeds an order of magnitude). Inspect singular values. For rectangular 1024×40961024\times4096, all lie in [0.68,1.15][0.68, 1.15] as the polynomial predicts; for the square matrix the minimum remains 0.020.02, because a square Gaussian has singular values arbitrarily near 0 (Marchenko–Pastur ratio 1) and five steps cannot lift them. A real network orthogonalizes momentum, not a Gaussian, but the warning is general: NS5 is not UV⊤\mat{U}\mat{V}\T.

What is proved and what is not

ClaimStatusSource
Randomized SVD with p≥2p \ge 2 satisfies the mean bounds above; powers reduce the tail to σj2q+1\sigma_j^{2q+1}TheoremHalko, Martinsson and Tropp (2011)
An aligned balanced deep linear network learns modes in singular-value order, with times ∝1/sα\propto 1/s_\alphaTheoremSaxe, McClelland and Ganguli (2014)
With ∥D∥2≤1\norm{\mat{D}}_2 \le 1, steepest descent is −UV⊤-\mat{U}\mat{V}\TTheoremSpectral–nuclear duality; Bernstein and Newhouse (2024)
Newton–Schulz cubic converges quadratically to the polar factor if 0<σi<30 \lt \sigma_i \lt \sqrt3TheoremBjörck and Bowie (1971); this lesson’s exercise
Fine-tuning has low intrinsic dimensionEmpirical, for measured tasks and modelsAghajanyan et al. (2020)
LoRA matches full GPT-3 fine-tuning with 10 000 times fewer trainable parametersEmpirical, in their experimentsHu et al. (2021)
GaLore maintains full-pretraining loss on LLaMA 1B and 7BEmpirical; theory only for reversible networksZhao et al. (2024)
Muon needs half AdamW compute for the same lossEmpirical, with scaling laws and specific settingsLiu et al. (2025)
Replacing UV⊤\mat{U}\mat{V}\T with quintic output does not worsen trainingEmpirical, no systematic study published in original sourceJordan (2024), blog post
Muon works because networks learn singular modes like linear onesSpeculativeNo proof

To replicate a claim like those in the lower table, a reasonable minimum is: state it precisely (metric and compute or token budget); tune learning rates of all methods equally, because a badly tuned baseline manufactures advantages; repeat over multiple seeds and report spread; check the conclusion under changed model size; and if possible isolate the mechanism (e.g. Muon with exact UV⊤\mat{U}\mat{V}\T versus quintic). The preceding lab does almost none of this and therefore concludes nothing about which optimizer is better.

Common mistakes

Exercises

NumericOne cubic step
Apply one cubic Newton–Schulz iteration step, σ↦32σ−12σ3\sigma \mapsto \tfrac32\sigma - \tfrac12\sigma^3, to singular value σ=0.5\sigma = 0.5.
NumericGaLore state memory
A weight matrix of 4096×40964096\times4096 is trained with Adam. By what factor does Adam-moment memory decrease if the gradient is projected to rank r=128r = 128 on one side, as in GaLore?
NumericThe gap after power iterations
Two consecutive singular values satisfy σk+1/σk=0.9\sigma_{k+1}/\sigma_k = 0.9. After q=2q = 2 power iterations, what is the ratio of corresponding singular values of (AA⊤)qA(\mat{A}\mat{A}\T)^q\mat{A}?
NumericHow long is the plateau?
In an aligned balanced two-layer linear network, a mode with s=1s = 1 starts at u(0)=10−3u(0) = 10^{-3}. Using the theorem’s logistic solution, at what time tt does it reach u=s/2u = s/2?
QuizEach norm, its direction
Let G=Udiag⁡(3,1)V⊤\mat{G} = \mat{U}\diag(3, 1)\mat{V}\T. What is the steepest-descent direction D⋆\mat{D}^\star (before the minus sign) with budget ∥D∥≤1\norm{\mat{D}} \le 1 in each norm?
QuizProved, empirical or speculative
Which claims are proved as theorems under explicit assumptions?

More than one answer may be correct.

ProofThe spectral steepest-descent direction
Prove: Let G=UΣV⊤=∑i=1rσiuivi⊤\mat{G} = \mat{U}\mat{\Sigma}\mat{V}\T = \sum_{i=1}^r\sigma_i\vb{u}_i\vb{v}_i\T be the reduced SVD. Then max⁡∥D∥2≤1⟨G,D⟩F=∑iσi=∥G∥∗\max_{\norm{\mat{D}}_2 \le 1}\inner{\mat{G}}{\mat{D}}_F = \sum_i\sigma_i = \norm{\mat{G}}_*, and the maximum is attained at D=UV⊤\mat{D} = \mat{U}\mat{V}\T.
0
Take any D\mat{D} with ∥D∥2≤1\norm{\mat{D}}_2 \le 1.

Step 1 of 4. How do you write ⟨G,D⟩F\inner{\mat{G}}{\mat{D}}_F using the SVD of G\mat{G}?

ProofConvergence of the Newton–Schulz cubic
Prove: Iteration Xk+1=1.5Xk−0.5XkXk⊤Xk\mat{X}_{k+1} = 1.5\mat{X}_k - 0.5\mat{X}_k\mat{X}_k\T\mat{X}_k acts on each singular value as σ↦p(σ)=1.5σ−0.5σ3\sigma \mapsto p(\sigma) = 1.5\sigma - 0.5\sigma^3, and if all singular values of X0\mat{X}_0 lie in (0,3)(0, \sqrt3), it converges to polar factor UV⊤\mat{U}\mat{V}\T.
0
Let X0=UΣ0V⊤\mat{X}_0 = \mat{U}\mat{\Sigma}_0\mat{V}\T be the reduced SVD, with σi∈(0,3)\sigma_i \in (0, \sqrt3).

Step 1 of 4. Why does Xk\mat{X}_k retain the same singular vectors?

CodeRandomized SVD
Implement randomized_svd(A, k, p, q, rng), returning (U, s, Vt) with U of m×km\times k with orthonormal columns, s of length kk in decreasing order and Vt of k×nk\times n, such that Udiag⁡(s)V⊤\mat{U}\diag(\vb{s})\mat{V}\T approximates A\mat{A} at rank kk. Use a Gaussian of n×(k+p)n\times(k+p) generated with rng, q power iterations reorthogonalizing with QR after each product by A\mat{A} or A⊤\mat{A}\T, and the SVD of small matrix Q⊤A\mat{Q}\T\mat{A}. Do not compute the SVD of A. Tests check, among other things, that with p=10p = 10 and q=2q = 2 spectral error is within 10 % of the Eckart–Young optimum.
import numpy as np

def randomized_svd(A, k, p, q, rng):
  """Devuelve (U, s, Vt) con U de m x k, s de longitud k y Vt de k x n."""
  m, n = A.shape
  l = min(k + p, m, n)
  # 1. sketch: Y = A Omega con Omega gaussiana n x l, y Q = base ortonormal de Y
  # 2. q iteraciones de potencia, reortogonalizando tras cada producto por A o por A^T
  # 3. B = Q^T A, SVD pequeña de B y vuelta: U = Q U_B
  return np.zeros((m, k)), np.zeros(k), np.zeros((k, n))
Shift+Enter to run

Summary

Key idea
Network weights, gradients and updates are matrices whose spectra can be exploited: randomness and a few products capture rank, depth makes singular modes learned in order, and spectral-norm steepest descent −UV⊤-\mat{U}\mat{V}\T is computed with an odd polynomial sending all singular values toward 1 using only matrix products.
  • Randomized SVD multiplies A\mat{A} by k+pk + p Gaussians, orthonormalizes and factorizes a small matrix. Its error is near the Eckart–Young optimum for fast spectral decay; for slow decay power iterations raise singular values to 2q+12q + 1 and separate the tail. Oversampling controls ∥Ω1+∥\norm{\mat{\Omega}_1\pinv}; powers control the tail.
  • In an aligned balanced deep linear network, each singular mode follows a logistic curve with time ∝1sαlog⁡sαu0\propto \frac{1}{s_\alpha}\log\frac{s_\alpha}{u_0}: small initialization gives plateaus and learning in singular-value order. One layer or large initialization has no steps.
  • A layer gradient is a sum of outer products with rapidly decaying spectrum. LoRA restricts updates to rank rr; GaLore stores Adam moments in a refreshed rank-rr subspace and saves factor m/rm/r in state memory.
  • Steepest-descent direction depends on norm: G/∥G∥F\mat{G}/\norm{\mat{G}}_F, sign⁡(G)\operatorname{sign}(\mat{G}) or UV⊤\mat{U}\mat{V}\T. Spectral and nuclear norms are dual: max⁡∥D∥2≤1⟨G,D⟩=∥G∥∗\max_{\norm{\mat{D}}_2\le1}\inner{\mat{G}}{\mat{D}} = \norm{\mat{G}}_*.
  • Newton–Schulz applies p(σ)p(\sigma) to each singular value using matrix products. The cubic converges quadratically to UV⊤\mat{U}\mat{V}\T on (0,3)(0, \sqrt3) but raises small values slowly; Muon’s quintic raises them fast but remains in a band around 1. Always normalize first.
  • Separate theorems, empirical evidence and speculation, and replicate before adopting: this lesson’s lab illustrates what one seed on a tiny model can and cannot establish.