Simple Algorithm
Machine Learning · Convergence · 28 min

Double Descent

Test error that falls, rises and falls again as models grow.

The test-error peak at the interpolation threshold is not folklore: for least squares it can be computed exactly, sample by sample. This lesson derives those curves, shows what moves the peak and what removes it, follows the phenomenon into random-features models and deep networks, and separates the robust lessons from artifacts of how complexity is counted.

What you’ll learn

  • Recognize double descent in model size, in training time and in sample size, and explain how "effective model complexity" is meant to place all three on a single axis.
  • Compute, for every finite nn, the expected test error of a least-squares learner that sees only pp of DD Gaussian features, whether pp is below or above nn.
  • State the proportional asymptotics for isotropic and random-features models, and explain why small singular values drive the peak.
  • Prove that optimally tuned ridge regression is monotone in the sample size for isotropic Gaussian data, and say where such monotonicity fails.

Three faces of the same curve

Nakkiran, Kaplun, Bansal, Yang, Barak & Sutskever (2020) trained ResNets, CNNs and transformers on image and translation tasks and found double descent along three axes: model-wise, as width grows at a fixed training time; epoch-wise, as a fixed model trains longer; and sample-wise, where adding training data to a fixed model can increase test error (developed in Learning Curves & Sample Size). Label noise made the peaks larger. To put the three on one axis they proposed a measure of the capacity of a whole training procedure, data and optimizer included.

The hypothesis is informal by the authors' own account: there is no principled choice of ε\varepsilon (they used 0.10.1), and "well below" and "well above" are not quantified. One consequence they draw is that early stopping helps mainly in the narrow critical regime. The phenomenon is also older than its name. Loog, Viering, Mey, Krijthe & Tax (2020) point out that Vallet, Cailton & Refregier observed a peak in learning curves of the minimum-norm (pseudo-inverse) solution in 1989, that statistical physicists analyzed it around 1990, and that pattern-recognition work showed the same "peaking" in feature curves on real data, while the linear SVM showed none.

Check your understanding

Under the generalized double-descent hypothesis, when is early stopping most valuable?

  1. When the model is far too small to fit the training data
  2. When the training procedure's effective model complexity is close to the number of training examples
  3. When the model is enormous compared with the data
  4. Always equally, since longer training always overfits
Show the answer

B. When the training procedure's effective model complexity is close to the number of training examples

Training longer raises the EMC. Far below or far above nn, more effective complexity helps, so stopping early only throws away accuracy; near the critical value, more training can push the procedure onto the peak, and stopping before it pays off. This is epoch-wise double descent.

Exact curves: least squares with weak features

The cleanest exact model separates "how many features the learner uses" from "what the world depends on". Inputs x∼N(0,ID)\mathbf x\sim\mathcal N(\mathbf 0,I_D), responses y=x⊤β+σϵy=\mathbf x^\top\boldsymbol\beta+\sigma\epsilon with ϵ∼N(0,1)\epsilon\sim\mathcal N(0,1), and the learner fits only the coordinates in a set TT of size pp, by least squares when p<np<n and by the minimum-norm interpolant when p>np>n: β^T=XT+y\hat{\boldsymbol\beta}_T=X_T^+\mathbf y, β^Tc=0\hat{\boldsymbol\beta}_{T^c}=\mathbf 0.

DerivationProof
  1. E[(y−x⊤β^)2]=s2+E∥β^T−βT∥2\E\big[(y-\mathbf x^\top\hat{\boldsymbol\beta})^2\big]=s^2+\E\norm{\hat{\boldsymbol\beta}_T-\boldsymbol\beta_T}^2

    Unused features are noise. Write y=xT⊤βT+ξy=\mathbf x_T^\top\boldsymbol\beta_T+\xi with ξ=xTc⊤βTc+σϵ\xi=\mathbf x_{T^c}^\top\boldsymbol\beta_{T^c}+\sigma\epsilon. Independent Gaussian coordinates make ξ\xi independent of xT\mathbf x_T, with variance s2=∥βTc∥2+σ2s^2=\norm{\boldsymbol\beta_{T^c}}^2+\sigma^2. For an independent test point, the risk is that noise plus the parameter error:

  2. E∥β^T−βT∥2=s2 Etr⁡[(XT⊤XT)−1]=s2pn−p−1\E\norm{\hat{\boldsymbol\beta}_T-\boldsymbol\beta_T}^2=s^2\,\E\operatorname{tr}\big[(X_T^\top X_T)^{-1}\big]=s^2\frac p{n-p-1}

    Below the threshold. β^T−βT=(XT⊤XT)−1XT⊤ξ\hat{\boldsymbol\beta}_T-\boldsymbol\beta_T=(X_T^\top X_T)^{-1}X_T^\top\boldsymbol\xi, pure variance. The p×pp\times p matrix XT⊤XTX_T^\top X_T is Wishart with nn degrees of freedom; for p≤n−2p\le n-2 the standard inverse-Wishart mean E[(XT⊤XT)−1]=Ip/(n−p−1)\E[(X_T^\top X_T)^{-1}]=I_p/(n-p-1) gives

  3. E∥(I−Π)βT∥2=∥βT∥2(1−np),s2 Etr⁡[(XTXT⊤)−1]=s2np−n−1\E\norm{(I-\Pi)\boldsymbol\beta_T}^2=\norm{\boldsymbol\beta_T}^2\Big(1-\frac np\Big),\qquad s^2\,\E\operatorname{tr}\big[(X_TX_T^\top)^{-1}\big]=s^2\frac n{p-n-1}

    Above the threshold. Now the fit splits as β^T=ΠβT+XT+ξ\hat{\boldsymbol\beta}_T=\Pi\boldsymbol\beta_T+X_T^+\boldsymbol\xi, with Π\Pi the orthogonal projector onto the span of the nn training rows. Gaussian rows have a rotation-invariant law, so that span is a random nn-dimensional subspace with no preferred orientation, and on average it misses a fraction 1−n/p1-n/p of ∥βT∥2\norm{\boldsymbol\beta_T}^2. For the noise, use the inverse-Wishart mean of the n×nn\times n matrix XTXT⊤X_TX_T^\top, which has pp degrees of freedom:

  4. smin⁡(XT)≈∣p−n∣⟹∥XT+∥=1smin⁡(XT) large near p=ns_{\min}(X_T)\approx\abs{\sqrt p-\sqrt n}\quad\Longrightarrow\quad\norm{X_T^+}=\frac1{s_{\min}(X_T)}\ \text{large near }p=n

    At the threshold. The smallest nonzero singular value of an n×pn\times p Gaussian matrix is close to ∣p−n∣\abs{\sqrt p-\sqrt n}, so the norm of XT+X_T^+ explodes as p→np\to n and the expected variance is infinite for n−1≤p≤n+1n-1\le p\le n+1. The peak is noise amplified by near-singular directions, not bias.

Predict before you look

Take D=400D=400 features, n=40n=40 examples, ∥β∥2=1\norm{\boldsymbol\beta}^2=1 and σ2=0.1\sigma^2=0.1. The learner uses all features (T={1,…,D}T=\{1,\dots,D\}, so p=400p=400 and βTc=0\boldsymbol\beta_{T^c}=\mathbf 0). What is its expected test error? (Predicting zero scores ∥β∥2+σ2=1.1\norm{\boldsymbol\beta}^2+\sigma^2=1.1.)

Show the answer

1.011

∥β∥2(1−n/p)+σ2(1+n/(p−n−1))=0.9+0.1×(1+40/359)≈0.9+0.111=1.011\norm{\boldsymbol\beta}^2(1-n/p)+\sigma^2\big(1+n/(p-n-1)\big)=0.9+0.1\times(1+40/359)\approx0.9+0.111=1.011. It beats the null predictor although it interpolates noisy data with ten times more parameters than examples. Belkin, Hsu & Xu show that, when features are added in random order, the risk is smallest at p=Dp=D whenever ∥β∥2/σ2>D/(D−n−1)\norm{\boldsymbol\beta}^2/\sigma^2>D/(D-n-1), here 1.111.11: with signal spread thinly over many features, the biggest model wins.

Order matters. If the signal is concentrated in a few strong features that the learner adds first, the classical sweet spot below the threshold wins; if it is spread over many weak features, the curve's minimum can sit beyond the threshold. Both shapes are real, and neither is "the" double-descent curve.

Proportional asymptotics and random features

In the well-specified isotropic model, the shape depends on the signal-to-noise ratio SNR=r2/σ2\mathrm{SNR}=r^2/\sigma^2, compared with the null risk r2r^2 of predicting zero. Below the threshold, least squares beats the null predictor only for γ<SNR/(SNR+1)\gamma<\mathrm{SNR}/(\mathrm{SNR}+1). Above it, when SNR≤1\mathrm{SNR}\le1 the interpolant is always worse than predicting zero; when SNR>1\mathrm{SNR}>1 it is better for γ>SNR/(SNR−1)\gamma>\mathrm{SNR}/(\mathrm{SNR}-1) and has a local minimum at γ=SNR/(SNR−1)\gamma=\sqrt{\mathrm{SNR}}/(\sqrt{\mathrm{SNR}}-1) (Hastie et al., 2022). In the misspecified model, adding features also adds signal (κ\kappa grows with γ\gamma), which is how a global minimum beyond the threshold can arise.

Predict before you look

In the isotropic model with SNR=4\mathrm{SNR}=4, at which ratio γ=p/n\gamma=p/n does the overparameterized risk r2(1−1/γ)+σ2/(γ−1)r^2(1-1/\gamma)+\sigma^2/(\gamma-1) reach its local minimum?

Show the answer

2

Setting the derivative r2/γ2−σ2/(γ−1)2r^2/\gamma^2-\sigma^2/(\gamma-1)^2 to zero gives (γ−1)/γ=1/SNR(\gamma-1)/\gamma=1/\sqrt{\mathrm{SNR}}, so γ=SNR/(SNR−1)=2/1=2\gamma=\sqrt{\mathrm{SNR}}/(\sqrt{\mathrm{SNR}}-1)=2/1=2. With r2=4r^2=4, σ2=1\sigma^2=1 the risk there is 4×12+1=34\times\tfrac12+1=3, below the null risk 44; as γ→∞\gamma\to\infty it climbs back toward 44.

Random features. Mei & Montanari (2022) analyzed ridge regression on NN random features σ(wa⊤x)\sigma(\mathbf w_a^\top\mathbf x) of inputs on the sphere, a two-layer network with a frozen first layer, in the limit N,n,d→∞N,n,d\to\infty with N/dN/d and n/dn/d fixed. Unlike linear regression, where only the variance blows up, both bias and variance diverge at N=nN=n in the ridgeless limit, so the peak survives even without label noise. For fixed λ\lambda the test error is minimized as N/d→∞N/d\to\infty, optimal λ\lambda eliminates the peak, and above a critical signal-to-noise ratio the global optimum is attained by extremely overparameterized interpolators: an analytically tractable model in which the biggest model is best without any special misspecification.

Epoch-wise. Advani, Saxe & Sompolinsky (2020) solved the gradient-descent dynamics of linear networks with random-matrix theory: overtraining is worst when the effective number of parameters equals the number of samples, a subspace of the weights receives no gradient and stays frozen, and good generalization in the high-dimensional regime requires small initial weights.

Optimal regularization removes the peak

DerivationProof of sample-wise monotonicity
  1. R(β^n,λ)=E[∑i=1d∥β⋆∥2λ2/d+σ2γi2(γi2+λ)2]+σ2R(\hat{\boldsymbol\beta}_{n,\lambda})=\E\Big[\sum_{i=1}^d\frac{\norm{\boldsymbol\beta^\star}^2\lambda^2/d+\sigma^2\gamma_i^2}{(\gamma_i^2+\lambda)^2}\Big]+\sigma^2

    For isotropic test inputs, R(β^)=∥β^−β⋆∥2+σ2R(\hat{\boldsymbol\beta})=\norm{\hat{\boldsymbol\beta}-\boldsymbol\beta^\star}^2+\sigma^2. Write X=UΣV⊤X=U\Sigma V^\top with singular values γ1,…,γd\gamma_1,\dots,\gamma_d (padded with zeros when n<dn<d). The Gaussian design makes VV uniformly random and independent of the γi\gamma_i, so V⊤β⋆V^\top\boldsymbol\beta^\star is uniform on the sphere of radius ∥β⋆∥\norm{\boldsymbol\beta^\star} and each squared coordinate averages ∥β⋆∥2/d\norm{\boldsymbol\beta^\star}^2/d:

  2. λopt=dσ2∥β⋆∥2,R(β^nopt)=E[∑i=1dσ2γi2+dσ2/∥β⋆∥2]+σ2\lambda_{\mathrm{opt}}=\frac{d\sigma^2}{\norm{\boldsymbol\beta^\star}^2},\qquad R(\hat{\boldsymbol\beta}^{\mathrm{opt}}_n)=\E\Big[\sum_{i=1}^d\frac{\sigma^2}{\gamma_i^2+d\sigma^2/\norm{\boldsymbol\beta^\star}^2}\Big]+\sigma^2

    Each term, as a function of λ\lambda, has derivative proportional to λ∥β⋆∥2/d−σ2\lambda\norm{\boldsymbol\beta^\star}^2/d-\sigma^2, whatever γi\gamma_i is. So one λ\lambda minimizes every term at once, independent of nn, and the minimal term simplifies:

  3. γi(Xn+1)≥γi(Xn)  ∀i⟹R(β^n+1opt)≤R(β^nopt)\gamma_i\big(X_{n+1}\big)\ge\gamma_i\big(X_n\big)\ \ \forall i\quad\Longrightarrow\quad R(\hat{\boldsymbol\beta}^{\mathrm{opt}}_{n+1})\le R(\hat{\boldsymbol\beta}^{\mathrm{opt}}_n)

    Adding a training example adds a row to XX. By Cauchy interlacing, no singular value decreases, and each term above is decreasing in γi\gamma_i. Coupling the two designs row by row therefore gives the theorem.

Three caveats. The optimal λ\lambda depends on the unknown signal-to-noise ratio, so in practice it is chosen by cross-validation. The proof leans on isotropy: Nakkiran et al. construct non-Gaussian covariates with heteroscedastic noise for which even optimally tuned ridge is not sample-monotone, conjecture monotonicity for non-isotropic Gaussian covariates, and show that a regularizer adapted to the covariance restores it. And the same "bigger is never worse when tuned" message holds in the random-features asymptotics (Mei & Montanari, 2022).

Deep networks, and what the second descent means

In deep networks the peaks reported by Nakkiran et al. (2020) are most visible with label noise and little regularization, and Nakkiran, Venkat, Kakade & Ma (2021) showed empirically that optimally tuned ℓ2\ell_2 regularization can mitigate them in random-feature classifiers and convolutional networks. Curth, Jeffares & van der Schaar (2023) went further for classical methods (linear regression, trees, boosting): there the parameter count secretly grows along several complexity axes at once, the second descent appears exactly where the growth switches from one axis to another, not necessarily at p=np=n, and replotted against an effective number of parameters the curves fold back into the traditional convex shape. What every one of these analyses agrees on is negative but important: counting parameters does not measure how complex a fitted model really is.

Key takeaways

  • Test error can rise and fall again as the model grows, as training runs longer, or as data are added; Nakkiran et al. tie all three to the moment a training procedure can just fit nn examples (its effective model complexity).
  • With pp of DD Gaussian features, the exact risk is s2(1+p/(n−p−1))s^2(1+p/(n-p-1)) below the threshold and ∥βT∥2(1−n/p)+s2(1+n/(p−n−1))\norm{\boldsymbol\beta_T}^2(1-n/p)+s^2(1+n/(p-n-1)) above it, with s2=∥βTc∥2+σ2s^2=\norm{\boldsymbol\beta_{T^c}}^2+\sigma^2; the peak is noise amplified by 1/smin⁡(X)1/s_{\min}(X).
  • In proportional asymptotics the isotropic risk is σ2γ/(1−γ)\sigma^2\gamma/(1-\gamma) or r2(1−1/γ)+σ2/(γ−1)r^2(1-1/\gamma)+\sigma^2/(\gamma-1); misspecification and random features can put the global optimum far beyond the threshold, and in random features the bias diverges too.
  • Optimally tuned ridge, with λ=dσ2/∥β⋆∥2\lambda=d\sigma^2/\norm{\boldsymbol\beta^\star}^2, is monotone in nn (and in model size for random projections) for isotropic Gaussian data, but not for every distribution.
  • For trees, boosting and linear smoothers, the second descent can be an artifact of switching complexity axes (Curth et al., 2023): what survives every analysis is that parameter counts mismeasure complexity.

Check yourself

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

Question 1

In the weak-features model, n=50n=50, the learner uses p=60p=60 features with ∥βT∥2=1\norm{\boldsymbol\beta_T}^2=1, the unused features carry ∥βTc∥2=0.5\norm{\boldsymbol\beta_{T^c}}^2=0.5, and σ2=0.5\sigma^2=0.5. What is the expected test error?

  1. About 0.170.17
  2. About 1.171.17
  3. About 6.76.7
  4. Infinite
Show the answer

C. About 6.76.7

s2=0.5+0.5=1s^2=0.5+0.5=1, so the risk is 1×(1−50/60)+1×(1+50/9)≈0.17+6.56=6.721\times(1-50/60)+1\times(1+50/9)\approx0.17+6.56=6.72. Ten features past the threshold, the variance factor n/(p−n−1)=50/9n/(p-n-1)=50/9 still dominates.

Question 2

In ridgeless random-features regression (Mei & Montanari), what happens at the interpolation threshold N=nN=n that does not happen in isotropic linear regression?

  1. The bias also diverges, so the peak persists even without label noise
  2. The variance stays bounded
  3. The peak moves to N=2nN=2n
  4. Nothing: the two models behave identically
Show the answer

A. The bias also diverges, so the peak persists even without label noise

In linear regression the bias r2(1−1/γ)r^2(1-1/\gamma) stays bounded and the peak is pure noise amplification, so it disappears without noise. In the random-features model both bias and variance diverge at N=nN=n as λ→0\lambda\to0, which is why double descent appears even for noiseless targets.

Question 3

In the proof that optimally tuned ridge is sample-monotone for isotropic Gaussian data, what makes adding a training example harmless?

  1. More data always reduces the variance of any estimator
  2. The optimal λ\lambda shrinks to zero as nn grows
  3. Ridge ignores the new example
  4. The optimal λ=dσ2/∥β⋆∥2\lambda=d\sigma^2/\norm{\boldsymbol\beta^\star}^2 does not depend on nn, the optimal risk decreases in every singular value of XX, and adding a row can only increase them (Cauchy interlacing)
Show the answer

D. The optimal λ=dσ2/∥β⋆∥2\lambda=d\sigma^2/\norm{\boldsymbol\beta^\star}^2 does not depend on nn, the optimal risk decreases in every singular value of XX, and adding a row can only increase them (Cauchy interlacing)

With λ\lambda fixed at its nn-independent optimum, the risk is E∑iσ2/(γi2+dσ2/∥β⋆∥2)+σ2\E\sum_i\sigma^2/(\gamma_i^2+d\sigma^2/\norm{\boldsymbol\beta^\star}^2)+\sigma^2, a decreasing function of each γi\gamma_i, and interlacing gives γi(Xn+1)≥γi(Xn)\gamma_i(X_{n+1})\ge\gamma_i(X_n).

Further reading

  • P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak & I. Sutskever, "Deep double descent: where bigger models and more data hurt," International Conference on Learning Representations (2020).
  • M. Belkin, D. Hsu & J. Xu, "Two models of double descent for weak features," SIAM Journal on Mathematics of Data Science 2(4), 1167–1180 (2020).
  • T. Hastie, A. Montanari, S. Rosset & R. J. Tibshirani, "Surprises in high-dimensional ridgeless least squares interpolation," Annals of Statistics 50(2), 949–986 (2022).
  • S. Mei & A. Montanari, "The generalization error of random features regression: precise asymptotics and the double descent curve," Communications on Pure and Applied Mathematics 75(4), 667–766 (2022).
  • P. Nakkiran, P. Venkat, S. Kakade & T. Ma, "Optimal regularization can mitigate double descent," International Conference on Learning Representations (2021).