Early Stopping & Regularization by Time
Training time as a regularizer: spectral filtering, ridge equivalence and label noise.
Stop training early and you get a regularized model for free. For least squares this is exact mathematics: gradient descent is a spectral filter, and its risk is never more than 1.69 times that of ridge regression at matched tuning, whatever the data. For deep networks it rests on a regularity with theory behind it: networks fit the clean structure of the data before they memorize its noise. But validation curves can mislead, and picking the best checkpoint has statistics of its own.
What you’ll learn
- Derive gradient descent's spectral filter on least squares from any initialization, its effective degrees of freedom, and the calibration with ridge.
- State and prove that gradient flow's risk is at most times ridge's at , and state the factor for optimally tuned Bayes risks (Ali, Kolter & Tibshirani, 2019).
- Explain why early-stopped networks resist label noise, from the experiments of Arpit et al. (2017) to the bimodal-Jacobian theorem of Li, Soltanolkotabi and Oymak (2020).
- Recognize when validation curves mislead, and quantify the optimism of selecting the best of many checkpoints.
Gradient descent as a spectral filter
Work with least squares, , under the model with and , and a fixed design with . Let be the minimum-norm least-squares solution, so that . The Representation lesson started gradient descent at zero; here start anywhere.
Each step contracts the distance to by the same matrix:
Along each eigenvector, the coordinate interpolates between its starting value and its least-squares value, with weight on the latter:
Ridge, , applies instead. In the variable and with , the two filters are and . Started from , the fitted values are for a smoother matrix with trace
the effective degrees of freedom, which grow from toward as training runs: training time counts how many directions have been fitted. Two consequences. Early stopping shrinks toward the initialization, so when fine-tuning it regularizes toward the pretrained weights. And directions with never move: from with more features than examples, gradient descent converges to the minimum-norm interpolant, an implicit bias taken up in The Generalization Puzzle.
| Gradient descent: | Ridge at : | |
|---|---|---|
| 0.1 | 0.095 | 0.091 |
| 0.3 | 0.259 | 0.231 |
| 1 | 0.632 | 0.500 |
| 3 | 0.950 | 0.750 |
| 10 | 1.000 | 0.909 |
Gradient descent with starts at zero on a least-squares problem. After steps, what fraction of the least-squares coefficient along an eigenvector with eigenvalue has it fitted?
Show the answer
0.64
. The continuous approximation is close, and ridge at the matched would keep .
Within a constant factor of ridge
How close is "like ridge"? Ali, Kolter and Tibshirani (2019) compared the two exactly, using gradient flow, from : the limit of gradient descent as with fixed. Gradient flow gives .
In the eigenbasis, with and , both risks split into a squared bias and a variance per direction:
Two scalar inequalities for compare them term by term. The first follows from ; the second holds because peaks at about , near :
Squaring, each bias term of gradient flow is at most ridge's, and each variance term at most times ridge's. Summing over proves the bound. No constant below 1 is possible: ridge with is the Bayes estimator under an isotropic Gaussian prior, hence admissible, so gradient flow cannot beat it at every . Gradient flow is a Bayes estimator too, for a Gaussian prior that depends on the design, so neither method dominates the other.
Beyond finite dimensions, early stopping is a statistically sound regularizer in its own right. For least squares in a reproducing kernel Hilbert space, where gradient descent is the classical Landweber iteration, the stopping time plays the role of (Yao, Rosasco & Caponnetto, 2007). Raskutti, Wainwright and Yu (2014) gave a stopping rule computed from the eigenvalues of the empirical kernel matrix and the noise level, with no hold-out set, that attains minimax-optimal rates: for kernels whose eigenvalues decay like , a squared error of order . And a single run traces the whole regularization path, where ridge needs one fit per .
What does the Ali–Kolter–Tibshirani theorem guarantee?
- Gradient descent always has lower risk than ridge
- Gradient flow stopped at time never has more than about 1.69 times the risk of ridge with , for any design and any true parameter
- Gradient flow and ridge give identical estimates when
- The bound holds only when the features are uncorrelated
Show the answer
B. Gradient flow stopped at time never has more than about 1.69 times the risk of ridge with , for any design and any true parameter
The comparison is term by term in the eigenbasis of any , so it needs no assumption on the design or on . The filters differ, so the estimates differ, but their risks cannot differ by more than the constant.
Deep networks fit signal before noise
Early stopping works in deep networks too, and for a related reason. Arpit et al. (2017) compared training on real data with training on noise (random labels or random inputs). On real data, networks fitted examples in a largely consistent order across runs, learning patterns shared by many examples first; fitting noise needed more capacity and more time, and tuned explicit regularization such as dropout slowed the memorization of noise while barely affecting generalization on real data. Zhang et al. (2017) had noticed the same slowdown on random labels.
A linearized network makes this exact. Near its initialization a network is approximately linear in its parameters, , with the Jacobian of the outputs on the training set. Gradient descent on the squared loss then evolves the vector of training residuals as
The mechanism is the filter above. The Jacobian is approximately low-rank and bimodal: a few large singular values on a signal subspace aligned with the cluster structure, and small ones elsewhere. Clean labels are constant within clusters and lie almost entirely in the signal subspace; corruption varies within clusters and projects mostly onto the small singular values, so it is fitted slowly, and fitting it requires moving far from initialization. Li et al. also found such bimodal Jacobian spectra in networks on CIFAR-10, with only a small number of large singular values, even at random initialization. The result lives in the near-initialization regime; for networks that learn features far from initialization, the "signal first" ordering is an empirical regularity rather than a theorem.
In the bimodal-Jacobian picture, why does early stopping protect against corrupted labels?
- Corrupted examples have larger gradients, so they are fitted first and then forgotten
- Gradient descent ignores examples whose labels disagree with their cluster
- The network's capacity is too small to fit corrupted labels at any stage
- The corruption's residual lies mostly along directions with small singular values, which gradient descent fits slowly
Show the answer
D. The corruption's residual lies mostly along directions with small singular values, which gradient descent fits slowly
Residual components shrink like . Clean labels sit in the fast, large- subspace; corruption mostly in the slow one. Stopping before the slow directions are fitted keeps the clean fit and discards most of the noise.
When the validation curve misleads
Early stopping assumes the validation curve is U-shaped. It need not be. Nakkiran et al. (2020) found epoch-wise double descent: for large networks trained on data with label noise, test error can fall, rise in mid-training, and fall again, so stopping at the first minimum, or with short patience, stops too early. They proposed, as a unifying hypothesis, that what matters is an effective model complexity, the largest number of examples a training procedure can fit to near-zero error, which grows with training time just as it grows with model size.
A second trap is statistical. The early-stopped checkpoint is the one with the lowest validation error among many, and the minimum of noisy estimates is biased downward. If checkpoints had independent validation estimates with standard error , the best one would look better than it is by about times the expected maximum of standard normals, which is at most .
You select the best of checkpoints whose validation error estimates are independent, each with a standard error of 1 percentage point, and all with the same true error. By about how many points is the selected checkpoint's validation error optimistic?
Show the answer
2.5 points
The expected maximum of 100 independent standard normals is about 2.51 (a simulation of 20,000 draws gives 2.507), below the bound . For scale: an error rate of 10% measured on 1,000 validation examples has a standard error of points. Checkpoints along one run are strongly correlated, so their bias is smaller, but sweeps over many runs and hyperparameters behave more like independent draws. The remedy is a test set that played no part in the choice.
Key takeaways
- On least squares, gradient descent multiplies each eigen-coordinate by , interpolating between the initialization and the least-squares solution: a spectral filter like ridge's with , but sharper, and anchored at the starting point.
- Gradient flow's risk is at most times ridge's at , for any design and any truth; at optimal tuning under an isotropic prior the ratio lies in (Ali, Kolter & Tibshirani, 2019). In kernel regression, data-dependent stopping attains minimax rates.
- Near initialization a network's residuals evolve as ; with a bimodal Jacobian, clean labels are fitted fast and corruptions slowly, so early-stopped gradient descent provably corrects a constant fraction of corrupted labels on clustered data (Li, Soltanolkotabi & Oymak, 2020).
- Validation curves can show epoch-wise double descent (Nakkiran et al., 2020), and the best of checkpoints is optimistic by up to about standard errors: report a separate test set.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Gradient descent on least squares starts from pretrained weights and is stopped early. Toward what does early stopping regularize the solution?
- Toward zero, like ridge
- Toward the minimum-norm least-squares solution
- Toward the starting point : weakly determined directions stay near their initial values
- Toward nothing: early stopping only saves compute
Show the answer
C. Toward the starting point : weakly determined directions stay near their initial values
Each eigen-coordinate is times its least-squares value plus times its starting value. Weak directions keep most of their initial value, which is why early stopping in fine-tuning keeps a model close to its pretrained weights.
Under an isotropic prior on , gradient flow and ridge are each tuned to their best stopping time or penalty. How do their optimal Bayes risks compare?
- Gradient flow's is always exactly equal to ridge's
- Gradient flow's can be arbitrarily worse than ridge's
- Gradient flow's is always strictly better
- Gradient flow's is at least ridge's and at most 1.2147 times it
Show the answer
D. Gradient flow's is at least ridge's and at most 1.2147 times it
Ali, Kolter and Tibshirani show in that setting: at optimal tuning the two are nearly interchangeable.
Training a large network on data with noisy labels, you see the validation error fall, then rise for many epochs. What should you consider before stopping?
- Epoch-wise double descent: the error may fall again later, so use longer patience or keep evaluating
- Nothing: a rising validation error always means the best model is behind you
- Switching to the test set to decide
- Increasing the learning rate to get past the bump faster, then evaluating on the training set
Show the answer
A. Epoch-wise double descent: the error may fall again later, so use longer patience or keep evaluating
Nakkiran et al. (2020) observed test error that rises and then falls again over training, most visibly with label noise. A U-shaped curve is a common case, not a guarantee.
Your early-stopping rule picked the checkpoint with the lowest validation error out of 200 evaluations. How should you report its performance?
- Report its validation error: it was measured on held-out data
- Report the average validation error over all 200 checkpoints
- Evaluate it once on a separate test set that played no role in the selection
- Report its training error, which is the most stable estimate
Show the answer
C. Evaluate it once on a separate test set that played no role in the selection
Selecting the minimum of many noisy estimates biases that minimum downward, by up to a few standard errors. Only data untouched by the choice give an unbiased estimate.
Further reading
- A. Ali, J. Z. Kolter & R. J. Tibshirani, "A continuous-time view of early stopping for least squares regression," AISTATS (2019).
- Y. Yao, L. Rosasco & A. Caponnetto, "On early stopping in gradient descent learning," Constructive Approximation 26, 289–315 (2007).
- G. Raskutti, M. J. Wainwright & B. Yu, "Early stopping and non-parametric regression: an optimal data-dependent stopping rule," Journal of Machine Learning Research 15, 335–366 (2014).
- D. Arpit, S. Jastrzębski, N. Ballas, D. Krueger, E. Bengio, M. S. Kanwal, T. Maharaj, A. Fischer, A. Courville, Y. Bengio & S. Lacoste-Julien, "A closer look at memorization in deep networks," ICML (2017).
- M. Li, M. Soltanolkotabi & S. Oymak, "Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks," AISTATS (2020).
- P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak & I. Sutskever, "Deep double descent: where bigger models and more data hurt," ICLR (2020).