Search

Search papers and lessons

Reconciling Modern Machine-Learning Practice and the Bias-Variance Trade-Off

Mikhail Belkin, Daniel Hsu, Siyuan Ma et al. · 2018

Belkin and colleagues show that test error can fall, rise, then fall again as a model gets bigger, so very large models that fit training data exactly can still generalise.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Linear algebra
  • Probability
  • Learning basics
  • Losses & regularization
  • ReadReady to readNot yet

TL;DR

Belkin, Hsu, Ma and Mandal argue that the textbook U-shaped curve of test error against model size is only half the story. Past the point where a model can fit its training data exactly, test error can fall a second time. They show this for random features, neural networks, random forests and boosted trees on several real datasets. The result reconciles the classical bias-variance picture with the large models used in practice.

Builds on: Bias-Variance Tradeoff, Overfitting, Gradient Descent · Leads to: Double Descent, the concept this paper named (see its lesson for the general picture)

Why it mattered

Deep learning practice had already drifted away from textbook advice. Practitioners made networks much larger than their datasets and trained them until the training error was zero, then found that test accuracy was good. Textbooks said that a zero-training-error model is overfit and will generalise poorly. The paper gave a precise curve that explains both facts, and it made the "interpolation threshold" a named object for later theory. The paper is widely cited, and the phrase "double descent" is now standard in machine learning.

It also gave practitioners a concrete reason to stop treating model size as a dial that must be tuned to a sweet spot. A bigger model past the threshold can be the better choice, because its best predictor is the smallest-norm function that fits the data, and that function can generalise well.

The problem

Machine learning chooses a predictor hnh_n from a function class H\mathcal{H} by empirical risk minimisation: pick the hh with the lowest average loss on the nn training examples. The goal is low true risk, the expected loss on new data. The classical bias-variance argument says that a small class under-fits, and a large class over-fits spurious patterns, so the best size sits between them. That gives a U-shaped test-risk curve.

Modern practice breaks the argument in two ways. First, very rich models such as neural networks are trained to interpolate, meaning they reach zero training error. The classical argument predicts poor test error for such models, but they often perform well. Second, the paper points to earlier evidence that heavily fitted models can still generalise. The paper's question is what shape the test-risk curve has once the model is allowed to pass the point where it can fit the data exactly.

How it works

The paper's main experiment uses random Fourier features on MNIST. Here is the pipeline, for one dataset of nn labelled digits.

  1. Choose the number of features NN. A random Fourier feature model maps an input xx to NN fixed random features, then fits a linear combination of them. The model's capacity is the number of parameters, which here is set by NN.
  2. Fit the coefficients. For each NN the coefficients are chosen to minimise the squared training error. When NN is below nn, the fit cannot match all the training points exactly.
  3. Measure training and test error. Record both on held-out data. For small NN the two curves track each other, and adding features helps both.
  4. Reach the interpolation threshold at N=nN = n. Now there are as many features as points, so the training fit is exact, and the test error peaks. The paper calls this the interpolation threshold, and the peak is where the classical over-fitting appears.
  5. Go beyond the threshold, N>nN \gt n. Training error stays at zero, but test error falls again. The model with the fewest parameters that interpolates (at N=nN = n) is the least accurate, and adding features past nn can bring test error below the bottom of the U.
  6. Read off the cause. The paper tracks the norm of the coefficients. The norm peaks at the threshold and then falls as NN grows. Among the interpolating predictors, the one with smallest norm generalises best, and more features let the model get closer to it.
flowchart LR
  A["Small N: under-fit, U-shaped test risk"] --> B["N equals n: interpolation threshold, test risk peaks"]
  B --> C["N above n: zero training risk, norm falls"]
  C --> D["Second descent: test risk falls"]
Example
Example 1: counting parameters at the threshold

A rough rule is that interpolation needs about as many parameters as training values. Check it on a one-hidden-layer network with d=2d = 2 inputs and K=1K = 1 output. The parameter count is (d+1)H+(H+1)K(d+1)H + (H+1)K: each hidden unit has dd weights and a bias, and each output has HH weights and a bias.

  1. With HH hidden units, the count is (2+1)H+(H+1)×1=4H+1(2+1)H + (H+1) \times 1 = 4H + 1.
  2. Take n=9n = 9 training points. We need at least 9 parameters to interpolate.
  3. Try H=1H = 1: 4×1+1=54 \times 1 + 1 = 5 parameters, which is fewer than 9, so this network cannot fit all points exactly.
  4. Try H=2H = 2: 4×2+1=94 \times 2 + 1 = 9 parameters, which equals 9. This is the interpolation threshold.

The model crosses from under-fitting to interpolating exactly when its parameters reach the number of training values.

Example
Example 2: the second descent, with three features and two points

Use the features 11, xx and x2x^2, and the two training points (0,0)(0, 0) and (1,1)(1, 1). The number of features N=3N = 3 is greater than n=2n = 2, so the model is past the threshold.

  1. Write the predictor as h(x)=c0+c1x+c2x2h(x) = c_0 + c_1 x + c_2 x^2.
  2. Interpolation at x=0x = 0 gives c0=0c_0 = 0.
  3. Interpolation at x=1x = 1 gives c0+c1+c2=1c_0 + c_1 + c_2 = 1, so c1+c2=1c_1 + c_2 = 1.
  4. Many choices of c1c_1 and c2c_2 satisfy step 3. Take the one with smallest coefficient norm, c12+c22c_1^2 + c_2^2. Setting c2=1−c1c_2 = 1 - c_1 and minimising gives c1=c2=0.5c_1 = c_2 = 0.5.
  5. The norm squared is 0.25+0.25=0.50.25 + 0.25 = 0.5. The predictor is h(x)=0.5x+0.5x2h(x) = 0.5x + 0.5x^2, which fits both points and has the smallest norm among interpolants.

The model has many interpolating solutions, and the smallest-norm one is a sensible choice. This is the inductive bias the paper points to.

Example
Example 3: a realistic count, from the paper's ImageNet argument

A network that interpolates a large multi-class dataset needs very many parameters, because each class adds an output and the requirement multiplies. Take ImageNet as a round example, with about 10610^6 examples and about 10310^3 classes.

  1. A single-output problem needs about as many parameters as examples, so about 10610^6.
  2. Each class adds an output, so the requirement multiplies by 10310^3.
  3. The estimate is 106×103=10910^6 \times 10^3 = 10^9 parameters, which is why interpolation is a regime that only very large models reach.

Try it: CIFAR-10 has 5×1045 \times 10^4 training examples and 10 classes. Estimate the number of parameters needed to interpolate, using the same rule. Answer: 5×104×10=5×1055 \times 10^4 \times 10 = 5 \times 10^5, or 500,000 parameters.

The math

Let hnh_n be the predictor learned from nn examples, and let ℓ\ell be the loss. The training risk is 1n∑i=1nℓ(hn(xi),yi)\frac{1}{n}\sum_{i=1}^{n} \ell(h_n(x_i), y_i) and the true risk is E(x,y)∼P[ℓ(hn(x),y)]\mathbb{E}_{(x,y) \sim P}[\ell(h_n(x), y)]. A model is in the interpolating regime if its training risk is zero. The paper's curve plots the true risk against the size of the function class.

For random Fourier features with NN features, the predictor is a linear combination of fixed random functions, so fitting is linear regression on an n×Nn \times N feature matrix Φ\Phi. The least-squares solution is the coefficient vector a\mathbf{a} that minimises ∥Φa−y∥2\lVert \Phi \mathbf{a} - \mathbf{y} \rVert^2.

Step 2 in symbols

When N<nN \lt n, the system has more equations than unknowns, and the least-squares solution generally leaves a nonzero residual. When N>nN \gt n, the system has more unknowns than equations, and it has many exact solutions. Among them, the minimum-norm solution is

a⋆=Φ+y,\mathbf{a}^\star = \Phi^{+}\mathbf{y},

where Φ+\Phi^{+} is the Moore-Penrose pseudoinverse. This is the interpolant with the smallest coefficient norm ∥a∥\lVert \mathbf{a} \rVert. Example 2 finds the same solution by hand.

Step 4 in symbols

At N=nN = n the matrix Φ\Phi is square. When it is invertible, the solution is unique, a=Φ−1y\mathbf{a} = \Phi^{-1}\mathbf{y}. A square matrix can be badly conditioned, so the coefficient norm is large there, which is the paper's explanation for the peak. The paper's observation that the norm peaks at N=nN = n matches this.

Step 6 in symbols

Let aN\mathbf{a}_N be the minimum-norm coefficient vector with NN features. The paper reports that ∥aN∥\lVert \mathbf{a}_N \rVert is largest at N=nN = n and falls for N>nN \gt n. As the number of features grows, the predictor approaches the minimum-norm interpolant in the kernel's function space.

Results

The paper reports double descent in several model families and datasets.

The main experiment is random Fourier features on a digit dataset. For small numbers of features the test error has the classical U-shape. It peaks when the number of features equals the number of training points, and it falls again beyond that point. The paper reports the same kind of curve for fully connected networks, where the threshold is where the parameter count reaches the number of training values, and for random forests and boosted trees, where the threshold is reached as the ensemble or tree size grows. Read the paper's figures for the exact curves and sizes rather than trusting numbers given here.

Limits. The paper is largely empirical. Its theory is limited to a simplified setting and to the minimum-norm interpolant, and it does not give a general theorem for deep networks. The threshold location depends on the number of training points and on the model family, so it should be measured for each setting.

Common misreadings. It is tempting to think that a model with zero training error must generalise poorly. In fact the paper shows that zero training error can coincide with good test error, when the interpolant is the smallest-norm one. It is tempting to think that bigger is always better. In fact test error peaks at the threshold, so a model of exactly the threshold size can be the worst choice. It is tempting to think double descent applies only to neural networks. In fact the paper reports it for random features, forests and boosted trees too.

Tradeoffs. Bigger models past the threshold cost more compute to train. Early stopping, regularisation and explicit norm control can avoid the peak without going past the threshold, and the paper does not claim that interpolation is always the best strategy. The choice depends on how much data is available and how much noise the labels have.

Reading guide

The chain of ideas is: the bias-variance curve, the interpolation threshold, the minimum-norm interpolant, and the second descent. Read the paper in this order.

Check yourself

QuestionIn the classical U-shaped curve, why does test error rise as the model becomes very large?Show answer

A very large model has enough freedom to fit spurious patterns in the training data, so its predictions vary with the particular sample. That variance raises test error. The classical view says the best model sits at the bottom of the U, where the bias and variance balance.

QuestionA network with d=3d = 3 inputs and K=2K = 2 outputs has HH hidden units. Using the paper's count (d+1)H+(H+1)K(d+1)H + (H+1)K, how many parameters does it have when H=4H = 4?Show answer

Compute (3+1)×4+(4+1)×2=16+10=26(3+1) \times 4 + (4+1) \times 2 = 16 + 10 = 26. The network has 26 parameters.

QuestionWhy does the minimum-norm interpolant often generalise better than other interpolating solutions?Show answer

Among all functions that fit the training data exactly, the minimum-norm one changes the least in directions the data does not constrain. Its extra structure is as small as possible, so it is less likely to fit spurious patterns. Example 2 shows this: the smallest-norm choice among the interpolants is the simplest function that matches the data.

QuestionA team picks a model with exactly as many parameters as training values, and their test error is worse than a model with ten times as many parameters. Is this surprising, given the paper?Show answer

It is consistent with the paper. The test error peaks at the interpolation threshold, which is where parameters equal training values. A model far past the threshold can have lower test error than one at the threshold, so the team should compare models on either side of the peak, not only at the threshold.

QuestionA colleague says that because the paper shows zero training error can be fine, one should always train until the training error is zero. What is the flaw?Show answer

The paper shows that interpolation can coincide with good test error for certain model families and datasets, and it relies on the minimum-norm solution. It does not say that every interpolating model generalises well, and it reports that test error peaks at the threshold. Interpolation is one regime to consider, and the training method and data also matter.

Sources

Read the full paper

Mikhail Belkin, Daniel Hsu, Siyuan Ma et al., 2018. arXiv:1812.11118