Sam Babichenko

Reading notes / Scaling laws

Explaining Neural Scaling Laws

Bahri et al., 2021

Context. Test loss of trained networks falls as a power law in dataset size DD and parameter count PP (Hestness et al., Kaplan et al.), but it was unknown what sets the exponents and whether the DD and PP exponents are related. This paper proposes two mechanisms, each acting in DD and in PP. Growing the resource that is already plentiful only averages out fluctuations, so the exponent is 1 for every architecture and dataset; growing the bottleneck resource lets the model resolve the data more finely, and the exponent is the decay rate of the kernel spectrum, which scales like 1/d1/d on a dd-dimensional data manifold.

Setting and the two regimes. L(D,P)L(D,P) is the average test loss and ww is width, with P∝w2P\propto w^2 in deep networks. In the variance-limited regime one resource is plentiful and the loss approaches its limit at rate 1/x1/x: L(D,P)−L(P)∝D−1L(D,P)-L(P)\propto D^{-1} for D≫PD\gg P, and L−L(D)∝w−1L-L(D)\propto w^{-1} for w≫Dw\gg D, which is P−1/2P^{-1/2} in deep networks and P−1P^{-1} in linear models. In the resolution-limited regime the other resource is the bottleneck, L∝D−αDL\propto D^{-\alpha_D} for P≫DP\gg D and L∝P−αPL\propto P^{-\alpha_P} for D≫PD\gg P, typically with 0<α<10\lt\alpha\lt1.

Theorem 1 (variance-limited). Let fTf_T be the network output after TT steps, random through initialization, training set and seed, ℓ(f)\ell(f) the test loss as a function of the output, and suppose E[(fT−EfT)k]=O(ϵ)\mathbb E[(f_T-\mathbb Ef_T)^k]=O(\epsilon) for all k≥2k\ge2. If ℓ\ell is a polynomial, has bounded second derivative, or is 2-Hölder, then E ℓ(fT)−ℓ(EfT)=O(ϵ)\mathbb E\,\ell(f_T)-\ell(\mathbb Ef_T)=O(\epsilon). MSE and cross-entropy fall under the second case.

Theorems 2 and 3 (resolution-limited bounds). Let the data lie on a compact dd-dimensional manifold, with target FF, model ff and loss Lipschitz with constants KF,Kf,KLK_F,K_f,K_L, and ℓ(F)=0\ell(F)=0. If f=Ff=F on DD i.i.d. training points, L(D)=O(KLmax⁡(Kf,KF)D−1/d)L(D)=O\big(K_L\max(K_f,K_F)D^{-1/d}\big); if f=Ff=F on PP i.i.d. points (a model whose PP parameters let it interpolate PP points of an unlimited training set), L(P)=O(P−1/d)L(P)=O(P^{-1/d}).

Linear random-feature model (exact). Teacher F(x)=∑M=1SωMFM(x)F(x)=\sum_{M=1}^S\omega_MF_M(x), ω∼N(0,I/S)\omega\sim N(0,I/S); student f(x)=∑μ=1Pθμfμ(x)f(x)=\sum_{\mu=1}^P\theta_\mu f_\mu(x) with fμ=∑MPμMFMf_\mu=\sum_M\mathcal P_{\mu M}F_M for a P×SP\times S projection P\mathcal P, trained from zero to the minimum-norm MSE optimum. With C=Ex[F(x)F(x)⊤]C=\mathbb E_x[F(x)F(x)^\top] and K(x,x′)=1SF(x)⊤F(x′)K(x,x')=\frac1SF(x)^\top F(x'), the two limiting losses are L(P)=12STr[C−CP⊤(PCP⊤)−1PC],L(D)=12 Ex[K(x,x)−K⃗(x)⊤Kˉ−1K⃗(x)],L(P)=\frac1{2S}\mathrm{Tr}\big[C-C\mathcal P^\top(\mathcal PC\mathcal P^\top)^{-1}\mathcal PC\big],\qquad L(D)=\frac12\,\mathbb E_x\big[K(x,x)-\vec K(x)^\top\bar K^{-1}\vec K(x)\big], where K⃗(x)\vec K(x) restricts one argument and Kˉ\bar K both arguments to the training points. For λi(C)=i−(1+αK)\lambda_i(C)=i^{-(1+\alpha_K)} both decay with exponent αK\alpha_K, so αD=αP=αK\alpha_D=\alpha_P=\alpha_K.

Step 1

Variance-limited scaling is a second-order Taylor effect. Expand the loss about the mean output, ℓ(fT)−ℓ(EfT)=ℓ′(EfT)(fT−EfT)+12ℓ′′(c)(fT−EfT)2;\ell(f_T)-\ell(\mathbb Ef_T)=\ell'(\mathbb Ef_T)(f_T-\mathbb Ef_T)+\tfrac12\ell''(c)(f_T-\mathbb Ef_T)^2; the linear term has mean zero, so the excess is the output variance times a bounded curvature. The supplement proves the variance is O(1/D)O(1/D) for GD and SGD on losses polynomial in the weights, for a step count TT that does not grow with DD: each step maps sample means to polynomials in sample means, whose centered moments are O(1/D)O(1/D).

Step 2

In the linear model the 1/D1/D and 1/P1/P corrections are explicit. Perturb the sample second moment, Cˉ=C+δC\bar C=C+\delta C with EδC=0\mathbb E\delta C=0 and fluctuations of order 1/D1/D, and expand the inverse in the exact loss: L(D,P)=L(P)+1D(quartic contraction)+O(D−2).L(D,P)=L(P)+\tfrac1D(\text{quartic contraction})+O(D^{-2}). The same expansion in δK\delta K, of order 1/P1/P over feature draws, gives the overparameterized case. For centered Gaussian features the coefficient has a closed form (our gloss): the part of the teacher outside the student's span is independent of the student features and acts as label noise, so L(D,P)−L(P)=L(P) P/(D−P−1)L(D,P)-L(P)=L(P)\,P/(D-P-1) (to leading order, the 1/(1−N/T)1/(1-N/T) inflation in the note on spectrum-dependent learning curves). The expansion fails as D→PD\to P, where Cˉ−1\bar C^{-1} blows up: that is the interpolation peak, and the reason the regime needs D≫PD\gg P.

Step 3

Resolution-limited bounds come from nearest-neighbor distances. On a dd-dimensional manifold a test point's nearest training point x^\hat x is at mean distance O(D−1/d)O(D^{-1/d}), and chaining the Lipschitz constants through f(x^)=F(x^)f(\hat x)=F(\hat x) turns that distance into a loss: ℓ(f(x))≤KL∣f(x)−F(x)∣≤KL(Kf+KF)∣x−x^∣.\ell(f(x))\le K_L|f(x)-F(x)|\le K_L(K_f+K_F)|x-\hat x|. Averaging gives Theorem 2; Theorem 3 reruns it with the PP points where the model matches the target. The sharper estimate expands the loss around x^\hat x, where it vanishes to order n≥2n\ge2, so the leading term is ∣x−x^∣n∝D−n/d|x-\hat x|^n\propto D^{-n/d}. With MSE and a model that interpolates linearly between training points, the error in ff is quadratic in the distance and MSE squares it, so n=4n=4 and α≈4/d\alpha\approx4/d. The bound needs only Lipschitz control; the estimate also assumes smoothness and that the trained model interpolates linearly.

Step 4

Both exact losses are residuals after a projection, which gives the duality. L(P)L(P) is the Schur complement of CC after a random rank-PP sketch P\mathcal P, the teacher variance that PP random combinations of its features miss. L(D)L(D) is the expected kriging variance of a Gaussian process with covariance KK after noiseless observations at the DD training points. The formulas exchange projecting on features with projecting on data points, and the kernel's integral operator under p(x)p(x) has the same nonzero eigenvalues as C/SC/S, so one spectrum governs both. The paper takes this as the reason αP=αD\alpha_P=\alpha_D.

Step 5

A power-law spectrum gives D−αKD^{-\alpha_K}. In the eigenbasis eie_i of CC, with eˉj\bar e_j the eigenvectors of the sample second moment, the overparameterized loss is (up to the 1/S1/S normalization) the population variance outside the span of the sample, L(D)=12∑iλi(1−∑j≤D(ei⋅eˉj)2).L(D)=\frac12\sum_i\lambda_i\Big(1-\sum_{j\le D}(e_i\cdot\bar e_j)^2\Big). For large αK\alpha_K the sample eigenvectors are close to the population ones, so the span is the top DD directions and L(D)∝∑i>Di−(1+αK)≈D−αK/αKL(D)\propto\sum_{i\gt D}i^{-(1+\alpha_K)}\approx D^{-\alpha_K}/\alpha_K. For general αK\alpha_K the paper plugs the spectrum into Canatar et al.'s ridgeless, noiseless learning curve, the κ\kappa equation of Bordelon et al., and finds κ∝D−αK\kappa\propto D^{-\alpha_K}, γ∝D0\gamma\propto D^0, L∝D−αKL\propto D^{-\alpha_K}. In Bordelon's notation an isotropic teacher puts power λi/S\lambda_i/S on mode ii, so b=a=1+αKb=a=1+\alpha_K and min⁡{a−1,2b}=αK\min\{a-1,2b\}=\alpha_K: the unlearned tail always dominates. L(P)L(P) follows by duality.

Step 6

Smoothness of the kernel ties the exponent to the manifold dimension. On the dd-torus, Kühn's bound λn≲n−(1+t/d)\lambda_n\lesssim n^{-(1+t/d)} for a CtC^t kernel is Fourier counting: a translation-invariant kernel's eigenvalues are its Fourier coefficients bnI≥0b_{n_I}\ge0, and CtC^t smoothness (tt even) keeps ∑I∣nI∣tbnI\sum_I|n_I|^tb_{n_I} finite; at most about N/2N/2 frequencies have ∣nI∣d≲N|n_I|^d\lesssim N, so at least half of the NN largest coefficients sit at ∣nI∣t≳Nt/d|n_I|^t\gtrsim N^{t/d}, and the NN-th largest eigenvalue is at most of order N−(1+t/d)N^{-(1+t/d)}. A feature covariance that is such a kernel on the data manifold and saturates the bound has αK=t/d\alpha_K=t/d, the spectral version of Step 3's n/dn/d estimate; saturation is an assumption.

Step 7

Measured exponents are near 1 in the variance-limited regime and track the data's intrinsic dimension in the resolution-limited one. Variance-limited exponents come out near 1 everywhere: αD\alpha_D from 0.98 to 1.11 for small networks on image datasets with D≫PD\gg P, and αW\alpha_W from 0.98 to 1.03 in width. Resolution-limited ones depend on the data: they follow 4/d4/d for teacher-student networks on a dd-dimensional cube, while on real data the relation to an estimated intrinsic dimension is, in the paper's words, less clear. For random ReLU features on pooled MNIST, αD\alpha_D and αP\alpha_P roughly track the fitted αK\alpha_K. Grouping CIFAR-100 into 5 to 100 superclasses leaves αD≈0.4\alpha_D\approx0.4, while Gaussian input noise lowers it from 0.58 to 0.29.

Consequences and limits. An exponent near 1 says only that the other resource is plentiful and the loss smooth; the informative exponents are the resolution-limited ones, set by the geometry of the inputs, as the superclassing and noise experiments suggest. Limits: the resolution-limited regime needs a strong hierarchy between PP and DD, and fits bend without it; the manifold dimension has no precise definition and is measured by proxies; the exact results are for linear models of fixed features, with no feature learning; and nothing is said about splitting compute between DD and PP.

Terms

Variance-limited
grow the plentiful resource (D≫PD\gg P or w≫Dw\gg D); L−L∞∝1/xL-L_\infty\propto1/x, exponent 1
Resolution-limited
grow the bottleneck resource; exponent set by the data and spectrum, typically 0<α<10\lt\alpha\lt1
P∝w2P\propto w^2
so αW=1\alpha_W=1 in width means L−L(D)∝P−1/2L-L(D)\propto P^{-1/2} for deep networks
Theorem 1
concentrated outputs plus a smooth loss give an excess loss of the order of the output variance
Nearest-neighbor distance
O(D−1/d)O(D^{-1/d}) on a dd-dimensional manifold; gives the D−1/dD^{-1/d} bound
α≈4/d\alpha\approx4/d
estimate for MSE with piecewise-linear interpolation: error in ff quadratic in distance, loss quartic
L(P)L(P)
12STr[C−CP⊤(PCP⊤)−1PC]\frac1{2S}\mathrm{Tr}[C-C\mathcal P^\top(\mathcal PC\mathcal P^\top)^{-1}\mathcal PC]: teacher variance outside a random rank-PP sketch
L(D)L(D)
12Ex[K(x,x)−K⃗⊤Kˉ−1K⃗]\frac12\mathbb E_x[K(x,x)-\vec K^\top\bar K^{-1}\vec K]: expected kriging variance after DD noiseless observations
λi=i−(1+αK)\lambda_i=i^{-(1+\alpha_K)}
power-law feature spectrum; gives αD=αP=αK\alpha_D=\alpha_P=\alpha_K in the linear model
CtC^t kernel bound
λn≲n−(1+t/d)\lambda_n\lesssim n^{-(1+t/d)}, so a saturating spectrum has αK=t/d\alpha_K=t/d

Quiz

  1. A model with P=103P=10^3 parameters is trained on D=107D=10^7 examples, and DD is doubled. What does the taxonomy predict?
  2. In the large-αK\alpha_K shortcut L(D)∝∑i>DλiL(D)\propto\sum_{i\gt D}\lambda_i, what is being assumed?
  3. Superclassing CIFAR-100 into fewer labels leaves αD\alpha_D unchanged, while Gaussian input noise lowers it. What does the paper read off?
  4. In Bordelon's notation (kernel decay bb, target power decay aa), why does the isotropic random-feature teacher give exponent αK\alpha_K?

Sources

  • Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining Neural Scaling Laws. Proceedings of the National Academy of Sciences, 2024.