Settings

Theme
Lite Mode (saves mobile data)

In Lite Mode, animations and videos don't play until you tap them, and their size is shown first. Interactive widgets still work.

Text size

Back up or move your progress →

Part 4: Neural Network Foundations

Modern generalization puzzles

P4.2440 min●●● AdvancedReviewed Dec 3, 2026

Why this matters for machine learning

Classical rules say a model with as many weights as training points will overfit, yet modern networks are far larger than that and still work. Knowing what is measured, and what is still unexplained, tells you how far the old rules of thumb can be trusted.

  • Reading a training run (training error at zero, validation error flat or rising) without panicking needs the difference between fitting the data and failing to generalize. (P4.22: The training recipe and debugging)
  • Choosing the width and depth of a network, and how much to regularize it, starts from knowing that bigger is not automatically worse. (P4.23: Hyperparameter tuning)
  • Scaling laws describe how test loss changes as models and data grow by orders of magnitude, far past the sizes where classical rules were tested. (P10.B3: Scaling laws, coming soon)
  • Weight decay, which helps a network start to generalize in the grokking experiments, is the regularizer of this part of the course. (P4.17: Regularization for neural nets)

Before this: Polynomial regression, underfitting and overfitting, The bias–variance trade-off, Universal approximation, Batch size and training dynamics, Regularization for neural nets

After this lesson you can

  • Explain with a random-label experiment why “the network can fit the training data” says nothing about whether it will generalize
  • Read a test-error curve against model size, locate the interpolation threshold at p≈Np\approx N, and say what changes on each side of it
  • Show that gradient descent from zero on an under-determined least-squares problem ends at the minimum-norm solution, and why that is called implicit regularization
  • Describe grokking and benign overfitting as reported in the papers, and separate what was measured from what is still only an explanation

A bridge-builder who has only five measurements cannot trust a design with five hundred free numbers. The classical rule of thumb says the same for models: one with as many free numbers as data points can match every point exactly, and so it has probably learned the noise (P3.A3). Modern neural networks break the rule every day. A network with millions of weights is trained on thousands of examples, reaches zero training error, and still does well on new examples.

This lesson is about that mismatch. It has no final answer, because there is none yet. It shows the experiments that sharpened the puzzle, a demonstration you can run yourself, and an honest list of what is still open.

The classical picture, in two lines

P3.A3 fitted polynomials of growing degree to N=10N=10 noisy points: training error falls all the way to 00 at degree 99 (10 weights for 10 points), and test error is U-shaped. P3.A5 explained the U: bias falls and variance rises as the model gets more flexible. A model that has just enough weights to pass through every training point, so that its number of weights pp equals NN, is at the right edge of the U, where variance is largest. The point where p≈Np\approx N and the model can just fit the training data exactly is called the interpolation threshold.

The features here are cosines, not the polynomials of P3.A3, so the numbers differ from P3.A3’s degree-9 numbers. The p=Np=N rise is the same phenomenon. The P3.A3 widget stopped at degree N−1N-1. The questions here begin on the other side of that edge: what happens to a model with pp larger than NN?

Puzzle 1: networks can memorize noise

If big networks generalize because their size is somehow “right”, then fitting anything should be hard. Zhang, Bengio, Hardt, Recht and Vinyals (ICLR 2017, posted 2016) tested it. They kept the images of standard benchmarks (CIFAR-10 and ImageNet) and replaced the labels with random ones, so that nothing in the images predicts the label. Standard convolutional networks trained with stochastic gradient methods still reached zero training error. Test accuracy, of course, could be no better than chance, because the test labels have no link to the images. The authors also report that this was qualitatively unaffected by explicit regularization, and that it also happens when the images are replaced by random noise. They add a construction showing that a simple two-layer ReLU network with 2N+d2N+d parameters can express any labeling of any sample of NN points in dd dimensions.

You can reproduce the idea at small scale in the first code cell below. The network has one hidden layer of 6464 tanh units. The training set has N=100N=100 points with d=10d=10 inputs, and it is trained with plain gradient descent on the log loss. The same network and the same training run are used twice, once on labels given by a simple rule (the sign of a fixed linear score) and once on random labels:

  • With the rule, training accuracy reaches 1.001.00 and accuracy on 2,0002{,}000 new points is 0.960.96.
  • With random labels, training accuracy also reaches 1.001.00 (within 500500 steps), and accuracy on 2,0002{,}000 new points is 0.500.50.

Only the first run has learned something. So fitting the training data is not evidence of generalization, and a bound that depends only on how flexible the model class is cannot be the whole explanation. On real data the same networks do generalize, so something about the data, the architecture and the training procedure matters, not just the size.

Puzzle 2: double descent

If a model can fit pure noise, the classical rule suggests that nothing good happens past the interpolation threshold. Belkin, Hsu, Ma and Mandal (PNAS, 2019) reported the opposite. In a family of models whose size they could vary smoothly, test error rose to a peak at the threshold and then fell again as the model grew, sometimes below the lowest error of the classical U. They called the full curve double descent: the first descent is the classical one, then the rise to the peak at the threshold, then the second descent.

Their main experiments used random Fourier features, which are a two-layer network with a fixed random first layer, and a rule for choosing among many exact fits: take the one whose weights have the smallest norm. They report a similar shape for two-layer neural networks and for some decision-tree ensembles.

A model you can sweep: minimum-norm regression

You can see the whole curve on a toy that runs in your browser. The task is the one of P3.A3: N=10N=10 training points with y=sin⁡(2πx)y=\sin(2\pi x) plus noise of size 0.30.3 (so the best possible squared error on new noisy data is 0.32=0.090.3^2=0.09). The model has pp weights on a list of fixed features of xx: a constant, then cos⁡(πjx)/j\cos(\pi j x)/\sqrt{j} for j=1,2,3,…j=1,2,3,\dots. A model with pp features uses the first pp of them, so p=1p=1 is a constant and a larger pp adds ever wigglier cosines. This is linear regression on made-up features (P3.A2, P3.A3).

  • For p<Np<N the training points cannot all be matched, and least squares gives the best compromise.
  • For p=Np=N there is exactly one weight vector that passes through every training point.
  • For p>Np>N infinitely many weight vectors pass through every point. We choose the one with the smallest norm ∥w∥\lVert\mathbf{w}\rVert, called the minimum-norm solution. It is computed with the pseudo-inverse of the SVD lesson (P1.B13), and the code does it with np.linalg.lstsq.
Noise
Penalty
00.20.40.60.81−2−1012xy

● training points (made up: a sine plus noise), — fitted curve, - - true curve.

p and N: 6 and 10
training error: 0.030
test error: 0.111
weight norm: 1.47

Fewer weights than points (6 < 10): the fit cannot reach every training point, the classical regime.

0.0010.010.1110100100011020304050number of features perror (log scale)p = N = 10

- - ● training error, — ■ test error, dotted line: p = N, blue line: current p. Tap the chart to pick p. Errors below 0.001 are drawn on the bottom line. Test error is the average squared miss from the true curve plus the noise variance (0.0900).

Test error against model size. Ten made-up training points (pink); the blue curve is the fit with p features, the dashed grey curve is the true pattern. The chart shows training error (dashed, pink) and test error (solid, green) for every p on a log scale, with p = N = 10 dotted and the current p in blue. Test error is the squared miss from the true curve plus the noise variance. Slide p, tap the chart, or change the noise and the penalty.

Things to try, with the numbers the widget shows for its default sample (noise 0.30, no penalty):

  1. Slide pp from 11 up to 66. The fit improves and test error falls from 0.600.60 at p=1p=1 to its lowest value before the threshold, 0.110.11 at p=6p=6 (the floor is 0.090.09). That is the classical descent.
  2. At p=9p=9 test error is 0.380.38. At p=10p=10 the curve passes through all ten points, its weights have norm 21.021.0, and test error is 67.767.7, hundreds of times the best. This is the peak.
  3. Keep going: p=11p=11 gives 4.084.08, p=15p=15 gives 0.210.21, p=20p=20 gives 0.150.15 and p=50p=50 gives 0.160.16, with the weight norm falling to 1.251.25. The training error is 00 throughout, and the test error is back near the classical best: the second descent.
  4. In the Noise row press none. The peak is gone: at p=10p=10 test error is 0.0020.002. The peak is made of noise in the training labels.
  5. Press small ridge in the Penalty row. A penalty of λ=0.01\lambda=0.01 on the squared weights lowers the peak at p=10p=10 from 67.767.7 to 0.240.24, at the price of a nonzero training error (about 0.0030.003 there).

The first code cell below prints these numbers.

Why the peak is at p=Np=N

At p=Np=N the 10×1010\times10 matrix of features has to be inverted to hit every point exactly, and it is nearly singular: its smallest singular value is 0.0080.008, against 0.1210.121 at p=9p=9, 0.0280.028 at p=11p=11 and 0.2610.261 at p=20p=20 (P1.B13). The solution contains each noise component of y\mathbf{y} divided by a singular value, so a tiny singular value blows the noise up: the weights are huge (21.021.0) and the curve swings wildly between the points. With more weights than points the system has slack, the matrix is less singular than at p=Np=N (0.0280.028 at p=11p=11, 0.2610.261 at p=20p=20), and the minimum-norm choice keeps the weights small (6.76.7 at p=11p=11, 1.21.2 at p=50p=50). In this toy the peak is a variance explosion at the one size where the model has no freedom left, and the second descent is the freedom coming back.

Two caveats about this demonstration, so you do not over-read it:

  • The height of the peak depends a great deal on the draw of the training points. Over 200200 random draws of the ten xx positions, the test error at p=10p=10 has a median of about 36,00036{,}000, and the values are spread over many orders of magnitude (about one draw in five is milder than the widget’s 67.767.7). The widget’s sample is therefore a mild one. At p=4p=4 the median is 0.160.16 and at p=50p=50 it is 0.220.22 (the second code cell). What is typical is the shape: a huge rise at p=Np=N and a fall after it.
  • The second descent depends on what the minimum-norm choice prefers, and that depends on how the features are scaled. A feature multiplied by 1010 needs a weight 1010 times smaller, so it is cheap in norm. With the scaling above, low-frequency cosines are the cheap ones, so the minimum-norm fit leans on them. With all features at the same scale, the same sweep gives test error 0.510.51 at p=50p=50, not 0.160.16. At p=Np=N the two give the same curve, since rescaling the columns of a square invertible matrix does not change the exact fit. Beyond NN, the scaling decides which exact fit is picked.

What the papers report for real networks

Nakkiran, Kaplun, Bansal, Yang, Barak and Sutskever (posted December 2019) looked for the same shape in deep learning. They report model-wise double descent for several datasets (CIFAR-10, CIFAR-100, IWSLT’14 translation), architectures (CNNs, ResNets, Transformers) and optimizers, with the peak occurring near the interpolation threshold, and that they see it most strongly when the training labels contain noise. They also report epoch-wise double descent (test error of a fixed large model falls, rises when training has just reached about zero training error, and falls again with longer training), and, in some settings, sample-wise non-monotonicity, where adding training data hurt (the threshold moves as the data grows). These are measured effects in the settings studied, not a rule that more data hurts. They define an “effective model complexity” (roughly, the largest number of training samples a training procedure can still fit) and conjecture that the peak appears when this complexity is about the number of training samples. For deep networks the threshold is therefore not simply “p=Np=N”: it depends on the data and on the training procedure too.

Implicit regularization: which exact fit does training pick?

A model with p>Np>N weights has many exact fits. In the toy we chose the one with the smallest norm. But you do not need to ask for it: gradient descent started at zero finds it by itself.

Take Φw=y\boldsymbol{\Phi}\mathbf{w}=\mathbf{y} with NN equations and p>Np>N unknowns. Gradient descent on 12∥Φw−y∥2\tfrac12\lVert\boldsymbol{\Phi}\mathbf{w}-\mathbf{y}\rVert^2 updates w\mathbf{w} by −η Φ⊤(Φw−y)-\eta\,\boldsymbol{\Phi}^\top(\boldsymbol{\Phi}\mathbf{w}-\mathbf{y}) (P1.F3). Every update is a combination of the rows of Φ\boldsymbol{\Phi}. Started at w=0\mathbf{w}=\mathbf{0}, w\mathbf{w} never leaves the span of those rows. With a full-rank matrix and a small enough step size it converges to an exact solution, and among all exact solutions there is only one inside that span: the one with the smallest norm. The third code cell checks it on a 5×205\times20 example: from zero, gradient descent ends within about 4⋅10−164\cdot10^{-16} of the pseudo-inverse solution (norm 0.5400.540). From a random start it also fits exactly, but ends 2.972.97 away (norm 3.0163.016), because the part of the start outside the span of the rows is never removed.

So the optimizer, its starting point and the parametrization make a choice that no line of the loss mentions. Such a built-in preference is called implicit regularization, as opposed to the explicit penalties of P3.A6 and P4.17. It is a theorem for this linear problem, and similar results exist for some other simple models. For the nonlinear networks used in practice it is an open research area, and no single preference such as “smallest norm” has been shown to explain what happens.

Noise in the updates is one proposed ingredient. P4.15 described the debate: Keskar and others (2016) reported that small batches reached flatter minima and better test accuracy, Goyal and others (2017) found that much of the gap closed with a scaled learning rate, and Shallue and others (2018) found no evidence that larger batches hurt when everything is tuned. In the grokking paper (below), noise helped generalization on small tasks, which the authors call consistent with flatter minima. Together this makes “SGD noise acts as a regularizer” a plausible hypothesis with mixed evidence, not an established rule.

Zhang and others (2017) conclude that explicit regularization may improve generalization but is, in their words, neither necessary nor by itself sufficient for controlling generalization error. Weight decay, dropout and early stopping (P4.17) remain standard tools, but they do not explain on their own why large networks generalize.

Puzzle 3: grokking

Power, Burda, Edwards, Babuschkin and Misra (posted January 2022) trained small transformers on tables of a binary operation, for example “a∘b mod 97a\circ b\bmod 97”: part of the table is used for training, and the model has to fill in the rest. In their headline experiment (division modulo 9797, half of the table used for training) training accuracy was close to perfect in under 10310^3 optimization steps, while it took close to 10610^6 steps for validation accuracy to reach that level, with little sign of generalization before 10510^5 steps. They called the late jump grokking. Weight decay (towards zero) had a very large effect: it more than halved the training data needed compared with most other interventions they tried. The model was a small decoder-only transformer (2 layers, width 128128), trained with AdamW at weight decay 11.

What does this show, and what does it not?

  • It shows that a flat validation curve at a point where training error is already zero is not always the end of the story, at least on small algorithmic tasks.
  • Follow-up work by Nanda, Chan, Lieberum, Smith and Steinhardt (2023) studied small transformers on modular addition. They report that the networks learn an algorithm based on trigonometry (discrete Fourier transforms), and that training splits into three phases: memorization, circuit formation, then cleanup of the memorizing parts. In that account grokking is gradual, not a sudden switch. One reading is that weight decay slowly favours the smaller, general solution, but that is an interpretation, not a settled explanation.
  • It does not show that training any model for much longer will make it generalize. The effect was found on small algorithmic datasets, and whether it matters at the scale of everyday deep learning is not established.

Benign overfitting

Bartlett, Long, Lugosi and Tsigler (PNAS, 2020) gave a name and a theory to benign overfitting in linear regression: a fit that matches noisy training data exactly and still predicts well. They say when the minimum-norm interpolating predictor is nearly optimal. Roughly: the data must have many directions that matter little for the prediction (measured by two notions of effective rank of the covariance), many more than the number of training points, so that the interpolated noise is spread thinly over directions that do not affect the predictions much. The result is a theorem about linear regression with conditions on the data. The toy of this lesson is not a test of it. For deep networks, no comparable result covers the networks used in practice.

What this means in practice

  • The classical picture still holds for models that are small compared with the data: the U-shaped curve and held-out validation (P3.A4) still decide how big they should be.
  • “Zero training error” is not a failure on its own. The signal of overfitting is the gap between training and validation results, as in P3.A3. Many large networks reach zero training error and still do well with the usual tools (P4.17, P4.18).
  • A bump in validation error as a model grows is not proof that larger models will be worse. If compute allows, look at a few sizes beyond it.
  • Keep the safe defaults (P4.22, P4.23): hold out data and watch the validation curve. These results describe particular settings, and your data may differ.

Open questions

These are open as of this lesson:

  • What makes the exact fit that a real network finds generalize, when other exact fits (such as the random-label ones) do not?
  • Does SGD noise, flat minima, or something else act as the main implicit regularizer in deep networks?
  • When does a double-descent peak appear, how high is it, and can it be predicted without training?
  • Why does generalization sometimes arrive long after the training error is zero, and does that happen outside small algorithmic tasks?

Depth: three ways to see it

Intuition

Think of a rope threaded through NN posts. With fewer bends than posts it cannot touch every post. With exactly as many bends as posts there is one way to touch them all, and if the posts are a little off (noise), the rope has to loop and whip to get there. With many more bends you can choose the gentlest rope that touches every post, and gradient descent from zero is like pulling a straight rope: it bends only where it must. The analogy breaks because no tidy “gentle” measure is known to be what real networks prefer, and because more bends cost nothing here while real models cost memory and compute.

Math

Let Φ\boldsymbol{\Phi} be the N×pN\times p matrix of features, y\mathbf{y} the targets, and Φ=UΣV⊤\boldsymbol{\Phi}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top its SVD (P1.B13) with singular values σi\sigma_i. For p>Np>N and full row rank, the minimum-norm interpolator is

w⋆=Φ⊤(ΦΦ⊤)−1y=Φ+y=∑i=1Nui⊤yσi vi.\begin{aligned} \mathbf{w}^\star&=\boldsymbol{\Phi}^\top(\boldsymbol{\Phi}\boldsymbol{\Phi}^\top)^{-1}\mathbf{y}=\boldsymbol{\Phi}^{+}\mathbf{y}\\ &=\sum_{i=1}^{N}\frac{\mathbf{u}_i^\top\mathbf{y}}{\sigma_i}\,\mathbf{v}_i . \end{aligned}

It lies in the row space of Φ\boldsymbol{\Phi}. Any other exact solution is w⋆+z\mathbf{w}^\star+\mathbf{z} with Φz=0\boldsymbol{\Phi}\mathbf{z}=\mathbf{0}, so z\mathbf{z} is orthogonal to the row space, and ∥w⋆+z∥2=∥w⋆∥2+∥z∥2\lVert\mathbf{w}^\star+\mathbf{z}\rVert^2=\lVert\mathbf{w}^\star\rVert^2+\lVert\mathbf{z}\rVert^2. That is why w⋆\mathbf{w}^\star has the smallest norm.

The sum shows the peak. If y\mathbf{y} contains noise, the term ii carries noise of size about 1/σi1/\sigma_i along vi\mathbf{v}_i. When the smallest singular value is tiny, as at p=Np=N with σmin⁡=0.008\sigma_{\min}=0.008 on the toy, the noise is amplified and ∥w∥\lVert\mathbf{w}\rVert is large.

A ridge penalty (P3.A6) replaces 1/σi1/\sigma_i by σi/(σi2+λ)\sigma_i/(\sigma_i^2+\lambda), which stays below 1/(2λ)1/(2\sqrt\lambda) whatever σi\sigma_i is and tends to 1/σi1/\sigma_i as λ→0\lambda\to0.

Gradient descent. If 0<η<2/σmax⁡20<\eta<2/\sigma_{\max}^2, the iterates from w0\mathbf{w}_0 converge to w⋆+(I−Φ+Φ)w0\mathbf{w}^\star+(\mathbf{I}-\boldsymbol{\Phi}^{+}\boldsymbol{\Phi})\mathbf{w}_0, so from w0=0\mathbf{w}_0=\mathbf{0} they reach w⋆\mathbf{w}^\star, and the part of a nonzero start that is orthogonal to the row space survives.

Code

The same experiment as the first code cell below, in PyTorch (nn.Sequential(nn.Linear(10, 64), nn.Tanh(), nn.Linear(64, 1)), plain SGD with learning rate 0.50.5, 15001500 steps, 100100 training and 2,0002{,}000 test points). Output from a local run with PyTorch 2.9.1:

true rule     train 1.00, test 0.96
random labels train 1.00, test 0.52

With random labels, test accuracy near 0.50.5 is chance, as it has to be for labels that carry no pattern.

Try it in Python

The cells run the random-label experiment, print the widget’s numbers with the medians over many draws, and check that gradient descent from zero reaches the minimum-norm solution.

Fitting random labels

Runs real Python in your browser. First run downloads about 9 MB (once; your browser keeps it).

Running the cell gives, for the rule, training accuracy 1.001.00 from step 100100 on and test accuracy 0.960.96. For random labels, training accuracy is 0.920.92 at step 100100 and 1.001.00 from step 500500 on, and test accuracy is 0.500.50.

Double descent with minimum-norm fits

Runs real Python in your browser. First run downloads about 9 MB (once; your browser keeps it).

The cell prints the table behind the widget (test error 67.7267.72 at p=10p=10, 0.160.16 at p=50p=50), the ridge column, the smallest singular values and the medians over 200200 draws (0.160.16, about 36,00036{,}000 and 0.220.22; the large value is not stable between machines and seeds). Change sigma to 0 to see the peak vanish, and a to 0.0 to see the second descent weaken.

Gradient descent finds the minimum-norm solution

Runs real Python in your browser. First run downloads about 9 MB (once; your browser keeps it).

The cell prints a fit error near 10−1510^{-15} for all three solutions, a distance of about 10−1610^{-16} between the gradient-descent result and the minimum-norm solution (norm 0.5400.540), and norm 3.0163.016 (distance 2.972.97) for the run from a random start. The other exact solution has norm 2.9772.977. The exact digits of the tiny errors depend on the machine.

Common mistakes

Quiz

Check your understanding

  1. A network is trained on images whose labels were replaced by random ones, and reaches 100%100\% training accuracy. What does this show?

  2. In the toy task of this lesson, at which model size does the test error peak, and why?

  3. Gradient descent on an under-determined least-squares problem (more unknowns than equations) is started from w=0\mathbf{w}=\mathbf{0} and converges. Which solution does it reach?

  4. Which statement about grokking is supported by the papers described in this lesson?

  5. You sweep the width of a network and see validation error rise as width passes the point where training error first reaches zero. What does this lesson support doing?

Exercises

  1. A model has pp weights and is trained on N=1,000N=1{,}000 points with a squared loss. Where is the interpolation threshold, and what does the model-wise double-descent picture say about p=100p=100, p=1,000p=1{,}000 and p=20,000p=20{,}000 (for a setting where it applies)?
    Show answerThe threshold is at p≈N=1,000p\approx N=1{,}000. At p=100p=100 the model is in the classical regime (it cannot fit every point, and test error follows the U-shaped curve). At p=1,000p=1{,}000 the model can just fit the data and test error is expected to be at or near its peak, especially with noisy labels. At p=20,000p=20{,}000 it is far into the interpolating regime, where test error often falls again. That is an observation in some settings, not a guarantee, and held-out data is still needed to know.
  2. One equation, two unknowns: 3w1+4w2=253w_1+4w_2=25. Find the minimum-norm solution and its norm, and compare it with the solution (25/3, 0)(25/3,\,0).
    Show answerThe minimum-norm solution is w⋆=Φ⊤(ΦΦ⊤)−1y\mathbf{w}^\star=\boldsymbol{\Phi}^\top(\boldsymbol{\Phi}\boldsymbol{\Phi}^\top)^{-1}y with Φ=(3, 4)\boldsymbol{\Phi}=(3,\,4): ΦΦ⊤=25\boldsymbol{\Phi}\boldsymbol{\Phi}^\top=25, so w⋆=(3,4)⋅25/25=(3,4)\mathbf{w}^\star=(3,4)\cdot25/25=(3,4). Check: 3⋅3+4⋅4=253\cdot3+4\cdot4=25. Its norm is 55. The solution (25/3,0)=(8.33,0)(25/3,0)=(8.33,0) also satisfies the equation but has norm 8.338.33. Gradient descent from (0,0)(0,0) moves along (3,4)(3,4), so it ends at (3,4)(3,4).
  3. In the widget, keep noise 0.30 and no penalty and set p=10p=10 and then p=50p=50. Then press none in the Noise row and set p=10p=10. What are the three test errors, and what does the comparison tell you?
    Show answerAbout 67.767.7 at p=10p=10 and 0.1630.163 at p=50p=50 with noise 0.30, and 0.0020.002 at p=10p=10 with no noise. Both models fit the ten training points exactly. The peak needs noise in the labels, so it is the noise being amplified by the nearly singular matrix that causes it, and with more weights than points the minimum-norm choice does not amplify it.
  4. In the random-label code cell, why is the test accuracy 0.500.50 and not, say, 0.900.90 after training for much longer?
    Show answerThe test labels were drawn independently of the test inputs, so no function of the inputs can predict them better than chance, whatever the network learned. The expected accuracy is 0.50.5 for every model, and the observed 0.500.50 is that value. The same network on labels given by a rule reached 0.960.96.

Next: This is the last lesson of Part 4. Part 5 starts with P5.1, Images as tensors: how a picture becomes numbers a network can read, as the first step towards convolutional networks.

Key takeaways

  • The classical picture (P3.A3, P3.A5) says test error is U-shaped in model size and that a model that fits every training point has gone too far. Large networks fit their training data exactly and often still generalize.
  • Networks trained on random labels reach zero training error (Zhang and others, 2017), with chance test accuracy. So the ability to fit does not explain generalization.
  • In double descent, test error rises to a peak where the number of weights pp is about the number of training points NN and falls again beyond it. On the toy task of this lesson the peak sits at p=N=10p=N=10 and nearly disappears with a small ridge penalty or without label noise.
  • Among the many weight vectors that fit the training data exactly, gradient descent started at zero finds the one with the smallest norm. Such a built-in preference is implicit regularization. For real networks it is only partly understood.
  • Grokking (Power and others, 2022): on small algorithmic tasks validation accuracy can jump long after training accuracy reached 100%. It is a measured effect with several proposed explanations, none settled. These results do not remove the need for held-out data.
Found a mistake? Tell us