Skip to content

Implement early stopping during training

We would have two new parameters in the training configuration.

  • training.validation.monitor: name of the metric tracked for early stopping,
  • training.validation.mode: either min or max. In min mode, training will stop when the quantity monitored has stopped decreasing and in max mode it will stop when the quantity monitored has stopped increasing,
  • training.validation.patience: number of checks with no improvement after which training will be stopped

training.validation.monitor defaults to cer and training.validation.mode defaults to min (in the template). Both values are required to start training. training.validation.patience defaults to None in the template.

With parameters training.validation.eval_on_valid_interval=10 and training.validation.patience=3, the trainer will perform at least 40 training epochs before being stopped.

This check should be performed at the end of the validation step.