Maybe the class is smaller in practice than it looks on the map
label 3
label 8
label 1
label 0
label 4
label 0
6 of the 8,000 training images. Each is 784 pixel values, and every one must be mapped to its label.
HYPOTHESIS
Storing 8,000 separate image-to-label answers is too hard for this network. The only way it can fit the training data is to find patterns shared across many images, and shared patterns also work on new images.
If it is true
The huge class is not really a problem: in practice the network can only reach models that capture structure, so it lands in B.
A hypothesis is only useful if some experiment could prove it wrong.
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
All possible models
Fits the training data
Also fits the test data
Class: p = 100 hidden units
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
All possible models
Fits the training data
Also fits the test data
Class: p = 400 hidden units
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
All possible models
Fits the training data
Also fits the test data
Class: p = 1,000 hidden units
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
All possible models
Fits the training data
Also fits the test data
Class: p = 10,000 hidden units
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
All possible models
Fits the training data
Also fits the test data
Class: p = 100,000 hidden units
Hypothesis 2: maybe the classical picture is wrong
An experiment where we control the size of the class: one hidden layer, more and more hidden units
Each added hidden unit adds new functions the model can express: the chosen class grows to take in more of the space.
The model
The first layer is random and never trained. Only W is fit, exactly, by ordinary least squares (OLS): the optimal linear combination of the p hidden units.
Classical picture: training picks any model that fits. A bigger class holds more models that fit the training data but fail the test, so past some size test error only rises.
Hypothesis 2: the classical picture is wrong. Training does not pick arbitrarily, so test error could fall even as the class grows.
Test error (orange) and training error (blue) as the model grows
p = n
fewer hidden units than training digits
100%
75%
50%
25%
0%
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · training digits n = 1,000
classical best 17.0%
87.9% at p = n
p = 50 hidden units
train error 24.1%
test error 30.5%
The model: MLP, p hidden units
Training: only W, solved exactly
Ordinary least squares (OLS) finds the optimal linear combination of the p hidden units for the one-hot labels of n = 1,000 digits, in one step, no gradient descent. If many W fit perfectly, OLS returns the one with the smallest weights.
YOUR PREDICTION
What will happen to test error if we keep adding hidden units past p = n?
Real MNIST: 1,000 training and 2,000 test digits; p from 50 to 10,000
The classical picture: a U-curve
?
Test error (orange) and training error (blue) as the model grows
p = n
fewer hidden units than training digits
100%
75%
50%
25%
0%
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · training digits n = 1,000
classical best 17.0%
87.9% at p = n
p = 100 hidden units
train error 11.8%
test error 22.4%
The model: MLP, p hidden units
Training: only W, solved exactly
Ordinary least squares (OLS) finds the optimal linear combination of the p hidden units for the one-hot labels of n = 1,000 digits, in one step, no gradient descent. If many W fit perfectly, OLS returns the one with the smallest weights.
YOUR PREDICTION
What will happen to test error if we keep adding hidden units past p = n?
Real MNIST: 1,000 training and 2,000 test digits; p from 50 to 10,000
The classical picture: a U-curve
?
Test error (orange) and training error (blue) as the model grows
p = n
fewer hidden units than training digits
100%
75%
50%
25%
0%
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · training digits n = 1,000
classical best 17.0%
87.9% at p = n
p = 400 hidden units
train error 0.6%
test error 17.0%
The model: MLP, p hidden units
Training: only W, solved exactly
Ordinary least squares (OLS) finds the optimal linear combination of the p hidden units for the one-hot labels of n = 1,000 digits, in one step, no gradient descent. If many W fit perfectly, OLS returns the one with the smallest weights.
YOUR PREDICTION
What will happen to test error if we keep adding hidden units past p = n?
Real MNIST: 1,000 training and 2,000 test digits; p from 50 to 10,000
The classical picture: a U-curve
?
Test error (orange) and training error (blue) as the model grows
p = n
fewer hidden units than training digits
100%
75%
50%
25%
0%
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · training digits n = 1,000
classical best 17.0%
87.9% at p = n
p = 800 hidden units
train error 0.0%
test error 32.0%
The model: MLP, p hidden units
Training: only W, solved exactly
Ordinary least squares (OLS) finds the optimal linear combination of the p hidden units for the one-hot labels of n = 1,000 digits, in one step, no gradient descent. If many W fit perfectly, OLS returns the one with the smallest weights.
YOUR PREDICTION
What will happen to test error if we keep adding hidden units past p = n?
Real MNIST: 1,000 training and 2,000 test digits; p from 50 to 10,000
The classical picture: a U-curve
?
Test error (orange) and training error (blue) as the model grows
p = n
fewer hidden units than training digits
100%
75%
50%
25%
0%
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · training digits n = 1,000
classical best 17.0%
87.9% at p = n
p = 1,000 hidden units
train error 0.0%
test error 87.9%
The model: MLP, p hidden units
Training: only W, solved exactly
Ordinary least squares (OLS) finds the optimal linear combination of the p hidden units for the one-hot labels of n = 1,000 digits, in one step, no gradient descent. If many W fit perfectly, OLS returns the one with the smallest weights.
YOUR PREDICTION
What will happen to test error if we keep adding hidden units past p = n?
Real MNIST: 1,000 training and 2,000 test digits; p from 50 to 10,000
Two tests on the same residual MLP: take weight decay away, then turn it up tenfold
TAKE IT AWAY · TRUE LABELS
If regularization made it generalize, removing it should hurt
96.1%
test, weight decay on
96.3%
test, weight decay off
No loss at all. It generalizes without it.
TURN IT UP 10× · RANDOM LABELS
If regularization prevented memorizing, noise should stop fitting
99.5%
train, random labels
10.8%
test (chance: 10%)
It still memorizes the noise.
At scale, the same holds for dropout and data augmentation: on CIFAR-10 and ImageNet they add a few points of test accuracy, but networks fit random labels with them on and generalize with them off.
Zhang et al. (2017): explicit regularization "is neither necessary nor by itself sufficient" for generalization.
The class allows bad fits. Past p = n, countless models fit the training data and fail the test.
No penalty asks for good ones. Taking away weight decay changed nothing.
Yet training keeps landing on them. Test error falls as the class grows.
“He intends only his own gain, and he is in this, as in many other cases, led by an invisible hand to promote an end which was no part of his intention.”
Adam Smith, The Wealth of Nations (1776), Book IV, Chapter 2
QUESTION
Each step of training only lowers the training loss. What is the invisible hand that steers it toward fits that generalize?
Implicit regularization in its clearest form: size (norm) of the fitted weights in the double descent experiment
p = n
1,000
100
10
1
50
100
400
1,000
3,000
10,000
hidden units p (log scale) · weight norm (log scale) · n = 1,000
1,041 at p = n
5.1
2.7
At p = n exactly one set of weights fits all 1,000 digits. To hit every point it must be huge: norm 1,041, test error 88%.
Past p = n infinitely many weight settings fit exactly. Starting from zero, a weight only grows or shrinks away from zero if that helps performance, so training ends at the smallest-weight fit.
More hidden units make an even smaller fit available: norm 2.7 at p = 10,000, smoother, and test error down to 8.2%.
No penalty term anywhere, yet gradient descent chooses. This is implicit regularization. Ridgeless least squares: Hastie et al. (2022); Bartlett et al. (2020).
Starting from zero, training prefers small-weight solutions. But what about a deep net with random initialization?
The same idea with gradient descent: 8,000 digits, 20% given a wrong label, each group tracked separately
100%
75%
50%
25%
0%
0
20
40
60
epoch
train, correctly labeled digits
train, wrongly labeled digits
test accuracy
Ring: best test accuracy, 92.6% at epoch 3. "Train" accuracy is against the labels the network was given.
Arpit et al. (2017); coherent gradients: Chatterjee (2020); GPT-3: Brown et al. (2020)
EPOCH 1 92% of correctly labeled digits fit, but only 2% of wrongly labeled ones: it predicts the true digit.
EPOCH 3 Test accuracy peaks at 92.6%. Stop here (early stopping) and the noise is never memorized.
EPOCH 60 Wrong labels memorized (99%); test falls to 81%.
Correctly labeled 7s all push the weights the same way, so their gradients add up. A mislabeled digit pushes alone.
Used at scale: large language models are typically trained for about one pass over their data, so most examples are seen once. GPT-3 saw its main web corpus 0.44 times.
Gradient descent follows loud, coherent gradients first. Stop early and the noise is never fit.
The class is huge, but training does not pick at random from the models that fit
All possible models
Fits the training data
Where training tends to land
Also fits the test data
Chosen class: deep net
your MLP
fits train, fails test
1
Many models fit. A deep net can fit the training data countless ways, even pure noise.
2
Training picks one. No penalty decides, so the procedure does: architecture, initialization, optimizer.
3
It picks a simple one. Linear case: the smallest weights. Deep nets: shared structure before noise (after epoch 1, 92% of correctly labeled digits fit vs 2% of mislabeled).
4
Simple fits tend to fit the test data too, when test digits come from the same distribution.
Still debated: optimizer or architecture? Full-batch gradient descent can match SGD (Geiping et al. 2022), and even randomly sampled networks that fit tend to generalize (Chiang et al. 2023).
BUT SIMPLE BY WHOSE STANDARD?
Nothing in this preference says a 7 moved three pixels is still a 7. Let's test it.
Generalization comes from which fit training picks, not how many fits the class contains.
MNIST was built so that position barely varies, in training and in testing
Average of 10,000 digits. Dashed: the central 20×20 box.
HOW MNIST WAS BUILT
Each digit was size-normalized to fit a 20×20 box, then centered by its center of mass in the 28×28 frame.
96.7%
of all ink lies inside the central 20×20 box
111
pixels are blank in every one of the 10,000 digits
Train and test digits put their ink in the same place. Whatever the model does with the edges of the frame is almost never trained and almost never tested.
A shifted 7 lands in territory the model has barely seen. What does it do there?
Flips are a standard augmentation for photos. Each training digit below, mirrored left to right:
a 7flipped
a 3flipped
a 4flipped
a 8flipped
QUESTION
Train every digit with its label, sometimes flipped. Is this augmentation appropriate?
Proposal: add random horizontal flips
?
Flips are a standard augmentation for photos. Each training digit below, mirrored left to right:
a 7not a 7
a 3not a 3
a 4not a 4
a 8still an 8
QUESTION
Train every digit with its label, sometimes flipped. Is this augmentation appropriate?
No. A flipped digit is not the same digit. A mirrored 3 is not a 3, and a mirrored 7 or 4 is no digit at all. Augmentation claims the label survives; here it does not. An 8 happens to survive, but one rule has to hold for every class.
Contrast: on CIFAR-10 a mirrored cat is still a cat and a mirrored truck still a truck, so flips are standard there.
A shifted, shrunken, slightly rotated 7 is still a 7, so the axes must be covered in combination
Axis
Settings
Count
Original
MNIST training set
60,000
× Shift (crop)
−3 to +3 px, each axis (7 × 7)
× 49
× Scale
0.8× to 1.2×, steps of 0.1
× 5
× Rotation
−15° to +15°, steps of 5° (small only: 180° turns a 6 into a 9)
× 7
Total
1,715 versions of every digit
1.0 × 10⁸
Combinations multiply, they don't add. Add 3 stroke widths and it is 3.1 × 10⁸. Sampling one random version per image each epoch avoids storing them, but the model still has to see enough of this space: many more epochs.
What else it costs
Capacity spent on copies. The MLP still stores each feature separately at every position, size and angle it was shown.
Only the range shown. Trained on ±3 px: 94% at 3 px, 60% at 6 px. Trained on 0.8–1.2×: 87% at 1.4×.
One axis at a time. Every invariance you name is another factor in the count.
Augmentation works, but it teaches by showing every case rather than knowing the rule.
Residual MLP on MNIST, CIFAR-10 and ImageNet: no convolutions, no extra data
ALLOWED
Data augmentation: it does not count as adding data. Expect it to be your biggest lever on CIFAR-10 and ImageNet.
TRY THIS WEEK
Run today's shift plot on your own MNIST model.
Compare train and test curves on CIFAR-10: is test error rising?
Add random crops and re-run both.
How far can MLPs go? Bachmann, Anagnostidis & Hofmann (NeurIPS 2023), "Scaling MLPs: A Tale of Inductive Bias": plain MLPs reach 95% on CIFAR-10, but only with large-scale pretraining and heavy augmentation, which this project rules out. Read it for how much compute it takes, not as a target.
On natural images, augmentation is how an MLP rules out solutions that should be systematically excluded.
"One prominent instance" of the class; occlusion and unusual viewpoints allowed
A photo containing the class, anywhere in the scene
CIFAR-10 labeling criteria: Krizhevsky (2009), Appendix C. "There is no canonical viewpoint or scale at which the objects appear": Hinton et al. (2012).
An MLP must learn each feature at every position and scale where it appears. That multiplies the data and capacity it needs, and it is the gap you are fighting in the project.
On natural images, the shift problem is not a stress test; it is the test set.