Normal programs get rules
Usually a person tells the computer exactly what to do. If you want to turn 2 into 6, you program: “Multiply the input by three.” Done. For 4 you get 12.
But try writing down the rule for these tasks: how do you recognize a handwritten seven? Which word fits at the end of “I like my coffee best with …”? You know the answer instantly. Writing down a complete rule for it is practically impossible.
This is where machine learning comes in: instead of the rule, we give the computer examples. It is supposed to find the rule itself.
Examples instead of rules
We still stick with tripling for now. There we know the right answer and can always check whether the learning works. Our program gets this table:
| Input | Desired output |
|---|---|
| 1 | 3 |
| 2 | 6 |
| 3 | 9 |
Each row is a training example. The desired output is called the target. All examples together are the training data.
The program may compute exactly one thing: “input times some number”. Which number is open; it can be adjusted like a dial. A dial like that is called a parameter. At the start it sits somewhere, let's say at 1.
Fixed blueprint, movable dial
The division of labor matters: we provide the blueprint “input times parameter”. The program cannot invent a new kind of calculation. What changes during learning is only the position of the dial.
With the dial at 2, the input 2 becomes 4. At 3 it becomes 6, a direct hit. We could turn the dial by hand until it fits. From chapter 7 on, the program does that itself.
That gives you two terms you will meet throughout the book: a model is the blueprint together with its current dial settings. Training means setting the dials better based on examples.
The prediction is not the target
Never mix up these two numbers: what the model computes is called the prediction. What it should compute is the target. Only because we know both can we notice that something is going wrong.
| Term | In our example |
|---|---|
| Input | 2 |
| Current parameter | 1 |
| Computed prediction | 2 × 1 = 2 |
| Desired target | 6 |
| Difference | Prediction is 4 too low |
“Prediction” sounds like the future and crystal balls. Here it is simply the technical word for “whatever the model spits out”.
After training: using the model
Once the dial is set right (at 3), we try an input that was not in the table at all: 4. The model says 12. Correct! Using a finished model like this is called inference. Just think “applying it”.
When a model is also right on new inputs, we call that generalization. That is exactly what we want: not memorizing, but a pattern that carries over to new cases.
Why not just memorize everything?
A lookup table could reproduce the three known rows perfectly. At 4 it would be stuck, because 4 is not in it. A model with a blueprint, on the other hand, can carry a pattern over to new cases.
But the blueprint has limits too. “Input times a number” always gives 0 for the input 0, no matter where the dial is. If 0 should give 5, no amount of dial turning helps; the blueprint is too simple. For that we need a second dial, the bias. You will meet it in the next chapter.
What this has to do with ChatGPT
For a language model, the examples are not pairs of numbers but texts: “After this beginning of a sentence, this word came next.” And instead of one dial it has billions of them. But the roles are exactly the same: input, target, prediction, dials, and a training process that adjusts the dials until the predictions fit.
Key points
- Learning means: a fixed blueprint whose dials (parameters) are set based on examples.
- The prediction is what the model computes. The target is what should come out.
- A good model also works on new inputs. That is called generalization.