VerifiedarXiv:1611.0353034 min
Theory · Generalization

Understanding deep learning requires rethinking generalization

The same network that scores 89% on CIFAR10's test set reaches 100% training accuracy when every label is random.

Zhang, Bengio, Hardt, Recht and Vinyals replaced the labels of standard image datasets with random ones and trained the networks unchanged. The networks fit the random labels perfectly, so neither the size of the model family nor the regularizers used in training can be what makes the same networks generalize on real labels.

Explaining the paperUnderstanding deep learning requires rethinking generalizationZhang, Bengio, Hardt, Recht, Vinyals · MIT / Google Brain / Berkeley / DeepMind · ICLR 2017 · arXiv:1611.03530 ↗

One experiment on random labels, the three classical bounds it defeats, a short proof that a small network can fit any labeling, and a linear model where the optimizer's choice among perfect fits can be computed exactly.

Train a small Inception network with 1,649,402 parameters on CIFAR10's 50,000 training images and it classifies 100% of them correctly and 89.05% of the 10,000 test images. Training error 0%, test error 10.95%: the 10.95-point difference is the generalization gap. In 2016 the standard explanations for why that gap was small pointed at one of two things. Either the model family is restricted enough that fitting the training set forces a good function, or the regularizers (weight decay, dropout, data augmentation, early stopping) keep training inside a well-behaved part of the family.

The paper runs one experiment that both explanations fail. Replace every training label with a random class and train the same network the same way: it still reaches 100% training accuracy, and test accuracy drops to chance. The page follows the paper's order: the gap and the bounds meant to control it, the randomization test and its numbers, what the result rules out, the regularization ablations, a theorem that shows how few weights memorization needs, and a linear model in which the optimizer's role can be worked out by hand.

What the generalization gap is

Fix a dataset of nn labeled examples drawn from some distribution, a model family H\mathcal{H} (every function one architecture can compute, over all settings of its weights), and a training algorithm that returns one h∈Hh \in \mathcal{H}. Training error is the fraction of the nn examples that hh gets wrong. Test error is the fraction it gets wrong on fresh draws from the same distribution. The generalization gap is test error minus training error, and a theory of generalization is a way to bound it before seeing the test set.

Statistical learning theory offers two kinds of bound. Complexity measures describe the family. Vapnik–Chervonenkis (VC) dimension is the size of the largest set of points the family can label in every possible way; Rademacher complexity measures how well the family can correlate with random signs. Both give a bound of the form test error ≤\le training error plus a term that grows with the measure and shrinks as nn grows. Stability measures describe the algorithm instead: if replacing one training example barely changes the function the algorithm returns, the training error of that function cannot sit far from its test error. Neither kind of bound looks at the training labels. A complexity measure is a property of H\mathcal{H} and the inputs, a stability measure is a property of the algorithm, and both give the same number whether the labels are real or random.

The paper's CIFAR10 networks are a small Inception (1,649,402 parameters), a small Alexnet (1,387,786), and two multilayer perceptrons, MLP 3x512 (1,735,178) and MLP 1x512 (1,209,866). Every one has 24 to 35 times as many parameters as there are training images. Inputs are 28x28x3 center crops of the 32x32 images, so each input is a vector of d=2352d = 2352 numbers. Training is SGD with momentum 0.9 at a learning rate of 0.1 (Inception) or 0.01 (the others), multiplied by 0.95 after every epoch. On ImageNet the model is Inception V3 on 299x299 inputs, trained with asynchronous SGD on 50 workers over 1,281,167 training images in 1,000 classes.

How the randomization test works

The experiment borrows the randomization test from non-parametric statistics: replace the labels with draws that carry no information about the inputs, rerun the identical training, and compare. The paper uses six versions of the data. True labels. Partially corrupted labels, where each label is independently redrawn as a uniform random class with probability pp (the redraw can land on the original class). Random labels, the case p=1p = 1. Shuffled pixels, one fixed permutation of pixel positions applied to every image in the training and test sets. Random pixels, a different permutation for each image. Gaussian, where each image is replaced by noise with the dataset's mean and variance. Architecture, optimizer and learning-rate schedule stay as they were for true labels, with no new hyperparameter search. The random labels are drawn once and stay fixed across epochs, which is what the released code does:

# the randomization test, as the released code runs it
# (fitting-random-labels/cifar10_data.py, corrupt_labels)
np.random.seed(12345)                    # one fixed corruption per run
mask = np.random.rand(len(labels)) <= p  # each label is redrawn with prob p
labels[mask] = np.random.choice(10, mask.sum())  # uniform class, may repeat
# then train exactly as usual: same net, same SGD, same schedule
# CIFAR10, p = 1: 100% train accuracy, ~10% test accuracy (chance)

On CIFAR10 every architecture fits random labels: training accuracy is 100% for Inception, 100% for Inception without batch normalization, 99.82% for Alexnet, 100% for MLP 3x512 and 99.34% for MLP 1x512. Test accuracy is 9.78%, 10.12%, 9.86%, 10.48% and 10.61%, which is chance for ten classes. Each of those networks therefore stores 50,000 arbitrary answers, one per image, with nothing in the images to predict them from. On ImageNet, Inception V3 reaches 95.20% top-1 training accuracy (top-1: the highest-scoring class is the labeled one) on 1,281,167 images with random labels from 1,000 classes, and 0.11% top-1 test accuracy, again with no hyperparameter change; the authors expect a tuned run would reach 100%. Random pixels and Gaussian inputs are fit as well, and start converging sooner than random labels on real images. The paper's tentative explanation is that noise images sit farther apart from one another than natural images of the same class do, so separating them is easier.

Training on random labels follows the same pattern each time. For the first passes over the data the loss stays high: every label is unrelated to its image, so the gradients from different examples conflict. Because the random assignment is fixed, after a few passes the network starts separating images individually, and then the loss falls quickly to zero. The paper lists three observations: the learning-rate schedule did not need to change, convergence is fast once fitting starts, and the fit is perfect; overall, training takes longer by a small constant factor.

Figure 1 runs a scaled-down version of the test in the browser. A ReLU network (each hidden unit outputs max(0, its input)) with two hidden layers of 64 units (4,417 weights, about 44 per training point) trains with full-batch Adam on 100 points in a square, labeled by a wavy boundary. The slider sets pp; ringed points had their label redrawn, and because there are two classes, about half of the redrawn labels land on the wrong class. Test accuracy is measured on 400 clean points from the same boundary. Start with p=0p = 0: the map splits into two regions that follow the boundary in about 150 steps, with test accuracy between 95% and 97%. Then try p=1p = 1: the map breaks into islands around individual points, training accuracy still reaches 100%, after roughly a thousand steps, and test accuracy stays near 50%, chance for two classes.

Figure 1 · the randomization test, live
1.0
A 2-64-64-1 ReLU network fits 100 points whose labels are redrawn with probability p. Press Train and watch the decision map (teal / amber regions), the training accuracy, and the accuracy on 400 clean test points. Ringed points carry a redrawn label. At p = 1 training accuracy still reaches 100%, the map fragments, and test accuracy sits at chance.

Partly corrupted labels

Between true and random labels lies a continuum, and the paper sweeps it on CIFAR10. With ten classes a redrawn label lands on the original class one time in ten, so on average a fraction 0.9p0.9p of the training labels is wrong: 45% at p=0.5p = 0.5, 90% at p=1p = 1. At every pp the networks fit the corrupted training set perfectly. The paper's Figure 1b shows the time to convergence growing with pp, and Figure 1c shows the test error after convergence rising steadily toward 90%, chance on CIFAR10. Training error is zero throughout, so each test error in Figure 1c is also the generalization gap.

If the networks memorized whenever memorizing was possible, any corruption would push them to memorize everything and test error would jump to chance. Instead the network fits the clean labels through the pattern they share and fits the wrong ones individually, and test error grows with the number of wrong labels. The paper describes this as capturing "the remaining signal in the data" while fitting "the noisy part using brute-force".

Figure 2 runs that sweep on the toy from Figure 1. For each of eleven values of pp, the network trains until it gets every training label right. The left panel shows how many steps that took, on a log scale; the right panel shows the clean test error at that moment, next to the share of training labels that are wrong (5 of 100 at p=0.1p = 0.1, 30 at p=0.6p = 0.6, 49 at p=1p = 1). Look for two things. Test error rises with the wrong-label share, from about 3% at p=0p = 0 to about 50% at p=1p = 1, and stays within 12 points of that share at every pp. For the three recorded seeds the step count rises from about 130 at p=0p = 0 to between 660 and 1,070 at p=1p = 1. It is noisy from seed to seed: in this toy the slowest fits come at pp = 0.8 to 0.9, and some fresh seeds run out of the 6,000-step budget at high pp, short of a perfect fit, whereas in the paper's CIFAR10 sweep every network fit the corrupted training set perfectly at every pp.

Figure 2 · the paper's Figures 1b and 1c, on the toy
0.6
Each dot is one training run of the Figure 1 network at one corruption level; white dots are three recorded seeds, teal dots are seeds you train live with "Run another seed" (about 20 seconds per sweep). A cross marks a run that had not fit every label after 6,000 steps. The amber dashed line is the share of training labels that disagree with the true boundary; the pink line is chance. Drag "inspect p" to read one corruption level.

Why Rademacher, VC and stability bounds fail

The paper argues that the randomization result rules out VC dimension, Rademacher complexity and uniform stability as explanations, because each assigns the same value to the 89%-test run and the 10%-test run. Start with Rademacher complexity. The empirical Rademacher complexity of a family H\mathcal{H} on the training inputs x1,…,xnx_1, \dots, x_n is the paper's equation (1):

R^n(H)  =  Eσ[ sup⁡h∈H1n∑i=1nσi h(xi)],σ1,…,σn∈{±1} i.i.d. uniform\hat{\mathfrak{R}}_n(\mathcal{H}) \;=\; \mathbb{E}_{\sigma}\Big[\, \sup_{h \in \mathcal{H}} \frac{1}{n} \sum_{i=1}^{n} \sigma_i\, h(x_i) \Big], \qquad \sigma_1, \dots, \sigma_n \in \{\pm 1\} \text{ i.i.d. uniform}R^n(H)  =  Eσ[ sup⁡h∈H1n∑i=1nσi h(xi)],σ1,…,σn∈{±1} i.i.d. uniform\begin{gathered}\hat{\mathfrak{R}}_n(\mathcal{H}) \;=\; \mathbb{E}_{\sigma}\Big[\, \sup_{h \in \mathcal{H}} \frac{1}{n} \sum_{i=1}^{n} \sigma_i\, h(x_i) \Big], \\ \sigma_1, \dots, \sigma_n \in \{\pm 1\} \text{ i.i.d. uniform}\end{gathered}
(1)

Computing it takes four steps: draw a random sign σi\sigma_i for every training input, find the function in the family whose outputs agree best with those signs, record the average agreement 1n∑iσih(xi)\tfrac{1}{n}\sum_i \sigma_i h(x_i), and average that over many draws. For classifiers with outputs in {±1}\{\pm 1\}, each term σih(xi)\sigma_i h(x_i) is +1+1 for a match and −1-1 for a miss, so the value lies between 0 and 1. It enters a bound of the form

test error  ≤  train error  +  2 R^n(H)  +  O(log⁡(1/δ)/n)\text{test error} \;\le\; \text{train error} \;+\; 2\,\hat{\mathfrak{R}}_n(\mathcal{H}) \;+\; O\Big(\sqrt{\log(1/\delta)/n}\Big)test error  ≤  train error  +  2 R^n(H)+  O(log⁡(1/δ)/n)\begin{aligned}\text{test error} \;\le\;& \text{train error} \;+\; 2\,\hat{\mathfrak{R}}_n(\mathcal{H}) \\ &+\; O\Big(\sqrt{\log(1/\delta)/n}\Big)\end{aligned}

which holds with probability at least 1−δ1 - \delta over the draw of the training set. The random signs are random binary labels, so equation (1) is itself a randomization test, run over the whole family instead of through one training run. Suppose a family can fit every labeling of the nn training inputs. Then for every draw of signs some hh has h(xi)=σih(x_i) = \sigma_i at every one of the nn points, the supremum is exactly 1, and R^n(H)=1\hat{\mathfrak{R}}_n(\mathcal{H}) = 1. The bound becomes test error ≤\le training error + 2+\,2, which every classifier satisfies. The networks in the paper fit random labels, so the paper concludes R^n≈1\hat{\mathfrak{R}}_n \approx 1 for them and calls it a trivial upper bound. The experiments are multiclass, but keeping any two of the ten classes gives the binary version with the same outcome.

Figure 3 computes equation (1) exactly for a family where the best fit can be found by dynamic programming: nn points on a line and the class Hk\mathcal{H}_k of ±1\pm 1 step functions with at most kk sign changes. At k=0k = 0 the family holds only the two constant functions, and the complexity is the expected absolute value of the average of nn random signs, about 2/(πn)\sqrt{2/(\pi n)}, which is 0.14 at n=32n = 32. Raising nn at fixed kk pushes the value down, which is what a useful bound needs. Raising kk to n−1n - 1 pushes it to exactly 1, because a sequence of nn signs changes sign at most n−1n - 1 times and can then be matched point for point.

Figure 3 · Rademacher complexity of a step-function class
332
Top: one draw of random signs on n points (amber up, gray down) and the best step function with at most k sign changes; ringed points are the ones it misses. Bottom: the average best agreement over 100 draws, equation (1), as a function of k. Slide k to n − 1 and the curve reaches 1, where the bound becomes vacuous. Raise n at fixed k and the value drops.

VC dimension and its real-valued analogue, the fat-shattering dimension, fail the same way: the networks shatter their training sets (label them every possible way), so a bound built on the dimension of the whole family says nothing at these sample sizes. The known way around size-based bounds was Bartlett's 1998 result, which bounds the fat-shattering dimension through the ℓ1\ell_1 norm of the weights into each unit instead of through the number of weights. It is stated for sigmoid networks, and the paper notes that for ReLU networks the ℓ1\ell_1 norm is no longer informative. Neyshabur, Tomioka and Srebro extended the idea to other norms in 2015; the authors report that those bounds do not explain the behavior they observe either. The paper adds that all of these fail "unless we further restrict the network", and the experiments show the trained networks are not restricted in that way.

Uniform stability bounds the algorithm instead. An algorithm is β\beta-uniformly stable if, for every training set, replacing any one training example changes the loss of the returned function by at most β\beta at every test point. Bousquet and Elisseeff showed that the expected gap between test and training loss is then at most 2β2\beta. Hardt, Recht and Singer showed in 2016 that SGD is uniformly stable with a β\beta that grows with the number of steps, for convex and for non-convex losses. The definition takes the worst case over all training sets, so one β\beta has to cover the true-label run and the random-label run alike: same algorithm, same number of steps, same learning rate. Measure loss as 0-1 error. The random-label Inception run has a gap of 100 − 9.78 = 90.22 points, so 2β≥0.902\beta \ge 0.90 and any valid β\beta for that training procedure is at least 0.45. A bound of 0.90 says nothing about the true-label run, whose gap is 10.95 points. The paper draws the same conclusion for Hardt, Recht and Singer's analysis: in the non-convex case it covered only a few passes over the data, because SGD trained for many passes is empirically not uniformly stable, and a weaker notion of stability that can see the labels is needed to go further.

What regularization contributes

If the model family is too large to explain the gap, the remaining candidate is regularization. Classically, a regularizer shrinks the set of functions training can reach: penalize the norm of the weights and the Rademacher complexity of the reachable set drops. The paper tests three explicit regularizers by turning them off. Data augmentation: random crops on CIFAR10, plus brightness, saturation, hue and contrast perturbations on ImageNet. Weight decay: an ℓ2\ell_2 penalty on the weights, which the paper treats as equivalent to constraining them to a Euclidean ball (see the AdamW explainer for how the penalty and the decay differ under adaptive optimizers). Dropout: each unit of a layer's output is zeroed with a fixed probability during training; only Inception V3 on ImageNet uses it here.

Figure 4 holds every number from Tables 1, 2 and 4 of the paper. Start with Inception and switch both regularizers off: test accuracy goes from 89.05% to 85.75%. Alexnet goes from 81.22% to 76.07%, MLP 3x512 from 53.35% to 52.39%. On CIFAR10 the regularizers are worth 1 to 5 points, and every model stays far above the 10% chance rate without them. On ImageNet the effect is larger: Inception V3 drops from 77.84% top-1 with augmentation, dropout and weight decay to 59.80% with none, 18 percentage points, against a chance rate of 0.1%. Augmentation alone recovers most of it (72.95%), more than either norm penalty. The paper also compares the unregularized Inception V3 (80.38% top-5, meaning the labeled class is among the five highest-scoring) with the ILSVRC 2012 winner, Alexnet with all its regularization (83.6% top-5), to argue that a change of architecture bought more than the regularizers did.

Figure 4 · Tables 1, 2 and 4 as a switchboard
Pick a model, switch its regularizers, and flip to random labels. Bars are the paper's training and test accuracy for that exact setting; the dashed line is chance. Combinations the paper did not run say so.

Turning regularizers on does not prevent memorization either. With weight decay at its default coefficient, Inception and MLP 3x512 still fit random CIFAR10 labels at 100% and MLP 1x512 at 99.21%; Alexnet with weight decay failed to converge, the one exception. With random cropping Inception reaches 99.93% and with augmentation 99.28%. Those two numbers are averages of online mini-batch accuracy, measured on augmented images that change every epoch while each image's random label stays fixed; reaching them took a slower learning-rate decay and more epochs. On ImageNet, Inception V3 with dropout and weight decay reaches 91.18% top-1 training accuracy on random labels. The paper's summary is that explicit regularization "may improve generalization performance, but is neither necessary nor by itself sufficient". It acts like a tuning parameter, whereas in convex empirical risk minimization a regularizer is needed to rule out the trivial solutions that fit the training set and nothing else.

Two implicit regularizers get the same treatment. Early stopping: Table 2 lists in parentheses the best test accuracy seen during training, 72.57% against a final 67.18% with weight decay only, and 63.16% against 59.80% with nothing. So on ImageNet stopping early could have helped, with the caveat the paper itself gives: picking the stopping point by test accuracy is only legitimate with a separate validation set. On CIFAR10 the paper sees no benefit. Batch normalization: an Inception with every batch-norm layer removed trains less stably and ends at 82.00% instead of 85.75% with no other regularizers, a 3 to 4 point effect, and still fits random labels at 100%.

Theorem 1: 2n + d weights fit any labels

The experiments show that these particular networks can memorize. The paper's theorem asks how little a network needs to do so. Classical expressivity results concern the whole input space: which functions on Rd\mathbb{R}^d a family can approximate, and how much depth helps. The paper asks a finite-sample question instead. Given nn distinct points S⊂RdS \subset \mathbb{R}^d and any target values on them, is there a weight setting whose output matches every target exactly?

Theorem 1. There exists a two-layer neural network with ReLU activations and 2n+d2n + d weights that can represent any function on a sample of size nn in dd dimensions.

The network is

c(z)  =  ∑j=1nwj max⁡{⟨a,z⟩−bj,  0},a∈Rd,  b,w∈Rnc(z) \;=\; \sum_{j=1}^{n} w_j \,\max\{\langle a, z\rangle - b_j,\; 0\}, \qquad a \in \mathbb{R}^d,\; b, w \in \mathbb{R}^nc(z)  =  ∑j=1nwj max⁡{⟨a,z⟩−bj,  0},a∈Rd,  b,w∈Rn\begin{gathered}c(z) \;=\; \sum_{j=1}^{n} w_j \,\max\{\langle a, z\rangle - b_j,\; 0\}, \\ a \in \mathbb{R}^d,\; b, w \in \mathbb{R}^n\end{gathered}

with one vector aa shared by all nn hidden units, nn thresholds bjb_j and nn output weights wjw_j: d+n+nd + n + n numbers in total.

The proof has three steps. First, project every sample to a scalar, xi=⟨a,zi⟩x_i = \langle a, z_i \rangle. The ziz_i are distinct, so almost every aa gives distinct projections; relabel the points so that x1<x2<⋯<xnx_1 < x_2 < \dots < x_n. Second, place the thresholds between the points, b1<x1<b2<x2<⋯<bn<xnb_1 < x_1 < b_2 < x_2 < \dots < b_n < x_n. Hidden unit jj then outputs 0 at every point left of bjb_j and the positive number xi−bjx_i - b_j at every point right of it, so the matrix of hidden activations on the sample,

Aij  =  max⁡{xi−bj,  0}A_{ij} \;=\; \max\{x_i - b_j,\; 0\}

is lower triangular (Aij=0A_{ij} = 0 whenever j>ij > i, because bjb_j lies right of xix_i) with diagonal entries xi−bi>0x_i - b_i > 0. Third, the network's outputs on the sample are c(zi)=(Aw)ic(z_i) = (Aw)_i, so matching targets yiy_i means solving the linear system Aw=yAw = y. A triangular matrix with a nonzero diagonal is invertible. This is the paper's Lemma 1, which also notes that the eigenvalues of AA are its diagonal entries, so the smallest is min⁡i(xi−bi)\min_i (x_i - b_i). Forward substitution finds ww one entry at a time. The targets were arbitrary, so every labeling of the sample is reachable. For three points the construction runs as follows:

# Theorem 1 with n = 3 points, d = 1 (so <a, z> = z)
x = [0.20, 0.50, 0.90]          # projected inputs, sorted
b = [0.05, 0.35, 0.70]          # thresholds: b1 < x1 < b2 < x2 < b3 < x3
y = [1.0, -1.0, 0.5]            # any targets at all
A = [[max(x[i] - b[j], 0) for j in range(3)] for i in range(3)]
# A = [[0.15, 0,    0   ],
#      [0.45, 0.15, 0   ],
#      [0.85, 0.55, 0.20]]      lower triangular, diagonal > 0
w = forward_substitution(A, y)  # [6.667, -26.667, 47.5]
c = lambda t: sum(w[j] * max(t - b[j], 0) for j in range(3))
# c(0.2) = 1.0   c(0.5) = -1.0   c(0.9) = 0.5   (2n + d = 7 weights)

Forward substitution in this example goes row by row: w1=1/0.15=6.667w_1 = 1/0.15 = 6.667; row two needs 0.45⋅6.667+0.15 w2=−10.45 \cdot 6.667 + 0.15\, w_2 = -1, so w2=−26.667w_2 = -26.667; row three gives w3=47.5w_3 = 47.5. The weights alternate in sign and grow, because each new ramp has to cancel the slope the earlier ramps built up before it can set its own target. Small diagonal gaps xi−bix_i - b_i make the weights larger, which is why the paper points to the smallest eigenvalue of Lemma 1 as the route to a bound on the weights. In Figure 5, drag a target and watch the ramps re-solve.

Figure 5 · Theorem 1, drawn
7
n sample points on the projected axis, with amber threshold ticks bj between them. Faint ramps are the individual units wj max(x − bj, 0); the teal curve is their sum and passes through every target. Drag a target up or down and the weights re-solve by forward substitution. The right panel is the lower-triangular matrix A. Raising n adds one unit and two weights per point.

For CIFAR10 the construction needs 2⋅50,000+2352=102,3522 \cdot 50{,}000 + 2352 = 102{,}352 weights, and the smallest network in the paper has 1,209,866, about 11.8 times as many. For ImageNet it needs 2⋅1,281,167+268,2032 \cdot 1{,}281{,}167 + 268{,}203, about 2.83 million. The theorem is existential: it builds one specific network that can fit any labeling, and it does not show that the paper's Inception or Alexnet can. That they can is the experimental result. The theorem shows that memorization needs only a number of weights linear in nn and a very simple architecture, so a count of weights alone cannot rule it out.

The paper credits Livni, Shalev-Shwartz and Shamir with an earlier construction that needed O(dn)O(dn) parameters. Its Corollary 1 trades width for depth: for every k≥2k \ge 2 there is a ReLU network of depth kk, width O(n/k)O(n/k) and O(n+d)O(n + d) weights with the same property. The construction splits the projected axis into mm intervals (the paper calls their number bb), fits each interval's points at its own layer, and adds a multiplexer of approximate indicator functions that routes each input to the right layer's output.

Linear models and the minimum-norm fit

So the family contains functions that memorize, the experiments show that SGD finds one when the labels are random, and yet on real labels it finds one that generalizes. Whatever selects among perfect fits has to come from the optimizer. The paper studies that selection in the simplest setting where it can be computed: linear models with more features than examples. Take nn distinct points (xi,yi)(x_i, y_i) with xi∈Rdx_i \in \mathbb{R}^d, a nonnegative loss with loss(y,y)=0\mathrm{loss}(y, y) = 0, and the empirical risk minimization problem (minimize the average training loss)

min⁡w∈Rd  1n∑i=1nloss(w⊤xi,  yi)\min_{w \in \mathbb{R}^d} \;\frac{1}{n} \sum_{i=1}^{n} \mathrm{loss}\big(w^{\top} x_i,\; y_i\big)
(2)

Stack the inputs as the rows of an n×dn \times d matrix XX. If XX has rank nn, which requires d≥nd \ge n, the system Xw=yXw = y has infinitely many solutions for every yy, and each one drives (2) to zero. The linear model can then fit any labeling, the same position the networks are in. With d=3d = 3 features and n=2n = 2 examples, for instance, the solutions of Xw=yXw = y form a line in R3\mathbb{R}^3, and any point on it fits both examples exactly.

A common heuristic says flat minima generalize better than sharp ones, so the first thing to check is the curvature. At any zero-loss solution the Hessian of (2) is

∇2[1n∑i=1nloss(w⊤xi,yi)]  =  1nX⊤diag(β) X,βi=∂2loss(z,yi)∂z2∣z=yi\nabla^2 \Big[\frac{1}{n} \sum_{i=1}^{n} \mathrm{loss}(w^{\top} x_i, y_i)\Big] \;=\; \frac{1}{n} X^{\top} \mathrm{diag}(\beta)\, X, \qquad \beta_i = \frac{\partial^2 \mathrm{loss}(z, y_i)}{\partial z^2}\Big|_{z = y_i}∇2[1n∑i=1nloss(w⊤xi,yi)]  =  1nX⊤diag(β) X,βi=∂2loss(z,yi)∂z2∣z=yi\begin{gathered}\nabla^2 \Big[\frac{1}{n} \sum_{i=1}^{n} \mathrm{loss}(w^{\top} x_i, y_i)\Big] \;=\; \frac{1}{n} X^{\top} \mathrm{diag}(\beta)\, X, \\ \beta_i = \frac{\partial^2 \mathrm{loss}(z, y_i)}{\partial z^2}\Big|_{z = y_i}\end{gathered}

The chain rule gives 1nX⊤diag(β)X\tfrac{1}{n}X^{\top}\mathrm{diag}(\beta)X at any ww, with each βi\beta_i evaluated at the current prediction w⊤xiw^{\top}x_i. At a zero-loss solution every prediction equals its label, so every βi\beta_i is evaluated at z=yiz = y_i regardless of which solution ww is. The Hessian is therefore the same matrix at every global minimum, and its rank is at most n<dn < d, so it is degenerate at every one of them and curvature cannot tell these minima apart.

SGD started from zero picks one of them in a definite way. One SGD step on (2) is wt+1=wt−ηt et xitw_{t+1} = w_t - \eta_t\, e_t\, x_{i_t}, where ete_t is the derivative of the loss with respect to the prediction on the sampled example iti_t. Each step adds a multiple of one input vector, so starting from w0=0w_0 = 0 the iterate always lies in the span of the inputs, w=∑iαixi=X⊤αw = \sum_i \alpha_i x_i = X^{\top} \alpha for some coefficients α\alpha. If the run also fits the labels, Xw=yXw = y, substituting the first identity into the second gives

XX⊤α  =  yX X^{\top} \alpha \;=\; y
(3)

an n×nn \times n system in α\alpha with a unique solution, since the Gram matrix K=XX⊤K = XX^{\top} is invertible when XX has rank nn. The system depends on the inputs only through their dot products Kij=xi⊤xjK_{ij} = x_i^{\top} x_j, which is the kernel trick, reached here (in the paper's words, "in a roundabout fashion") through the optimizer. The solution it picks is w=X⊤(XX⊤)−1y=X+yw = X^{\top} (XX^{\top})^{-1} y = X^{+} y, the pseudoinverse solution. Any other interpolant is X+y+vX^{+}y + v with Xv=0Xv = 0. That vv is orthogonal to every row of XX, hence to X+yX^{+}y, which lies in the row space, so

∥X+y+v∥2  =  ∥X+y∥2+∥v∥2\lVert X^{+}y + v \rVert^2 \;=\; \lVert X^{+}y \rVert^2 + \lVert v \rVert^2

and among all zero-loss solutions, SGD started from zero returns the one with the smallest ℓ2\ell_2 norm. The paper calls this implicit regularization: nobody wrote a norm penalty into (2), and the algorithm returned the minimum-norm solution anyway.

Figure 6 draws the smallest case, one training point and two weights. The dashed amber line is every ww with w⋅x=yw \cdot x = y. The faint bands parallel to it are level sets of the squared loss: the valley floor is flat along the line, which is the identical-Hessian statement above. The gradient of the squared loss is (w⋅x−y) x(w \cdot x - y)\, x, a multiple of xx, so gradient descent moves only along the data direction and keeps the component vv of the start that is orthogonal to xx. From the origin, v=0v = 0 and the landing is the foot of the perpendicular, where the smallest circle around the origin touches the line. Drag the start elsewhere and the landing moves to a different interpolant with a larger norm, the same zero loss, and a different prediction on the test input.

Figure 6 · where gradient descent lands
Weight space for one data point x = (1.6, 0.9) with label 1.5. Every w on the dashed amber line fits it exactly. Drag the start w₀: the teal path runs parallel to x and lands on the line. The solid amber circle is the minimum norm; the dashed teal circle passes through the landing. The readout checks ‖w‖² = ‖X⁺y‖² + ‖v‖².

Equation (3) also makes the experiment cheap to run on real data: solve it directly, with no regularizer, and measure test error.

# Section 5: fit any labels with a linear model, no regularizer
K = X @ X.T                 # n x n Gram matrix; MNIST: 60,000^2 * 8 B = 28.8 GB
alpha = solve(K, y)         # one LAPACK call, < 3 min on a 24-core box
w = X.T @ alpha             # = X^+ y, the minimum-norm interpolant
# test error: MNIST raw pixels 1.2%, Gabor features 0.6%
#             CIFAR10 Gaussian kernel 46%, random conv features 17%

On MNIST with raw pixels the interpolating solution gets 1.2% test error, and with a Gabor wavelet transform applied first, 0.6%. Adding regularization improves neither. On CIFAR10 a Gaussian kernel on pixels gets 46% test error. Preprocessing with a random convolutional network of 32,000 random filters (the Coates and Ng architecture with random filters in place of k-means ones) gets 17%, and an ℓ2\ell_2 penalty brings that to 15%, with no data augmentation. These are all exact interpolants of a convex problem, and some of them generalize well.

The paper then asks whether a small norm predicts good generalization, and finds that it does not, or not reliably. Interpolants that generalize badly are easy to build: a Gaussian kernel with centers at random points, or a solution forced to fit random labels on the test set as well. Both have much larger norms than the minimum-norm solution. But on MNIST the minimum-norm solution on raw pixels has norm about 220 and 1.2% error, while the one on wavelet features has norm about 390 and 0.6% error: the norm went up and the error halved. The authors conclude that minimum norm may guide algorithm design and is "only a very small piece of the generalization story".

What the paper settles and leaves open

The paper defines effective capacity as what the randomization test measures: whether the training procedure, run as usual, can drive training error to zero on labels that carry no information. For every architecture tested it can, so the effective capacity of these networks is "large enough to shatter the training data". Any explanation of their generalization that depends only on the model family, only on the training algorithm, or on the explicit regularizers is ruled out. The second conclusion concerns optimization: fitting random labels costs only a small constant factor in training time, so the reason SGD converges easily on these problems must differ from the reason the result generalizes.

Three stronger claims are not in the paper. It does not claim networks memorize real data instead of learning from it; the partial-corruption sweep shows both happening at once, and Arpit and colleagues showed in 2017 that networks trained on noisy data fit the simple, shared patterns first. It does not claim regularizers are useless; on ImageNet they are worth 18 points. It does not claim the minimum-norm bias explains generalization; Section 5 gives the MNIST counterexample. It does claim that a correct theory needs a measure of complexity under which these enormous models are simple, and that in 2017 nobody had found one.

Later work has mostly confirmed the negative result. Nagarajan and Kolter showed in 2019 that uniform-convergence bounds, including ones that account for the implicit bias of gradient descent, can be vacuous for networks that generalize, and can even grow with the size of the training set. Belkin and colleagues showed in 2019 that interpolating models follow a double-descent curve, with test risk falling again past the point of exact fit, which places the paper's kernel experiments in a broader pattern. Soudry and colleagues showed in 2018 that the implicit bias depends on the loss: on separable data, gradient descent on the logistic loss converges in direction to the maximum-margin classifier while the norm grows without bound, so the minimum-norm result of Section 5 is specific to the squared loss and a zero start. The lottery ticket hypothesis asks a related question about what over-parameterized training finds, in terms of sparse subnetworks. In 2021 the authors republished the paper in Communications of the ACM as "Understanding deep learning (still) requires rethinking generalization".

Provenance Verified against primary literatureHow we verify
Zhang et al. (ICLR 2017), arXiv:1611.03530v2Randomization test, Tables 1 to 4, equations (1) to (3), Theorem 1, Lemma 1, Corollary 1, Appendix A hyperparameters. The proof of Theorem 1 prints c : R^n -> R and A = [max{x_i - b_i, 0}]; the domain is R^d and the matrix is Lemma 1's [max{x_i - b_j, 0}], which this page uses.
Bartlett & Mendelson (JMLR 2002)Rademacher complexity; their definition uses 2/n and an absolute value, the paper's equation (1) uses 1/n without it. Both give 1 for a class that fits every sign pattern.
Bousquet & Elisseeff (JMLR 2002)Uniform stability (Definition 6) and the generalization bound with 2 beta (Theorem 12). The definition takes a supremum over all datasets, so it cannot depend on the labels. The beta >= 0.45 on this page is our arithmetic from the random-label gap, not a number in the paper.
Hardt, Recht & Singer (ICML 2016)SGD is uniformly stable with a constant that grows with the number of steps, for convex and non-convex losses.
pluskid/fitting-random-labelsThe authors' released code is a from-scratch PyTorch re-implementation (Wide ResNet-28-1, 300 epochs, lr 0.1 with step decay at epochs 150 and 225, weight decay 1e-4 by default), not the TensorFlow Inception runs of the paper. Its corrupt_labels (cifar10_data.py) seeds np.random with 12345 and replaces a label with a uniform random class with probability p, the semantics used on this page.
Figures 1 and 2 of this pageA 2-64-64-1 ReLU toy (4,417 weights, 100 training points, full-batch Adam at lr 0.005) that runs in the browser. It reproduces the shape of the paper's CIFAR10 results, not its numbers.
Arpit et al. (2017), Soudry et al. (2018), Belkin et al. (2019), Nagarajan & Kolter (2019)The follow-up results cited in the last section, read from their abstracts.
correctionAppendix E says that fitting random labels under data augmentation needed "the default weight decay factor" changed from 0.95 to 0.999. Appendix A defines 0.95 as the per-epoch learning-rate decay factor, and no weight-decay coefficient of 0.95 appears anywhere in the paper (it would shrink the weights to nothing within a few steps), so the sentence describes a slower learning-rate decay. Three smaller points. The abstract's threshold of "parameters exceed data points" is 2n + d in Theorem 1, and the theorem is existential: it constructs one network that can fit any labeling, and says nothing about every network of that size. The 18% ImageNet drop from removing regularizers is 18 percentage points (77.84 to 59.80), not 18% of 77.84. The introduction's "SGD always converges to a solution with small norm" for linear models holds for the squared loss started from zero; on separable data with the logistic loss the norm diverges and only the direction converges, to the max-margin classifier (Soudry et al., 2018).

Questions you might still have

?

Does this mean deep networks just memorize their training data?
No. In the partial-corruption runs the same network picks up whatever signal the labels still carry (test error rises steadily with the corruption level instead of jumping to chance) while it fits the corrupted labels one by one. Arpit and colleagues showed the following year that networks learn simple patterns shared across examples first and memorize the leftovers later. The paper claims less: memorization is always within reach of these models, so their capacity cannot tell you which trained instance will generalize.

?

Is fitting random labels just ordinary overfitting?
The two runs differ only in the labels. Architecture, parameter count, optimizer and learning-rate schedule are the same; one run ends at 89% test accuracy and the other at 10%. A complexity measure that depends only on the model family, or a stability measure that depends only on the algorithm, gives both runs the same value, so it cannot separate them.

?

Why does random-label training start slowly?
At the start every label is unrelated to its image, so the gradients from different examples point in conflicting directions and the loss barely moves. The random labels stay fixed across epochs, so after several passes the network starts fitting images individually, and from then on the loss falls quickly. The paper's Figure 1b reports the total slowdown on CIFAR10 as a small constant factor.

?

Would weight decay or dropout stop the memorization?
Mostly not. Appendix Table 4 reports that Inception, MLP 3x512 and MLP 1x512 still reach 100%, 100% and 99.21% training accuracy on random CIFAR10 labels with weight decay on; Alexnet with weight decay failed to converge. Inception V3 on ImageNet with dropout and weight decay reached 91.18% top-1 training accuracy on random labels.

?

Is the minimum-norm bias of SGD the explanation, then?
The paper says no and gives its own counterexample: on MNIST the minimum-norm solution on raw pixels has norm about 220 and 1.2% test error, while the one on wavelet features has norm about 390 and 0.6% test error. Nagarajan and Kolter later showed that uniform-convergence bounds can stay vacuous even when they take the implicit bias of gradient descent into account.

?

How does this relate to double descent?
The Section 5 kernel models interpolate the training set exactly and still get low test error. Belkin and colleagues later described that regime as double descent: once a model can fit the training set exactly, test risk can fall again as capacity keeps growing. The classical U-shaped bias-variance curve covers only the part before the interpolation point.

?

How do I run the randomization test on my own model?
Draw one random label per training example with a fixed seed, so the assignment is the same in every epoch, swap it in, and train with exactly the configuration you use on real labels, allowing more epochs. The released code does this with its --label-corrupt-prob flag and suggests starting with augmentation, dropout and weight decay off. If training accuracy reaches 100%, the model can memorize your training set, and its capacity does not explain its accuracy on real labels; if it stalls at chance, capacity does constrain that model at that data size.

?

Does Theorem 1 mean a trained network is a lookup table?
Theorem 1 says one particular two-layer network with 2n + d weights can reproduce any labels on the sample, so a lookup table exists within a small, simple architecture. It says nothing about the paper's own networks or about which weights SGD finds; that the real networks memorize too is the experimental result. For CIFAR10 the construction needs 102,352 weights, and the paper's networks have 1.2 to 1.7 million.

Footnotes & further reading

  1. The paper: Zhang, Bengio, Hardt, Recht, Vinyals, Understanding deep learning requires rethinking generalization (ICLR 2017, best paper award). The authors' PyTorch demonstration: pluskid/fitting-random-labels.
  2. Rademacher complexity and the bound built on it: Bartlett and Mendelson, Rademacher and Gaussian complexities: risk bounds and structural results (JMLR 2002).
  3. Uniform stability: Bousquet and Elisseeff, Stability and generalization (JMLR 2002); the SGD stability bound is Hardt, Recht and Singer, Train faster, generalize better (ICML 2016).
  4. The norm-based bounds the paper contrasts with: Bartlett, The sample complexity of pattern classification with neural networks (IEEE Trans. Inf. Theory 1998), and Neyshabur, Tomioka and Srebro, Norm-based capacity control in neural networks (COLT 2015).
  5. Memorization versus pattern learning: Arpit et al., A closer look at memorization in deep networks (ICML 2017).
  6. The implicit bias of gradient descent depends on the loss: Soudry et al., The implicit bias of gradient descent on separable data (JMLR 2018).
  7. Interpolation and double descent: Belkin, Hsu, Ma and Mandal, Reconciling modern machine-learning practice and the classical bias–variance trade-off (PNAS 2019). Why uniform convergence may not be enough: Nagarajan and Kolter, Uniform convergence may be unable to explain generalization in deep learning (NeurIPS 2019).
  8. Related explainers in this library: the regularizers under test, batch normalization, dropout and decoupled weight decay; the optimizer of Figures 1 and 2, Adam; and the lottery ticket hypothesis, another study of what over-parameterized training finds.