Getting It Wrong on Purpose
Mistakes are the teacher. How being wrong is the engine that makes a machine learn.
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. In the last piece, we watched a machine learn from examples, adjusting its guesses as it saw more and more of them. But we left one big question hanging in the air: how does the machine know how to adjust? The answer begins with something that might surprise you. It begins with getting things wrong.
The heart of this piece is simple. Mistakes are not a nuisance during learning. They are the teacher. Every wrong guess tells the machine how far off it was, and that signal is what lets it improve.
In fact, training is set up so that the machine will be wrong at first. It usually starts with its settings at random, so its first guesses are wild. And it always makes its guess before it sees the right answer, because the gap between the two is what produces the signal. That is the sense in which it gets things wrong on purpose.
A ball and a target
Imagine you are learning to throw a ball at a target. Maybe a bucket across the yard. You have never done it before. Your first throw sails wide to the left. You see it land, and instantly you know: that was too far left. Next throw, you aim a little more to the right. Still not perfect, maybe a bit short. But each miss gives you a clear signal. Without seeing where the ball landed, you could throw all day and never improve. The mistake itself is your guide.
A machine's miss is a little different from a ball's. You can see which way the ball went. The machine gets the size of its mistake as one single measurement. Working out which way to turn each of its many settings is a separate job, and Practice Makes It Smaller, the piece after this one, covers it.
Measuring the miss
A machine learning from examples does something similar to you at the bucket. It makes a guess. Then it looks at the correct answer from the example. It compares the two and asks: how far apart are they? If the guess was close, the gap is tiny. If the guess was wildly off, the gap is large. This gap is not a failure. It is the most useful piece of information the machine has. It is the equivalent of seeing where the ball landed.
Take the cat photo from last time. Picture the machine's answer as two bars, one for "dog" and one for "cat". Say the "dog" bar is tall and the "cat" bar is tiny: the machine answered "dog" with a lot of confidence. The right answer is cat, so the gap is big. Had the two bars been about even, the gap would be smaller. Had the "cat" bar been the tall one, the machine would have been right and sure, and the gap would be close to nothing.
Notice what this means. The gap depends on how sure the machine was, not only on whether it was right. A machine that barely chooses "cat" is right, but it still has a gap left to close.
Small nudges and big corrections
Once the machine knows the size of its mistake, it can use that to decide how much to change its inner settings. Think back to the ball. If you missed by just a hair, you might only tweak your aim a tiny bit. If you missed by a mile, you would make a much bigger adjustment. The machine does the same. A small miss leads to a small nudge of its knobs and dials. A big miss leads to a bigger correction. This is why the machine needs to see many, many examples. Each one gives it a new chance to measure its mistake and adjust a little. Over time, those nudges add up, and the machine gets better and better at its task.
The whole point of training
When people talk about training a machine learning system, they often say the goal is to "reduce the loss" or "minimize the error." Those words can sound technical and scary. But now you already understand what they mean. The loss is the name people who build these systems give to the measure of the miss. A high loss means the machine's guesses sit far from the right answers. A low loss means its guesses sit close to them. The entire training grind, all that example after example, is a long, patient effort to push that loss down. The machine is not trying to be perfect in one giant leap. It is trying to be a little less wrong with each step, guided by the mistakes it just made.
So when you hear that training "reduces the loss", it means the machine's misses are getting smaller. It is wrong less often, and when it is right, it is more sure.
Where this is heading
Knowing how wrong you are is one thing. Knowing how to change so you are less wrong next time is another. The machine has measured its miss. Now it needs a patient method to work out which way to turn each of its knobs, and by how much, so that the next guess lands closer to the mark. For now, hold onto this: every mistake is a teacher. Without them, a machine could never learn at all.
Test yourself
Two machines look at the same cat photo and both answer "cat". The first was very sure. The second barely chose "cat" over "dog". Which one has the lower loss, and why does the other one still have something to learn?
Answer: The first machine, the one that was very sure, has the lower loss. The loss measures how far each guess sits from the right answer, and that includes how sure the machine was, not only whether it picked the right word. The second machine got the right answer, but only just: its "cat" bar was barely taller than its "dog" bar. So there is still a gap between its guess and a confident "cat", and training will keep nudging its settings to close that gap. That is why a machine keeps learning even from examples it already gets right.
Next: Practice Makes It Smaller. It shows how the machine turns each miss into a small step downhill toward a smaller loss, and points you to an animated video that shows the walk in motion.