Early stopping

Early stopping is a feature that enables the training to be automatically stopped when a chosen metric has stopped improving. You can see it as a form of regularization used to avoid overfitting.

Use early stopping if you don’t want to train your model for too long.

Why use early stopping

Deep learning is ultimately about creating a model that makes as good predictions as possible. To do that, you show the model a big chunk of historical data and let the model learn what to predict. This chunk of data is shown to the model over and over again. Hopefully, the model gets better at prediction each time.

Avoid overfitting
However it is not certain that predictions get better when training your model for numerous epochs. A common issue in machine learning problems is overfitting, which is when the model fits to the training data to such an extent that damages generalization performance. This means that a model that is overfitting will underperform on data it hasn’t "seen" before.
As a form of regularization, early stopping helps avoid that.

Save money (save GPU hours)
Since training a model might be expensive, it’s really good to be able to stop when it doesn’t make sense to train more. Then you can spend your GPU hours on something more valuable.

Easy to use
Avoid having to tune the number of epochs. The ideal number of epochs is different for each experiment. It’s better to have a mechanism such as early stopping define until which point the model should be trained, instead of doing this manually.

How to use early stopping

To activate early stopping, navigate to the Modeling canvas and check the Early stopping box in the Run settings.

Metric

You will then be able to select the Metric that you want early stopping to use to make a stopping decision.

Patience

Set the Patience that you want early stopping to use. This is the number of epochs without improvement after which training will be early stopped.
A larger patience means that an experiment will wait longer before stopping an experiment.

Epochs

Don’t forget to set a generous amount of Epochs. A default value of 100 will be set automatically.

How early stopping works

Early stopping monitors the evolution of the given metric after every epoch. If the metric has not improved for Patience epochs in a row, the experiment is early stopped.

Early stopping
Figure 1. Early stopping based on the metric loss

A square icon indicates an experiment has been early stopped

When an experiment is stopped before the specified epochs by the early stopping, its status is Early stopped.

You can see a square icon that shows that the experiment has been stopped in the:

  • Card in the experiments overview

  • Experiments list

  • Evaluation view

  • Experiment status list