§7.8 Early stopping
Train a model with enough capacity to overfit and you see it reliably: the training loss keeps falling, but the validation loss bottoms out and starts climbing again. The fix is almost embarrassingly simple — keep a copy of the parameters every time validation improves, and when it has not improved for a while, return that saved copy instead of the latest one. That is early stopping early stopping Return the parameters from the training step with the lowest VALIDATION error (stop after 'patience' worsening checks). The most common DL regularizer — simple, unobtrusive, and equivalent to L² under a quadratic model with τ ≈ 1/(εα). defined in ch. 7 — open in glossary , probably the most-used regularizer in deep learning. Sweep the epoch and watch the return point:
Training loss keeps falling, but we return the parameters from the lowest-validation epoch, not the last one. A single run tries every "number of steps" — that is why early stopping is such a cheap hyperparameter search.
The bookkeeping is one loop:
- 1Let = steps between evaluations, = patience, = initial parametersⓘ
- 2ⓘ
- 3while doⓘ
- 4train steps; ⓘ
- 5if : ⓘ
- 6else ⓘ
- 7return best parameters , best step count ⓘ
Early stopping is free hyperparameter search
“Number of training steps” is itself a hyperparameter with a U-shaped validation curve — but unlike weight decay’s , a single training run tries every value of it at once. The only real cost is evaluating the validation set periodically (run it in parallel, or less often) and keeping one spare copy of the parameters. It changes nothing about the objective, the parameters, or the learning dynamics — so it composes with any other regularizer, and it will not trap the network in a bad small-weight minimum the way heavy weight decay can.
Early stopping holds out a validation set, so afterward you can reclaim that data with a second training round. Two strategies:
| what it does | caveat | |
|---|---|---|
| Alg 7.2 — retrain from scratch | Reinitialize, train on ALL data for the i* steps early stopping found. | Unclear whether to match the same number of parameter updates or the same number of passes — the bigger set needs more updates per pass. |
| Alg 7.3 — continue training | Keep the first-round parameters, keep training on all data until validation loss falls below the training objective value where stopping halted. | Cheaper (no restart) but not well-behaved — the target may never be reached, so it is not even guaranteed to terminate. |
Why it regularizes — early stopping ≈ L²
Bishop and others showed early stopping restricts optimization to a small volume of parameter space around the start (fig 7.4): the product of steps and learning rate is an effective capacity effective capacity (of training time) The product of training steps τ and learning rate ε bounds the volume of parameter space reachable from the init θ₀, so it behaves like model capacity — and 1/(τε) plays the role of a weight-decay coefficient. defined in ch. 7 — open in glossary that bounds how far the parameters can travel. Compare the two pictures — a trajectory stopped early lands in the same place weight decay pulls to:
For a linear model with a quadratic cost, this equivalence is exact:
step 1/6: Quadratic approximation of the cost around the optimum w*, with H the positive-semidefinite Hessian there.
The advantage over weight decay: early stopping finds the right amount of regularization automatically, in one run, while weight decay needs many experiments over different .
§7.9 Parameter tying and parameter sharing
Weight decay pulls parameters toward a fixed point (zero). But sometimes our prior knowledge is about relationships between parameters — that two of them should be close. Say models and solve the same task on slightly different input distributions and we believe . Express that with a tying parameter tying Regularizing sets of parameters to be CLOSE via a penalty ‖w^(A) − w^(B)‖² (e.g. tying a supervised model to an unsupervised one that shares structure). defined in ch. 7 — open in glossary penalty:
Term by term
| the parameters of two related models (e.g. a supervised classifier and an unsupervised model of the same inputs) | two models | |
| penalize the DIFFERENCE, pulling the two parameter sets toward each other rather than toward zero | tying penalty | |
| the stronger, more popular option: FORCE the sets equal (w^(A) = w^(B)) so only ONE copy must be stored | the upgrade |
The stronger cousin is parameter sharing parameter sharing FORCING sets of parameters to be equal (e.g. the same weights at every image location in a CNN); stores only the unique set, cutting memory and encoding invariance directly. defined in ch. 7 — open in glossary : force sets of parameters to be equal. Besides the regularizing constraint, it saves memory — only the unique set is stored. Its flagship is the convolutional network: natural images are translation-invariant (a cat shifted one pixel is still a cat), so a CNN applies the same feature detector at every location. Move the cat and watch one shared detector find it anywhere:
Move the cat: the same detector fires wherever it appears — so the model needs to learn the "cat" pattern only once, not separately at every column. That is parameter sharing: force the weights equal across positions, store just one copy.
Sharing lets CNNs slash their unique parameter count and grow much larger without needing more training data — the best example of baking domain knowledge straight into the architecture (much more in chapter 9).
Next: sparse representations and the ensemble methods (bagging) that dropout will build on — sparse representations & bagging.
Check yourself — early stopping and parameter sharing
1.What does early stopping actually return, and when does it stop?
2.In EarlyStoppingLab, you slide to epoch 200 with patience 30. Training loss is still dropping but the 'return' marker sits back near epoch 87. Why?
3.In what precise sense is early stopping equivalent to L² regularization?
4.What is the difference between parameter tying and parameter sharing?
5.In ParamShareLab, moving the cat keeps the SAME detector firing at its new location. What two benefits does this parameter sharing give a CNN?