Stop training when validation loss stops improving. It is the cheapest regulariser available - it costs nothing, needs no extra term in the loss, and often works as well as anything else.
Validation loss is noisy. Mini-batch sampling, dropout and a finite validation set mean it rises and falls between epochs even while the underlying trend is still improving. Stopping at the first increase would stop almost immediately and almost always too early.
Patience is the number of epochs to keep training without improvement before giving up. With patience 10, the run continues 10 epochs past the best score and stops only if nothing beats it in that window.The other half is restoring weights. Because training continued past the best point, the final weights are not the best weights — the best checkpoint must be saved when it occurs and reloaded at the end. Skipping that gives you a model that is deliberately patience epochs overfit.
Train a network long enough and training loss keeps falling while validation loss stops improving and then rises. That turning point is where the model stops learning the pattern and starts memorising the noise.
Early stopping watches validation performance and halts when it stops improving. It is the cheapest regulariser available — free in compute, since it saves time — and it requires no tuning beyond one number.
The mechanism has three parts:
patience epochs, and restore the best checkpoint.That third detail is the one people miss. Stopping without restoring leaves you with the weights from patience epochs past the best point — the worst of both worlds.
Validation loss is noisy. It dips and recovers, sometimes for several epochs, particularly with small validation sets or aggressive augmentation. Stopping at the first non-improvement would end most runs prematurely.
| Patience | Behaviour |
|---|---|
| 0–1 | Stops on noise; almost always too early |
| 5–10 | The usual range |
| 20+ | For noisy metrics, or long schedules |
Patience also interacts with the learning-rate schedule. With a cosine decay, the final low-rate epochs often produce a distinct improvement — so patience must be long enough to survive the plateau before it, or you will stop just short of the best result the schedule was building towards.
best, wait = float("inf"), 0
for epoch in range(max_epochs):
train_one_epoch()
val = validate()
if val < best - 1e-4: # min_delta: ignore trivial changes
best, wait = val, 0
torch.save(model.state_dict(), "best.pt")
else:
wait += 1
if wait >= patience:
break
model.load_state_dict(torch.load("best.pt")) # restore the best, not the last
Validation loss is the default, and it is not always the right choice.
Loss is smooth and sensitive, which makes it a good early-stopping signal. But it can rise while accuracy holds steady — a model becoming overconfident on examples it already classifies correctly. Stopping there discards a model that was still improving on the thing you care about.
The task metric — accuracy, F1, IoU, AUC — is what you will report, so stopping on it aligns the decision with the goal. It is noisier, so it needs more patience.
The practical answer: monitor the metric that matters for the decision, with enough patience to ride out its noise, and log both.
Note that the validation set is now part of the training procedure. Every early-stopping decision uses it, so its score is no longer an unbiased estimate of generalisation. Keep a separate test set for the number you report.
Early stopping restricts how far the weights can travel from their initialisation. With small initial weights and a bounded number of gradient steps, the reachable region of weight space is limited — which is a constraint on effective model capacity, not merely a stopping heuristic.
For linear models with gradient descent this can be made precise: early stopping is equivalent to L2 regularisation, with the number of epochs playing the role of 1/λ. Fewer epochs correspond to a stronger penalty. Deep networks are not linear, but the intuition transfers — which is why early stopping and weight decay are partly redundant.
Early stopping monitors validation loss, waits patience epochs after the best score, then halts and restores the best checkpoint. It regularises by limiting how far weights travel from initialisation — provably equivalent to L2 for linear models — and it costs nothing beyond the validation split you already have. The two things that make it fail are monitoring the wrong curve and forgetting to restore the best weights.
Early stopping is not merely a convenience. For linear models it is provably equivalent to L2 regularisation of a particular strength: limiting the number of gradient steps limits how far the weights can travel from their small initial values, which is exactly what a weight penalty does.
The same intuition carries to networks. Weights grow during training, and larger weights mean sharper, more confident functions that fit finer detail — including noise. Stopping early keeps them smaller.
That also explains why early stopping and weight decay partly overlap, and why adding both usually gives less than the sum of their individual effects.
| Method | Cost | Tuning |
|---|---|---|
| Early stopping | Negative — saves compute | One patience value |
| Weight decay | Free | One coefficient |
| Dropout | Slows convergence | One rate per layer group |
| Augmentation | CPU time | Task-specific choices |
Early stopping should essentially always be on. It costs nothing, it protects against the most common failure mode, and the checkpoint it keeps is the model you would have wanted anyway.
The one situation where it is set aside is very large-scale pretraining, where a fixed step budget and a fixed schedule are decided in advance and the model is not trained to convergence at all — there is no overfitting to stop, because the data is effectively unlimited.
Validation loss falls, turns, and rises. Early stopping keeps the weights from the turn -- and the two parameters that decide when to stop are where the subtlety lives.
What patience should I use? 5–10 epochs for most work; more if the metric is noisy or the schedule is long.
Should I monitor loss or accuracy? Whichever you will report, with patience matched to its noise. Log both.
Does early stopping replace other regularisation? No. It complements weight decay and augmentation, and overlaps partly with weight decay.
Can I combine it with a learning-rate schedule? Yes, and reduce-on-plateau plus early stopping is a common pairing — cut the rate on the first plateau, stop on the second.
Should I retrain on train plus validation afterwards? Some do, for the extra data, using the epoch count found by early stopping. It gives up the ability to detect that the retrained model is worse, so it is a judgement call.
What is min_delta for? To ignore improvements too small to be meaningful, so a metric creeping by 1e-6 does not reset the patience counter for ever.
Answer without scrolling back up.
Early stopping monitors which quantity?
What does the 'patience' setting control?
Patience is set to 0. What is the risk?
Prevent overfitting by halting training when the model stops generalizing! The network monitors Validation Loss. If it fails to improve for a set number of epochs (Patience), training stops and the weights are restored to the Best Epoch.
AI.Cruz builds and maintains AI.Cruz. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.