Simple Algorithm
Deep Learning · Emergence · 30 min

How SGD Learns Features

Beyond the kernel regime: single-index models, information exponents and leap complexity.

A wide network trained in the kernel regime keeps its random features and needs about dpd^p examples to learn a degree-pp polynomial of a single direction in Rd\R^d. A network that first finds the direction can do far better. Over the last few years, sharp theorems have pinned down when and how fast SGD finds such hidden structure, and the answer depends on a single integer: how flat the loss is at the start.

What you’ll learn

  • Explain why kernel methods, including the neural tangent kernel regime, need about dpd^p samples for degree-pp targets, and define single-index models.
  • Define the information exponent through the Hermite expansion of the link function, and derive why online SGD needs about dk⋆−1d^{k^\star-1} samples to escape the equator.
  • Show that one gradient step on a two-layer network adds a rank-one spike aligned with the target's linear component, and state when gradient descent provably beats kernels.
  • Define the leap complexity of a multi-index target, explain saddle-to-saddle dynamics and sparse parities, and relate SGD's cost to statistical-query lower bounds.

What kernels cannot learn

In the lazy regime a very wide network barely moves its first-layer weights, so it behaves like a linear model on fixed random features: kernel regression with the neural tangent kernel (Jacot, Gabriel & Hongler, 2018). Whether training is lazy depends on the scaling of initialization and learning rate (Chizat, Oyallon & Bach, 2019), and the Loss Landscapes lesson shows the linearization. The trouble with kernels is high dimension.

For inputs uniform on a sphere in Rd\R^d, Ghorbani, Mei, Misiakiewicz & Montanari (2021) proved that kernel ridge regression with a rotation-invariant kernel and dℓ+δ≤n≤dℓ+1−δd^{\ell+\delta}\le n\le d^{\ell+1-\delta} samples can fit at most the degree-ℓ\ell polynomial part of the target; random-features and neural-tangent models whose width lies in the same range are limited in the same way (to degree ℓ\ell and ℓ+1\ell+1). A cubic function of a single direction already costs about d3d^3 samples, the same as an arbitrary cubic. The kernel cannot exploit the fact that only one direction matters; a network that learns its features can, which is the formal meaning of feature learning in this lesson.

DerivationThe loss near the equator is flat to order k*
  1. E[hj(⟨u,x⟩) hk(⟨v,x⟩)]=δjk ⟨u,v⟩k\E\big[h_j(\langle\mathbf u,\mathbf x\rangle)\,h_k(\langle\mathbf v,\mathbf x\rangle)\big]=\delta_{jk}\,\langle\mathbf u,\mathbf v\rangle^k

    For unit vectors u,v\mathbf u,\mathbf v the pair (⟨u,x⟩,⟨v,x⟩)(\langle\mathbf u,\mathbf x\rangle,\langle\mathbf v,\mathbf x\rangle) is jointly Gaussian with correlation ⟨u,v⟩\langle\mathbf u,\mathbf v\rangle, and Hermite polynomials diagonalize such pairs:

  2. L(w)=E[(σ⋆(⟨w,x⟩)−y)2]=2∑k≥1ck2 (1−mk)\loss(\mathbf w)=\E\big[(\sigma^\star(\langle\mathbf w,\mathbf x\rangle)-y)^2\big]=2\sum_{k\ge1}c_k^2\,\big(1-m^k\big)

    Take a matched student, σ=σ⋆\sigma=\sigma^\star, and the square loss. Expanding both links, the population loss depends on w\mathbf w only through the overlap mm:

  3. L≈const−2ck⋆2 mk⋆,∣dLdm∣≈2k⋆ck⋆2 ∣m∣k⋆−1∼d−(k⋆−1)/2  at  ∣m∣≈d−1/2\loss\approx\text{const}-2c_{k^\star}^2\,m^{k^\star},\qquad\Big|\frac{d\loss}{dm}\Big|\approx2k^\star c_{k^\star}^2\,\abs m^{k^\star-1}\sim d^{-(k^\star-1)/2}\ \text{ at }\ \abs m\approx d^{-1/2}

    Near the equator the first surviving term dominates. Its slope is what pulls a random start toward w⋆\mathbf w^\star, and it is tiny when k⋆k^\star is large: the landscape has a degenerate critical point at m=0m=0 of order k⋆k^\star.

Link σ⋆(z)\sigma^\star(z)First nonzero Hermite coefficientk⋆k^\star
zz, or ReLU⁡(z)\operatorname{ReLU}(z)c1=E[σ⋆(z)z]c_1=\E[\sigma^\star(z)z], equal to 11 and 12\tfrac1211
z2−1z^2-1, ∣z∣\abs z (phase retrieval)c1=0c_1=0 by symmetry, c2≠0c_2\ne022
He3(z)=z3−3z\mathrm{He}_3(z)=z^3-3zc1=c2=0c_1=c_2=0, c3=6c_3=\sqrt633
Hek(z)\mathrm{He}_k(z)only ck≠0c_k\ne0kk
Even links have c1=0c_1=0, and higher Hermite polynomials are orthogonal to every lower-degree polynomial, so they hide the direction more and more deeply.

Escaping the equator

DerivationWhere d^(k*−1) comes from: a scaling argument
  1. tsearch≈∫m01dma mk⋆−1≈m0−(k⋆−2)a (k⋆−2)∼d(k⋆−2)/2(k⋆≥3)t_{\text{search}}\approx\int_{m_0}^{1}\frac{dm}{a\,m^{k^\star-1}}\approx\frac{m_0^{-(k^\star-2)}}{a\,(k^\star-2)}\sim d^{(k^\star-2)/2}\qquad(k^\star\ge3)

    Projected onto the sphere, gradient flow on the population loss moves the overlap like m˙=−(1−m2) L′(m)≈a mk⋆−1\dot m=-(1-m^2)\,\loss'(m)\approx a\,m^{k^\star-1} with a=2k⋆ck⋆2a=2k^\star c_{k^\star}^2. Starting from m0=d−1/2m_0=d^{-1/2}, the time to reach m=Θ(1)m=\Theta(1) is

  2. δ a m0k⋆−1≳δ2d m0⟹δ≲m0k⋆−2d=d−k⋆/2\delta\,a\,m_0^{k^\star-1}\gtrsim\delta^2d\,m_0\quad\Longrightarrow\quad\delta\lesssim\frac{m_0^{k^\star-2}}{d}=d^{-k^\star/2}

    Online SGD follows this flow only if the step δ\delta is small enough. A single sample's gradient has norm about d\sqrt d, so renormalizing onto the sphere after a step shrinks mm by a factor of about 1−c δ2d1-c\,\delta^2d, while the useful drift adds δ a mk⋆−1\delta\,a\,m^{k^\star-1}. The drift must win at the start, where m=m0m=m_0:

  3. n≈tsearchδ∼d(k⋆−2)/2⋅dk⋆/2=d k⋆−1n\approx\frac{t_{\text{search}}}{\delta}\sim d^{(k^\star-2)/2}\cdot d^{k^\star/2}=d^{\,k^\star-1}

    The number of steps, which is the number of samples, is the search time divided by the step size. The weak signal costs twice: it makes the search long, and it forces small steps.

Predict before you look

A single-index target has information exponent k⋆=3k^\star=3 in dimension d=100d=100. About how many samples does online SGD need, ignoring constants and logarithms? Answer as a power of ten.

Show the answer

4 log₁₀ n

dk⋆−1=1002=104d^{k^\star-1}=100^2=10^4. For comparison, a kernel method needs about d3=106d^3=10^6 samples to learn this cubic, while the smoothed SGD discussed next needs only about dk⋆/2=103d^{k^\star/2}=10^3, matching the lower bound for correlational methods.

Is dk⋆−1d^{k^\star-1} the limit? No. Damian, Nichani, Ge & Lee (2023) ran online SGD on a smoothed loss: the average of the loss over the directions (w+λz)/∥w+λz∥(\mathbf w+\lambda\mathbf z)/\norm{\mathbf w+\lambda\mathbf z}, for random unit vectors z⊥w\mathbf z\perp\mathbf w and a large radius λ≈d1/4\lambda\approx d^{1/4}. Smoothing shrinks both the signal and the noise of the stochastic gradient, but near the equator it shrinks the noise faster, and the higher signal-to-noise ratio cuts the sample complexity to about dk⋆/2d^{k^\star/2} for k⋆>2k^\star>2. That matches a lower bound for correlational statistical query (CSQ) algorithms, which access the data only through averages E[y ϕ(x)]\E[y\,\phi(\mathbf x)]; gradient descent on the square loss is one of them. Algorithms that may also transform the labels are governed by a possibly smaller generative exponent; correlating sign⁡(y)\sign(y) with x\mathbf x, for instance, already reveals w⋆\mathbf w^\star for the He3\mathrm{He}_3 link, whose information exponent is 3. Damian, Pillaud-Vivien, Lee & Bruna (2024) prove that statistical-query and low-degree-polynomial algorithms need about dkgen/2d^{k_{\text{gen}}/2} samples, and give a polynomial-time algorithm that matches it.

Check your understanding

Online SGD is trained on four single-index targets in the same high dimension dd. Which needs the most samples?

  1. y=ReLU⁡(⟨w⋆,x⟩)y=\operatorname{ReLU}(\langle\mathbf w^\star,\mathbf x\rangle)
  2. y=∣⟨w⋆,x⟩∣y=\abs{\langle\mathbf w^\star,\mathbf x\rangle}
  3. y=⟨w⋆,x⟩y=\langle\mathbf w^\star,\mathbf x\rangle
  4. y=He3(⟨w⋆,x⟩)y=\mathrm{He}_3(\langle\mathbf w^\star,\mathbf x\rangle)
Show the answer

D. y=He3(⟨w⋆,x⟩)y=\mathrm{He}_3(\langle\mathbf w^\star,\mathbf x\rangle)

The cost is governed by the information exponent: 11 for the linear and ReLU links (about dd samples), 22 for ∣z∣\abs z (about dlog⁡dd\log d), and 33 for He3\mathrm{He}_3 (about d2d^2). Nonlinearity alone is not what makes a target hard; a vanishing correlation with low-degree polynomials of the hidden direction is.

One large step learns a direction

Full networks do not need thousands of small online steps to start learning features. Ba, Erdogdu, Suzuki, Wang, Wu & Yang (2022) studied a two-layer network f(x)=1N∑j=1Naj σ(⟨wj,x⟩)f(\mathbf x)=\frac1{\sqrt N}\sum_{j=1}^Na_j\,\sigma(\langle\mathbf w_j,\mathbf x\rangle) whose first layer takes a single gradient step of size η\eta on nn samples, after which the second layer is fit by ridge regression, in the limit where nn, dd and NN grow in proportion. The structure of that one step is easy to see in expectation.

DerivationThe first gradient is a rank-one spike
  1. ∇wjL≈−ajN E[y σ′(⟨wj,x⟩) x]\nabla_{\mathbf w_j}\loss\approx-\frac{a_j}{\sqrt N}\,\E\big[y\,\sigma'(\langle\mathbf w_j,\mathbf x\rangle)\,\mathbf x\big]

    At initialization the network's output is small, so with L=12E(f(x)−y)2\loss=\frac12\E(f(\mathbf x)-y)^2 the gradient for neuron jj is dominated by the label term:

  2. E[y σ′(zj) x]≈E[σ⋆(z⋆) z⋆] E[σ′(zj)] w⋆=c1 E[σ′]  w⋆\E\big[y\,\sigma'(z_j)\,\mathbf x\big]\approx\E\big[\sigma^\star(z^\star)\,z^\star\big]\,\E\big[\sigma'(z_j)\big]\,\mathbf w^\star=c_1\,\E[\sigma']\;\mathbf w^\star

    A random wj\mathbf w_j is nearly orthogonal to w⋆\mathbf w^\star, so write x=z⋆w⋆+zjwj+x⊥\mathbf x=z^\star\mathbf w^\star+z_j\mathbf w_j+\mathbf x_\perp with independent standard Gaussian parts. The x⊥\mathbf x_\perp part averages to zero, and if Ey=0\E y=0 so does the part along wj\mathbf w_j. Only the hidden direction survives, weighted by the first Hermite coefficient c1=E[σ⋆(z)z]c_1=\E[\sigma^\star(z)z]:

  3. ∇WL≈−c1 E[σ′]N  a w⋆⊤\nabla_W\loss\approx-\frac{c_1\,\E[\sigma']}{\sqrt N}\;\mathbf a\,\mathbf w^{\star\top}

    Every neuron moves along the same direction w⋆\mathbf w^\star, scaled by its own output weight. Stacking the rows, the population gradient of the first layer is a rank-one matrix; on a finite sample it becomes this spike plus a bulk of sampling noise.

What the spike buys depends on the step size. For a small step, Ba et al. prove a Gaussian equivalence for the trained features: the new kernel improves on the random features but still cannot beat the best linear predictor on the input. For a sufficiently large step (η\eta of order N\sqrt N in their scaling), ridge regression on the trained features goes beyond this linear regime and, for certain targets, outperforms a wide range of random-features and rotation-invariant kernel methods. Note the factor c1c_1: if the target has information exponent k⋆≥2k^\star\ge2, the spike vanishes at first order, and the single step learns nothing about w⋆\mathbf w^\star, consistent with the search phase above.

With more steps, gradient descent provably learns low-dimensional structure that kernels cannot. Damian, Lee & Soltanolkotabi (2022) took targets f⋆(x)=g(Ux)f^\star(\mathbf x)=g(U\mathbf x) with rr relevant directions (U∈Rr×dU\in\R^{r\times d}) and gg a degree-pp polynomial. A two-layer network trained by gradient descent learns a representation that depends only on the relevant directions, with sample complexity n≍d2r+drpn\asymp d^2r+dr^p, whereas n≍dpn\asymp d^p samples are necessary in the kernel regime. For p=4p=4 and fixed rr, that is d2d^2 against d4d^4.

Check your understanding

A two-layer network at random initialization takes one gradient step on data labeled by y=∣⟨w⋆,x⟩∣−2/πy=\abs{\langle\mathbf w^\star,\mathbf x\rangle}-\sqrt{2/\pi}, which has mean zero. What does the first-order spike in the gradient look like?

  1. A rank-one matrix aligned with w⋆\mathbf w^\star, as for any target
  2. There is none: c1=E[∣z∣ z]=0c_1=\E[\abs z\,z]=0, so the step carries no first-order information about w⋆\mathbf w^\star
  3. A rank-two matrix aligned with ±w⋆\pm\mathbf w^\star
  4. A full-rank matrix, since the target is nonlinear
Show the answer

B. There is none: c1=E[∣z∣ z]=0c_1=\E[\abs z\,z]=0, so the step carries no first-order information about w⋆\mathbf w^\star

The spike is proportional to c1c_1, the correlation of the label with ⟨w⋆,x⟩\langle\mathbf w^\star,\mathbf x\rangle, and an even link has c1=0c_1=0. The direction is carried by c2c_2, which a single step from a random start sees only at higher order; this is the information exponent k⋆=2k^\star=2 at work.

Staircases, leaps and parities

Targets that depend on several hidden coordinates can be learned in stages, if each stage leaves a clue for the next. On the Boolean cube {±1}d\{\pm1\}^d, the staircase f(x)=x1+x1x2+x1x2x3f(\mathbf x)=x_1+x_1x_2+x_1x_2x_3 can be found one coordinate at a time: x1x_1 correlates with the label directly, and once x1x_1 is known the term x1x2x_1x_2 points to x2x_2. The parity x1x2x3x_1x_2x_3 alone offers no such ladder: it is uncorrelated with every function of fewer than three of the coordinates.

Sparse parities sit at the hard end. With kk hidden bits among nn, every correlation of the label with fewer than kk bits vanishes, and statistical-query lower bounds imply that gradient methods with noisy gradients need nΩ(k)n^{\Omega(k)} steps. Barak, Edelman, Goel, Kakade, Malach & Zhang (2022) found that SGD on small networks learns such parities after about nO(k)n^{O(k)} iterations, near that limit, and that the loss sits on a plateau and then drops abruptly. Underneath the plateau, progress is continuous: a Fourier gap in the population gradient steadily amplifies the weights on the relevant bits, which shows in the weights long before it shows in the loss. Hidden progress of this kind is one candidate explanation for abrupt learning curves such as grokking and some apparently emergent abilities.

Key takeaways

  • Kernel methods, including lazy networks, need about dℓd^\ell samples to fit degree-ℓ\ell polynomials in high dimension, even when the target depends on one direction; learning the direction is what feature learning buys.
  • For a single-index target the information exponent k⋆k^\star, the index of the first nonzero Hermite coefficient, sets the flatness of the loss at a random start. Online SGD needs about dd, dlog⁡dd\log d or dk⋆−1d^{k^\star-1} samples (sharp up to logarithms), almost all spent escaping the equator; smoothing reaches the CSQ limit dk⋆/2d^{k^\star/2}.
  • One gradient step at initialization adds a rank-one spike ∝c1 aw⋆⊤\propto c_1\,\mathbf a\mathbf w^{\star\top} to the first layer; with a large step it beats kernels, and gradient descent learns rr-index degree-pp targets with n≍d2r+drpn\asymp d^2r+dr^p samples against dpd^p for kernels.
  • The leap of a multi-index target governs SGD's cost, conjecturally Θ~(dmax⁡(L−1,1))\tilde\Theta(d^{\max(L-1,1)}) steps through saddle-to-saddle plateaus, proven in restricted settings. Sparse parities need nΘ(k)n^{\Theta(k)} steps, and SGD's progress on them is hidden beneath a flat loss.

Check yourself

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

Question 1

What is the information exponent of the link σ⋆(z)=z2−1\sigma^\star(z)=z^2-1, and what does it imply for online SGD in dimension dd?

  1. 11: about dd samples
  2. 22: about dlog⁡dd\log d samples
  3. 22: about d2d^2 samples
  4. 33: about d2d^2 samples
Show the answer

B. 22: about dlog⁡dd\log d samples

z2−1=He2(z)z^2-1=\mathrm{He}_2(z) is orthogonal to the constant and to zz, so c1=0c_1=0 and c2≠0c_2\ne0: k⋆=2k^\star=2. The threshold αc=log⁡d\alpha_c=\log d gives about dlog⁡dd\log d samples, up to logarithmic factors.

Question 2

On the Boolean cube, what is the leap of f(x)=x1x2+x1x2x3x4f(\mathbf x)=x_1x_2+x_1x_2x_3x_4?

  1. 11
  2. 44
  3. 22
  4. 66
Show the answer

C. 22

Take x1x2x_1x_2 first, adding two coordinates, then x1x2x3x4x_1x_2x_3x_4, adding two more: the largest jump is 22. No ordering does better, because the first term in any order adds at least two coordinates. By the conjecture, online SGD needs about dmax⁡(2−1,1)=dd^{\max(2-1,1)}=d steps, up to logarithms.

Question 3

A target in Rd\R^d is a degree-4 polynomial of r=2r=2 hidden directions. Roughly how many samples does a method in the kernel regime need, compared with gradient descent on a two-layer network as analyzed by Damian, Lee & Soltanolkotabi (2022)?

  1. Kernel about d4d^4; gradient descent about d2d^2
  2. Both about d2d^2
  3. Kernel about d2d^2; gradient descent about d4d^4
  4. Kernel about d8d^8; gradient descent about dd
Show the answer

A. Kernel about d4d^4; gradient descent about d2d^2

Kernel methods pay for the degree in the ambient dimension, n≍dp=d4n\asymp d^p=d^4, because they cannot exploit the hidden low-dimensional structure. Gradient descent learns the two relevant directions first: n≍d2r+drp=2d2+16dn\asymp d^2r+dr^p=2d^2+16d, dominated by d2d^2.

Further reading

  • G. Ben Arous, R. Gheissari & A. Jagannath, "Online stochastic gradient descent on non-convex losses from high-dimensional inference," Journal of Machine Learning Research 22(106), 1–51 (2021).
  • A. Damian, E. Nichani, R. Ge & J. D. Lee, "Smoothing the landscape boosts the signal for SGD: Optimal sample complexity for learning single index models," NeurIPS (2023).
  • J. Ba, M. A. Erdogdu, T. Suzuki, Z. Wang, D. Wu & G. Yang, "High-dimensional asymptotics of feature learning: How one gradient step improves the representation," NeurIPS (2022).
  • E. Abbe, E. Boix-Adserà & T. Misiakiewicz, "SGD learning on neural networks: leap complexity and saddle-to-saddle dynamics," COLT (2023).
  • B. Barak, B. L. Edelman, S. Goel, S. Kakade, E. Malach & C. Zhang, "Hidden progress in deep learning: SGD learns parities near the computational limit," NeurIPS (2022).