Simple Algorithm
Deep Learning · Emergence · 26 min

Training in a Tiny Subspace

Intrinsic dimension, low-rank gradients and the contested claim that training lives in a tiny subspace.

A network with hundreds of thousands of parameters can be trained while moving only inside a random subspace of a few hundred dimensions, and fine-tuning a pretrained language model can need even fewer. Meanwhile the gradient seems to concentrate in the handful of top Hessian directions, suggesting that training itself happens in a tiny subspace. This lesson measures how small the subspaces can be, explains why random ones work, examines the tiny-subspace claim and the experiment that undercut it, and shows how low-rank gradients save memory.

What you’ll learn

  • Define the intrinsic dimension of a training problem through random-subspace training, and interpret its measured values for standard tasks, fine-tuning and random labels.
  • Explain the threshold training dimension with Gordon's escape theorem and the Gaussian width of sublevel sets, and why subspaces taken from the training trajectory do better.
  • State the observation that gradients align with the top Hessian eigenspace and the projection experiments showing that this alignment is spurious, with a quadratic model of why.
  • Derive GaLore's update and memory cost, contrast it with LoRA, and relate low-dimensional training to redundancy.

Intrinsic dimension

How many of a network's DD parameters does training really need? Li, Farkhoor, Liu & Yosinski (2018) answered by training in a random subspace. Fix the initialization θ0∈RD\boldsymbol\theta_0\in\R^D and a random D×dD\times d matrix PP with unit-length columns, and train only z∈Rd\mathbf z\in\R^d, started at zero:

θ=θ0+Pz,∇zL=P⊤∇θL,dint90=min⁡{d: performance≥90% of the full model’s}\boldsymbol\theta=\boldsymbol\theta_0+P\mathbf z,\qquad\nabla_{\mathbf z}\loss=P^\top\nabla_{\boldsymbol\theta}\loss,\qquad d_{\text{int}90}=\min\{d:\ \text{performance}\ge90\%\text{ of the full model's}\}
Random high-dimensional vectors are nearly orthogonal, so PP is close to an orthonormal basis of a random dd-dimensional subspace through θ0\boldsymbol\theta_0, and gradient descent on z\mathbf z is projected gradient descent in it. The smallest dd at which training reaches 90% of the full model's validation accuracy defines the intrinsic dimension dint90d_{\text{int}90}.
TaskNetworkParameters DDdint90d_{\text{int}90}
MNISTfully connected 784–200–200–10199,210750
MNISTLeNet44,426290
MNIST, pixels shuffledLeNet44,4261,400
MNIST, labels shuffled (train accuracy)fully connected959,610190,000
CIFAR-10fully connected656,8109,000
CIFAR-10LeNet62,0062,900
ImageNetSqueezeNet1,248,424more than 500,000
Inverted pendulum (RL)fully connected5624
Measurements of Li et al. (2018), Table 1. Large models used sparse random projections or the Fastfood transform, since a dense D×dD\times d matrix is too big to store.

Four findings stand out.

  • Size does not matter much. Across 20 fully connected networks for MNIST, with 1 to 5 hidden layers of 50 to 400 units and sizes that varied by a factor of 24, dint90d_{\text{int}90} varied by a factor of only 1.33. Once a network is big enough, extra parameters enlarge the set of solutions rather than the difficulty of reaching one: the (D−n)(D-n)-dimensional manifolds of minima of Loss Landscapes (which writes PP for the parameter count), seen from another angle.
  • Architecture is a prior. LeNet needs fewer dimensions than the fully connected network on MNIST (290 against 750), but on pixel-shuffled images its intrinsic dimension rises to 1,400, while the fully connected network, indifferent to pixel order, stays at 750.
  • Memorization is expensive. Fitting 50,000 random labels needed 190,000 dimensions, about 3.8 per label.
  • A compression bound. A solution can be stored as the random seed plus the dd numbers in z\mathbf z, an upper bound on its description length, which connects intrinsic dimension to compression-based generalization bounds (Generalization Bounds for Deep Networks).
Predict before you look

The fully connected MNIST network has D=199,210D=199{,}210 parameters and dint90=750d_{\text{int}90}=750. By what factor does storing the subspace coordinates z\mathbf z (plus a random seed) instead of all the weights compress the solution?

Show the answer

266

199,210/750≈266199{,}210/750\approx266: the trained network uses about 0.4% of its degrees of freedom. For LeNet the factor is 44,426/290≈15344{,}426/290\approx153. The price is accuracy, since the subspace solution reaches only 90% of the full model's performance by construction.

Fine-tuning needs even less. Aghajanyan, Zettlemoyer & Gupta (2021) applied the same measurement to fine-tuning pretrained language models: optimizing only 200 parameters, randomly projected into the full space, brought RoBERTa to 90% of full fine-tuning performance on the MRPC paraphrase task. Pretraining lowered the intrinsic dimension of downstream tasks, and larger models had lower intrinsic dimensions after a fixed amount of pretraining. This is the empirical motivation for low-rank fine-tuning (Low-Rank Adaptation in Depth).

python
import torch
from torch.func import functional_call

def train_in_subspace(model, loss_fn, X, y, d, steps=2000, lr=1e-2):
    """Train only z in θ = θ₀ + P z, with P a fixed random D × d matrix."""
    names, shapes = zip(*[(n, p.shape) for n, p in model.named_parameters()])
    theta0 = torch.cat([p.detach().reshape(-1) for p in model.parameters()])
    D = theta0.numel()
    P = torch.randn(D, d) / D ** 0.5                 # columns of length ≈ 1, nearly orthogonal
    z = torch.zeros(d, requires_grad=True)           # start exactly at θ₀
    opt = torch.optim.Adam([z], lr=lr)
    for _ in range(steps):
        chunks = torch.split(theta0 + P @ z, [s.numel() for s in shapes])
        params = {n: c.view(s) for n, c, s in zip(names, chunks, shapes)}
        loss = loss_fn(functional_call(model, params, (X,)), y)
        opt.zero_grad(); loss.backward(); opt.step()
    return loss.item()

Subspace training with a dense projection, fine for small networks. Sweep dd upward and the final loss falls; the smallest dd that reaches 90% of the full model's accuracy is the intrinsic dimension.

Why random subspaces work

Larsen, Fort, Becker & Ganguli (2022) measured the probability that training in a random dd-dimensional subspace reaches a target loss, and found a sharp transition from 0 to 1 at a threshold training dimension. The threshold rises as the target loss is lowered and falls as the starting loss is lowered. Both dependences follow from the geometry of high-dimensional sets.

Low intrinsic dimension therefore means that the low-loss sublevel sets, seen from the initialization, are wide: they extend in almost all directions, their squared Gaussian width falling short of DD by only a few hundred or thousand. That is what flat valleys and huge manifolds of minima look like from afar. A lower target loss shrinks the sublevel set and raises the threshold; a starting point closer to it makes the set subtend a larger angle and lowers the threshold. For a quadratic well, Larsen et al. bound the threshold through the Hessian spectrum and the distance to the minimum.

Better than random. A short phase of full training before switching to a random subspace (a burn-in subspace) lowers the threshold, and lottery subspaces, spanned by the top principal directions of a full training trajectory, reach much higher accuracy for a given dimension than random ones. Li, Tan, Tao, Liu & Huang (2021) built subspaces from principal components of snapshots along the training trajectory and found that optimizing in about 40 such dimensions could match regular training. Random subspaces are not special, then; they are simply generic, and by the Johnson–Lindenstrauss lemma a random projection to O(log⁡m/ϵ2)\order{\log m/\epsilon^2} dimensions preserves all distances among mm points within a factor 1±ϵ1\pm\epsilon.

Check your understanding

You measure the threshold training dimension twice: once from the random initialization, and once after a short burn-in of full training that has already halved the loss. What do you expect, and why?

  1. The same threshold, since the subspace is random in both cases
  2. A higher threshold after burn-in, because the network is now in a sharper region
  3. A threshold equal to the number of classes in both cases
  4. A lower threshold after burn-in, because from a point closer to the low-loss set that set subtends a larger angle and so has a larger projected Gaussian width
Show the answer

D. A lower threshold after burn-in, because from a point closer to the low-loss set that set subtends a larger angle and so has a larger projected Gaussian width

The threshold is about D−w(S)2D-w(S)^2 for the sublevel set SS projected onto a sphere around the starting point. Moving closer to the set makes its projection cover more of the sphere, raising w(S)w(S) and lowering the threshold, as Larsen et al. measured.

Does gradient descent happen in a tiny subspace?

A different, much smaller subspace appeared in The Hessian of a Deep Network: the span of the top kk eigenvectors of the Hessian, about one per class. Gur-Ari, Roberts & Dyer (2018) measured how much of the gradient lies in it,

ftop=∥Πk g∥2∥g∥2,Πk=∑i=1kqiqi⊤  (top-k eigenvectors of H),k=Cf_{\text{top}}=\frac{\norm{\Pi_k\,\mathbf g}^2}{\norm{\mathbf g}^2},\qquad\Pi_k=\sum_{i=1}^kq_iq_i^\top\ \ (\text{top-}k\text{ eigenvectors of }H),\qquad k=C
The fraction of the gradient's squared norm in the top Hessian subspace.

and found that, across fully connected networks, convolutional networks and ResNet-18, ftopf_{\text{top}} rises close to 1 after a short period of training, while the top subspace itself changes only slowly. Since a small step lowers the loss by about η∥g∥2\eta\norm{\mathbf g}^2, they argued that descending along Πkg\Pi_k\mathbf g alone should do nearly as well, so that training might happen in a tiny, slowly moving subspace.

Song, Ahn & Yun (2025) tested this directly. Dom-SGD projects every SGD update onto the top subspace (recomputed at each step), and Bulk-SGD projects it onto the orthogonal complement. Switched on once the alignment had formed, Dom-SGD stopped reducing the training loss, and over long runs even increased it slowly, while Bulk-SGD trained as well as SGD although it discards most of each update. The same held for gradient descent at the edge of stability, for SAM, with momentum and with Adam, and momentum and Adam were found to amplify the bulk component of the update. The alignment is real but spurious: the component along the top directions is large and useless. Its cause depends on the regime. Below the stability threshold it is SGD's noise: switching to full-batch gradient descent made the alignment vanish at once, while the trajectory hardly changed. At the edge of stability it comes from the oscillation that keeps the sharpness near 2/η2/\eta, the self-stabilization mechanism of Damian, Nichani & Lee (2023).

DerivationA noisy valley in two dimensions
  1. Var⁡(x)=ηs2a(2−ηa)⟹E[(ax+ξ)2]=a2Var⁡(x)+s2=2s22−ηa\Var(x)=\frac{\eta s^2}{a(2-\eta a)}\quad\Longrightarrow\quad\E\big[(ax+\xi)^2\big]=a^2\Var(x)+s^2=\frac{2s^2}{2-\eta a}

    Song et al. reproduce the phenomena with an ill-conditioned two-dimensional quadratic (a=1000a=1000, b=1b=1, noise from sampling one of two losses). A variant with noise only along the sharp direction can be solved exactly. Take L=12(ax2+by2)\loss=\frac12(ax^2+by^2) with a≫ba\gg b: xx is the sharp direction, yy the bulk. SGD sees the gradient (ax+ξ, by)(ax+\xi,\ by), with noise ξ\xi of variance s2s^2 along the sharp direction, as in networks, where gradient noise lines up with the top of the Hessian. Along xx the iterate settles into the stationary spread of Gradient Noise, Batch Size & Scaling Rules:

  2. ftop≈2s2/(2−ηa)2s2/(2−ηa)+b2yt2 → yt→0  1f_{\text{top}}\approx\frac{2s^2/(2-\eta a)}{2s^2/(2-\eta a)+b^2y_t^2}\ \xrightarrow{\ y_t\to0\ }\ 1

    The bulk gradient bytby_t shrinks as yy converges, so the gradient's energy ends up almost entirely along xx: ftop→1f_{\text{top}}\to1.

  3. Dom-SGD: L≥b2y02,Bulk-SGD: yt=(1−ηb)ty0  as for SGD\text{Dom-SGD: }\loss\ge\tfrac b2y_0^2,\qquad\text{Bulk-SGD: }y_t=(1-\eta b)^ty_0\ \text{ as for SGD}

    Yet the xx component does nothing for the loss: at stationarity its expected contribution is constant, a2Var⁡(x)\frac a2\Var(x), and every bit of progress comes from yy. Dom-SGD updates only xx and leaves the bulk part of the loss, b2y02\frac b2y_0^2, where it was; Bulk-SGD updates only yy and keeps all of SGD's progress. Without noise, xx decays to zero faster than yy (whenever η(a+b)<2\eta(a+b)<2, that is, away from the edge of stability) and the alignment disappears, as with full-batch gradient descent in the experiments.

The toy model also explains how both observations can be true. The top subspace really does contain most of the gradient, because the iterate keeps bouncing across the narrow directions of the valley, but the downhill path runs along the floor, in the bulk. This matches The Hessian of a Deep Network: gradient energy concentrated in the outliers is what slows training without batch normalization.

Low-rank gradients for memory

A subspace can also save memory. For a linear layer W∈Rm×nW\in\R^{m\times n} the gradient of a batch is a sum of outer products, ∇WL=1B∑iδiai⊤\nabla_W\loss=\frac1B\sum_i\boldsymbol\delta_i\mathbf a_i^\top, and in practice gradients of large layers have rapidly decaying singular values. Zhao, Zhang, Chen, Wang, Anandkumar & Tian (2024) proved, under a model of the gradient that reversible networks satisfy, that its stable rank decays during SGD. Their GaLore runs Adam on a low-rank projection of each layer's gradient instead of on the gradient itself.

DerivationGaLore (gradient low-rank projection)
  1. Gt=UΣV⊤,Pt=U:,1:r,Rt=Pt⊤Gt∈Rr×nG_t=U\Sigma V^\top,\qquad P_t=U_{:,1:r},\qquad R_t=P_t^\top G_t\in\R^{r\times n}

    Every TT steps (T=200T=200 in their experiments), take the top rr left singular vectors of the current gradient as a projector Pt∈Rm×rP_t\in\R^{m\times r} (for m≤nm\le n), and project each gradient into the small space:

  2. Nt=Adam⁡(Rt),W←W−η α PtNtN_t=\operatorname{Adam}(R_t),\qquad W\leftarrow W-\eta\,\alpha\,P_tN_t

    Run Adam on RtR_t, keeping its moments in Rr×n\R^{r\times n}, and map the normalized step back to the full space with a scale α\alpha (0.250.25 in their experiments). The weights stay full-rank and are updated directly:

  3. states: Adam 2mn,GaLore mr+2nr,LoRA 2mr+2nr\text{states: Adam }2mn,\qquad\text{GaLore }mr+2nr,\qquad\text{LoRA }2mr+2nr

    Adam's two moments for WW take 2mn2mn numbers; GaLore stores the projector and two moments in the small space, mr+2nrmr+2nr. LoRA, which trains factors BABA beside frozen weights, stores 2mr+2nr2mr+2nr optimizer states and extra weights. Because PtP_t changes every TT steps, GaLore's accumulated update can have high rank, which a fixed LoRA factorization cannot.

Predict before you look

For a 4096×40964096\times4096 layer with rank r=128r=128, by what factor does GaLore shrink the memory of Adam's optimizer states (2mn2mn against mr+2nrmr+2nr)?

Show the answer

21.3

2mn=33,554,4322mn=33{,}554{,}432 numbers against mr+2nr=524,288+1,048,576=1,572,864mr+2nr=524{,}288+1{,}048{,}576=1{,}572{,}864: a factor of about 21.321.3, or 3/(2⋅32)3/(2\cdot32) of the original when m=nm=n and r=m/32r=m/32. The weights and the gradient themselves are unchanged, so the saving in total memory is smaller.

Pretraining LLaMA-style models of up to 7 billion parameters on the C4 dataset (up to 19.7 billion tokens), GaLore cut optimizer-state memory by up to 65.5% while maintaining performance in their comparisons; with 8-bit states, optimizer memory fell by up to 82.5% and total training memory by 63.3% relative to a BF16 baseline, enough to pretrain a 7-billion-parameter model on a single GPU with 24 GB of memory without model parallelism, checkpointing or offloading. As with other optimizer claims (Beyond Adam: Lion, Muon & Steepest Descent), how the method compares with well-tuned full-rank training at scale is still being evaluated.

Key takeaways

  • Training θ0+Pz\boldsymbol\theta_0+P\mathbf z in a random dd-dimensional subspace reaches 90% of full performance at small dd: 750 for a 199,210-parameter MNIST network, 2,900 for LeNet on CIFAR-10, about 200 for fine-tuning RoBERTa on MRPC, but 190,000 to memorize 50,000 random labels. It barely depends on the network's size.
  • The threshold dimension is about D−w(S)2D-w(S)^2, with w(S)w(S) the Gaussian width of the target sublevel set seen from the start (Gordon's escape theorem): low-loss sets are wide. Burn-in and trajectory-based subspaces need far fewer dimensions than random ones.
  • Gradients align with the top Hessian eigenspace after early training, but the aligned part is spurious: Dom-SGD stalls while Bulk-SGD trains as well as SGD. In a noisy quadratic, noise along the sharp direction dominates the gradient yet does nothing for the loss.
  • GaLore projects each layer's gradient onto rr top singular directions, refreshed every TT steps, and runs Adam there: optimizer states drop from 2mn2mn to mr+2nrmr+2nr, while the weights, unlike LoRA's, stay full rank.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

What does it mean that a fully connected MNIST network with 199,210199{,}210 parameters has intrinsic dimension dint90=750d_{\text{int}90}=750?

  1. Only 750 of its weights matter; the rest can be set to zero
  2. Training only 750 coordinates in a random subspace through the initialization reaches 90% of the full network's performance
  3. Its Hessian has exactly 750 nonzero eigenvalues
  4. It can memorize at most 750 training examples
Show the answer

B. Training only 750 coordinates in a random subspace through the initialization reaches 90% of the full network's performance

Intrinsic dimension is measured by training θ0+Pz\boldsymbol\theta_0+P\mathbf z with a random PP and z∈Rd\mathbf z\in\R^d. Every weight still changes, but only along 750 random directions. Pruning, which zeroes individual weights, is a different, coordinate-aligned kind of reduction.

Question 2

Across a family of fully connected networks whose sizes differ by a factor of 24, Li et al. found dint90d_{\text{int}90} nearly constant. What is the best interpretation?

  1. Once a network is large enough, extra parameters mostly add dimensions to the set of solutions, not to the difficulty of reaching one
  2. Wider networks are no more expressive than narrow ones
  3. Random subspaces ignore most layers
  4. The measurement saturates at a fixed maximum value
Show the answer

A. Once a network is large enough, extra parameters mostly add dimensions to the set of solutions, not to the difficulty of reaching one

If the solution set's codimension stays the same while DD grows, a random subspace of fixed dimension keeps hitting it. This matches the picture of manifolds of minima of dimension D−nD-n whose dimension grows with every added parameter.

Question 3

Song, Ahn & Yun (2025) projected each SGD update onto the top Hessian eigenspace (Dom-SGD), or onto its orthogonal complement (Bulk-SGD). What happened?

  1. Both trained as well as SGD, since the gradient lies almost entirely in the top eigenspace
  2. Dom-SGD trained faster than SGD, since it removes noise in the bulk
  3. Dom-SGD stopped reducing the loss, while Bulk-SGD trained as well as SGD despite discarding most of each update
  4. Neither could train: both projections are too restrictive
Show the answer

C. Dom-SGD stopped reducing the loss, while Bulk-SGD trained as well as SGD despite discarding most of each update

The large component of the update along the top eigenspace is real but useless: it mostly reflects oscillation across sharp directions, driven by SGD noise (or by self-stabilization at the edge of stability). The loss decreases through the small bulk component.

Question 4

How does GaLore differ from LoRA?

  1. GaLore trains a pair of low-rank factors BABA added to frozen weights, as LoRA does, but initializes them differently
  2. GaLore keeps full-rank weights, projects each layer's gradient onto a rank-rr subspace refreshed every TT steps, and stores Adam's states only in that subspace
  3. GaLore quantizes the weights to 4 bits and trains adapters
  4. GaLore trains only the biases
Show the answer

B. GaLore keeps full-rank weights, projects each layer's gradient onto a rank-rr subspace refreshed every TT steps, and stores Adam's states only in that subspace

GaLore updates the weights directly, W←W−η αPtNtW\leftarrow W-\eta\,\alpha P_t N_t, with Adam run on Rt=Pt⊤GtR_t=P_t^\top G_t. Because the projector changes every TT steps, the accumulated update can have high rank, which LoRA's fixed factorization rules out; and the optimizer states shrink from 2mn2mn to 2nr2nr numbers plus the mrmr projector.

Further reading

  • C. Li, H. Farkhoor, R. Liu & J. Yosinski, "Measuring the intrinsic dimension of objective landscapes," ICLR (2018).
  • B. W. Larsen, S. Fort, N. Becker & S. Ganguli, "How many degrees of freedom do we need to train deep networks: a loss landscape perspective," ICLR (2022).
  • G. Gur-Ari, D. A. Roberts & E. Dyer, "Gradient descent happens in a tiny subspace," arXiv:1812.04754 (2018).
  • M. Song, K. Ahn & C. Yun, "Does SGD really happen in tiny subspaces?," ICLR (2025).
  • J. Zhao, Z. Zhang, B. Chen, Z. Wang, A. Anandkumar & Y. Tian, "GaLore: Memory-efficient LLM training by gradient low-rank projection," ICML (2024).