How it works

An epoch is a complete pass through the training set: each example in that set is processed once. In mini-batch training, the data is split into smaller groups and each group participates in one iteration. So an epoch normally contains several iterations and parameter updates.

The number of updates per epoch depends on the size of the dataset and the batch size. The last iteration may contain fewer examples when the division is not exact, or it may be dropped depending on the training configuration. For this reason, the number of epochs alone does not describe all the computational work.

After an epoch, the team can evaluate the model on validation data that was not used to update its parameters. This measurement helps observe whether performance improves and whether there are signs of overfitting. The training definitions from the Google Machine Learning Glossary also relate epoch, batch and iteration.

An epoch is not a unit of time. The duration of each pass depends on the hardware, the architecture, the amount of data and the implementation. It also does not mean the model learned usefully: it only indicates that the training examples were traversed according to the defined procedure.

Practical example

Imagine a team training a classifier with an image dataset. In each epoch, the process goes through all the images intended for training, organizes the examples into batches and updates the parameters based on the calculated errors.

When the pass finishes, the team evaluates the classifier on a separate validation set. If the validation metric improves, that is a sign of progress, but not a guarantee that the system will work well in production. The team also observes the difference between results on training and validation.

If the training metric keeps improving but the validation metric gets worse, the model may be adjusting too much to the seen examples. In that case, increasing the number of epochs can worsen the problem. The team can stop training, adjust the configuration or review the quality and representativeness of the data.

When comparing experiments, record the number of epochs together with batch size, learning rate, data, architecture and metrics. If other factors change, do not attribute all the difference to the number of epochs. A controlled comparison makes the result more understandable.

What it is for

Epochs help describe and control the training of machine learning models. They allow tracking progress in complete passes over the data and organizing periodic evaluations during the process.

For those who develop models, the notion helps interpret logs. "Epoch completed" informs that the training set was traversed; it does not by itself inform whether quality increased, whether the model is ready or how much time remains.

Choosing how many epochs to run depends on the data, the model and the behavior observed on validation. More epochs can offer new opportunities for adjustment, but they can also increase overfitting and computational cost. The decision should use relevant metrics and a separate validation set.

In summary, an epoch is an organizational unit of training, not a quality indicator. Combine this measure with metrics, documented settings and tests on appropriate data to decide whether the model generalizes to new situations.