Practice Makes It Smaller
Small steps downhill toward fewer mistakes. Gradient descent, with a beautiful video to watch.
A quick note on how we teach here. You won't find equations or numbers in this series, and that is on purpose. The goal is understanding, not arithmetic, so every idea is explained in plain words and simple pictures. When you want the math later, the rest of Internals Decoded is ready for you.
Welcome back. Last time we gave the machine a way to measure its own mistakes. It could look at a guess and work out how far off it was. That was a big step. But owning a measuring stick does not make you a better cook. You have to use it to change something. Now we need to turn that measurement into actual improvement. How does the machine really get better at a task?
The answer is surprisingly steady. To improve, the machine changes itself a tiny bit at a time. Each change moves in the direction that makes its mistakes a little smaller. No grand overhaul. No sudden flash of understanding. Just a long, careful walk downhill toward doing better.
Finding the bottom of a valley in thick fog
Imagine you are standing somewhere in a wide valley, surrounded by thick fog. You cannot see the bottom. You cannot see the shape of the whole land. But you can feel it. Right where you stand, the ground slopes a certain way. If you place one foot carefully, you can tell which direction goes down. So you take a small step in that downhill direction. Then you stop, feel the slope again, and take another small step. Do this over and over, and eventually you reach the lowest point, even though you never saw a map.
This is exactly how the machine learns. Its mistakes are like the height of the ground. A large mistake is high up on the slope. A tiny mistake is way down near the valley floor. The machine does not know the whole landscape of possible mistakes. But after it tries a batch of examples, it can feel which way its own internal knobs should move to make the mistakes smaller. It takes a small nudge in that direction. Then it repeats the process, again and again.
The power of tiny steps
Why not take one giant leap straight to the bottom? In the fog, a big leap might send you tumbling the wrong way, or overshoot the lowest point and leave you climbing the other side. Tiny steps are safe. Even if the slope is tricky, each small step just inches the machine closer to doing a little better. It never has to be perfect in one go.
This is what training really looks like. The machine sees some examples, makes its guesses, and checks the size of its mistakes. Then it uses that measurement to figure out which tiny twists to its own inner workings will shrink the mistakes. It makes those twists, and the next time it sees similar examples, it will be a fraction less wrong. Then it does it all over again with more examples. A long, patient sequence. Nothing dramatic. But with enough steps, the mistakes can shrink from huge to nearly nothing.
How it knows which way is downhill
This is the clever bit. You might think the machine would have to try every possible nudge, one at a time, for every single little dial inside it. That would take forever. But the machine has a smarter way. It already owns a method for measuring how wrong it is, a recipe we built up in the previous pieces. That measurement does more than just give a score. If you look carefully at the recipe, it also shows you the slope. It says, “If I move this dial just a hair in that direction, the mistake will shrink.” No guessing required. The machine can feel the downhill direction without ever taking a test step.
People call this downhill method gradient descent. The word “gradient” just means slope. And “descent” means walking down. So gradient descent is exactly the foggy valley walk we described: follow the slope downward, step by patient step. The part of the system that runs this walk is called the optimizer. You might smile when you hear that. It is a grand name for a very simple habit. Keep stepping in the direction that makes things a little better.
Some ideas ask to be watched. This one is beautifully animated by 3Blue1Brown. You can see the little steps march downhill on a real landscape, and it makes the whole idea click. You can watch it here. I warmly recommend it for seeing the walk in motion.
Where this is heading
Today we learned that learning is not a single leap. It is a long walk of countless tiny adjustments. The machine keeps nudging itself downhill, making its mistakes just a bit smaller each time. But what exactly are those internal dials it keeps nudging? The parts that twist and turn to change a guess. They have a name, and there are more of them than you could ever imagine. In the next piece, we will open the lid and meet the knobs inside a learning machine. You will see just how many of them are in there, all quietly shifting a little downhill.