Part 2 · Lesson 9 · 5 min
How a model improves: guess, check, nudge
How does a machine know it is getting better if nobody tells it how?
It plays a very long game of warmer and colder.
We keep saying the machine "learns". Here is what that actually looks like, and it is simpler than you might think.
Remember the hot-and-cold game? You cannot see the prize. All you hear is "warmer" or "colder", and you keep stepping toward warmer.
Warmer, colder
Nobody told Pat where the prize was. Pat only needed to know, after each step, whether things got better or worse.
The machine version
A model starts out guessing badly. After each guess it checks the right answer and measures how wrong it was. That number is the error. Then it adjusts its settings slightly in whatever direction makes the error smaller.
Guess, check, nudge
Guess, check, nudge, repeat. A real model does this millions of times, across millions of examples. "Learning", in machine terms, just means the error goes down.
Notice what is missing. The machine never understands why it was wrong. It only knows how wrong, and which way to turn the dials.
Go deeper optional
The error measure has a technical name: the loss. A simple one is the gap between guess and truth: |400 - 395| = 5.
To decide which way to nudge, the model checks which direction makes the loss smaller, like feeling the slope of the ground with your foot in fog, then stepping downhill. This is called gradient descent. Part 3 walks through it with pictures.
One warning: the lowest possible error on the training examples is not always the goal. Push too far and the model starts memorizing. Lesson 2.11 covers that.
Check yourself
1. What does a model use to know it is improving?
Models have no feelings. Training is driven by a number that measures error.
2. How does training usually change the model?
Big jumps tend to overshoot. Training uses many small steps.
3. After a wrong guess, what does the model know?
It measures the size of the error and the direction that reduces it. There is no understanding of why.