Early Stopping Criteria and Patience
Rather than training for a fixed number of steps, early stopping watches performance on held-out data and stops once it stops improving — the tricky part is deciding how many bad epochs in a row you're willing to tolerate before giving up.
Prerequisites: Overfitting, Cross-Validation for Time Series
Training loss almost always keeps falling the longer you train — a model with enough capacity can eventually memorize the training set nearly perfectly. But loss on held-out data the model has never seen typically falls for a while, then starts rising again, as the model shifts from learning genuine patterns to memorizing training-set quirks. Training for a fixed, arbitrarily chosen number of epochs risks stopping too early, before the model has learned enough, or too late, after it has already started overfitting. Early stopping instead watches validation performance directly and stops training when that number stops improving.
The analogy: tasting soup while it simmers
A cook adjusting a soup by taste doesn't set a timer and walk away — they taste it periodically as it simmers, and stop the moment it goes from "still improving" to "getting worse" (over-reduced, over-salted). Stopping the instant the very first spoonful tastes slightly worse than the last would be jumpy — taste can wobble spoonful to spoonful even while the soup is still generally improving. So a sensible cook tolerates a few slightly-worse tastes in a row before concluding the soup has actually turned, rather than reacting to the very first blip. That tolerance for a few bad tastes in a row is exactly what "patience" means in early stopping.
The mechanics: monitor, track the best, wait out the noise
At the end of every epoch, evaluate the model on a held-out validation set and record the validation loss . Track the best (lowest) validation loss seen so far, , and a counter of how many epochs in a row have failed to beat it:
In words: whenever validation loss sets a new best, save that epoch's weights and reset the "epochs since improvement" counter to zero; whenever it fails to improve, increment the counter. Training stops once the counter reaches a chosen threshold called patience — the number of consecutive non-improving epochs tolerated before concluding the model has genuinely stopped improving rather than just having one noisy epoch. The final model used is not the one from the last epoch trained, but the one saved at .
Worked example 1: patience of 3 stops training
Validation loss across epochs: , with patience . Epoch 1: loss , new best, counter . Epoch 2: , new best, counter . Epoch 3: , new best, counter . Epoch 4: , no improvement, counter . Epoch 5: , still no improvement (doesn't beat the best, ), counter . Epoch 6: , counter — patience threshold hit, training stops. The model saved and returned is the one from epoch 3, where validation loss was the best ever recorded, not the epoch 6 model that triggered the stop.
Worked example 2: patience too low reacts to noise
Same validation sequence, but patience . Epoch 4's non-improvement () immediately hits the patience threshold, and training stops right there — missing epoch 5's , which, while not a new best, would have shown the model was still hovering near its best rather than clearly worsening. A patience this low can stop training prematurely on a single noisy epoch, before the model has had a fair chance to continue improving after a brief wobble.
What this means in practice
Early stopping is one of the cheapest and most broadly used forms of regularization — it costs almost nothing beyond periodic validation evaluation and requires no change to the model or loss function. Patience is itself a hyperparameter to tune: too low, and training stops on noise before real improvement resumes; too high, and you waste substantial compute training well past the point where the model was already at its best, though that waste is usually far cheaper than the alternative of overfitting badly.
Early stopping tracks the best validation performance seen so far and halts training once a chosen number of consecutive non-improving epochs (patience) has passed, but the model actually used is the one saved at the best point, not the one present when training stopped.
Practice
- Validation losses are with patience . At which epoch does training stop, and which epoch's weights are kept?
- Why is a patience of exactly 0 (stop the instant validation loss fails to improve) usually a bad idea?
- Name one situation where a very noisy validation metric would argue for a higher patience value.
The most common mistake is deploying the weights from the epoch training happened to stop at, rather than the epoch that actually achieved the best validation score. Because patience deliberately lets training run several epochs past the true best before stopping, the final-epoch weights are, by construction, from a point already partway back into overfitting — always save and restore the best checkpoint, not the last one.
Related concepts
Practice in interviews
Further reading
- Prechelt, Early Stopping — But When? (2012)