Think about learning to shoot basketball free throws. You don't read a manual and suddenly sink every shot. You take a shot, watch where it lands — short, long, veering left — and adjust your aim a little. Then you shoot again. Short by less this time. Adjust again. Shoot again. After a few hundred repeats of try, see how far off you were, adjust, your arm has quietly learned the right motion, without you ever writing down a formula for it.
Training a machine learning model is exactly this cycle, run by a computer instead of an arm, and repeated not hundreds but often millions of times. That cycle is called the training loop, and it has four steps:
That's it. There's no secret fifth step. A model that plays chess, translates languages, or recognises your voice was built by running this same humble loop — predict, measure, adjust, repeat — an enormous number of times.
Let's shrink the loop down to something you can run entirely by hand. Suppose our "model" is the
simplest one imaginable: it guesses
Say the true pattern in the world is
| Round | Current | Predict | True | Error | Adjust |
|---|---|---|---|---|---|
| 1 | 1.0 | 6 | 4 (too low) | bump | |
| 2 | 1.5 | 6 | 3 (too low) | bump | |
| 3 | 2.0 | 6 | 2 (too low) | bump | |
| 4 | 2.5 | 6 | 1 (too low) | bump |
Look at the error column:
Drag the step slider to advance the training loop on a slightly bigger example — a line being fit to nine data points instead of one. The line starts flat and useless; with each step it's nudged toward the data and the loss printed above the graph drops. You're watching predict–measure–adjust play out visually — the same loop, whether the model is a single line or a giant neural network.
Real training sets don't have one example — they have thousands, millions, sometimes billions. You could adjust the knobs after every single example, but it's common to gather up predictions and errors across the whole dataset before deciding how to adjust. One full pass through every training example, once each, is called an epoch.
"Training for 10 epochs" means the model looped over the entire dataset ten separate times, adjusting its numbers a little after each pass (or, often, many small adjustments within each pass). "Training" is simply running the loop, epoch after epoch, until the loss stops getting smaller.
Picture a dataset of
Yes to all three — and each mistake has its own name and its own fix:
You can see the overshoot problem in the very same one-knob example from before. This time, instead
of a cautious nudge of
| Round | Current | Predict | True | Error |
|---|---|---|---|---|
| 1 | 1.0 | 2 | 6 | 4 (too low) → wildly overshoot to |
| 2 | 5.0 | 10 | 6 | 4 (too high!) → wildly overshoot back to |
| 3 | 1.0 | 2 | 6 | 4 (too low) → back to |
Notice the error never shrinks — it just bounces between
In 2016, DeepMind's AlphaGo beat one of the world's strongest Go players — a game with more possible positions than atoms in the observable universe, far too many to search by brute force. How? AlphaGo (and its successor, AlphaZero) trained by playing millions of games against itself, starting from knowing almost nothing.
Every single game was just one more spin of the exact loop you learned today: predict a good move, measure whether the game was eventually won or lost, adjust the internal numbers to make winning moves more likely next time, repeat. Nothing about the loop was different from our one-knob line — there were just vastly more knobs, and vastly more repeats. That's also the honest answer to "why does training a huge model take days or weeks of computer time?" — it's this same simple cycle, just run an almost unimaginable number of times.
Astonishingly, this four-step loop is essentially all of model training — from this toy
line to systems with billions of knobs. What changes is only how the "adjust" step is computed,
and that's the engine called