Epochs, Batches and Learning Rate

Level 301advanced
10 mins

Training a model means adjusting weights over time, not all at once.

This is done through multiple epochs, on smaller batches, with a specific learning rate.


⏱️ Epoch

An epoch is one full pass through the entire training dataset.

  • We train in multiple epochs to improve learning.
  • One epoch doesn’t mean the model has learned enough.

πŸ“¦ Batch

Instead of feeding all data at once, we split it into mini-batches.

Why?

  • Fits in memory
  • Adds randomness β†’ helps generalization

Batch Size affects:

  • Speed
  • Stability
  • Accuracy

🎚️ Learning Rate

The learning rate (Ξ±) determines how big the steps are during gradient descent.

  • Too high β†’ skips minima
  • Too low β†’ slow or stuck

πŸ” Training Loop

The full training loop typically looks like:

  1. Shuffle dataset
  2. Loop through mini-batches
  3. Forward pass
  4. Compute loss
  5. Backward pass
  6. Update weights
  7. Repeat for multiple epochs

βš–οΈ Trade-Offs

ConceptHigh ValueLow Value
Batch SizeFast, unstableSlow, stable
EpochsBetter learningUnderfitting risk
Learning RateFast convergenceSlower learning

Self-Check

  • What is an epoch?
  • Why use batches instead of the full dataset?
  • What happens if the learning rate is too high?

Explore More Learning

Continue your AI learning journey with our comprehensive courses and resources.

Epochs, Batches and Learning Rate - AI Course | HowAIWorks.ai