---
title: "Epoch"
canonical: "https://www.thundercompute.com/glossary/training/epoch"
description: "One complete pass through the entire training dataset"
sidebarTitle: "Epoch"
icon: "rotate"
iconType: "solid"
---

An **epoch** is one complete pass through the entire training dataset. Training a model typically requires many epochs — the model sees the same data multiple times to learn patterns.

## Example

```python
num_epochs = 10

for epoch in range(num_epochs):
    for batch in train_loader:
        inputs, labels = batch
        outputs = model(inputs.cuda())
        loss = criterion(outputs, labels.cuda())
        loss.backward()
        optimizer.step()
        optimizer.zero_grad()

    print(f"Epoch {epoch + 1}/{num_epochs} complete")
```

## Key Points

- 1 epoch = the model has seen every training sample once
- More epochs generally improve performance up to a point, then **overfitting** occurs
- Common to train for 3-100+ epochs depending on the task

## See Also

- [Batch Size](/training/batch-size)
- [Backpropagation](/training/backpropagation)
