Watch: Early Stopping

Halting training when validation performance stops improving rather than running for a fixed number of epochs — the primary defence against overfitting in practice.

Transcript

When you train a machine learning model, deciding exactly when to stop is often a guessing game. If you stop too early, the model underperforms. If you train too long, it overfits, memorizing the training data instead of learning to generalize.

Early stopping solves this problem by turning that guess into an empirical decision. Instead of running for a fixed number of epochs, the training process constantly monitors a validation metric, like accuracy or loss, at regular intervals. When that metric stops improving, the training halts automatically.

This process relies on a setting called the patience parameter. Patience defines how many validation intervals the system will tolerate without any improvement before it officially shuts down. For example, a patience of three means the model gets three more chances to beat its best score. If it fails to do so, training stops.

Crucially, the final model deployed is not the one from the very last step, which has likely already begun to degrade. Instead, the system saves and loads the best checkpoint recorded during the entire run.

By letting the data dictate when to stop, you avoid the waste of training a model that has already peaked. This not only prevents overfitting, but it also saves valuable time and compute power.