Introduction
Accounts of AI training usually stay at the level of slogans, such as "the model adjusts its weights to reduce error." The claim is easier to judge once you've watched it happen on something small enough to follow by hand.
This walkthrough traces two training steps on an invented network with three dials. The network, the reviews, and all the numbers are made up for the purpose. The arithmetic is whole numbers only.
The Starting Point
The network's job is to guess whether a short customer review is positive or negative. It looks at three things in a review and has one dial for each.
| Dial | What it multiplies | Starting setting |
|---|
| A | The number of praise words, such as "great" or "loved" | minus 1 |
| B | The number of complaint words, such as "slow" or "bad" | 2 |
| C | The number of exclamation marks | 1 |
To make a guess, the network multiplies each count by its dial, adds the three results, and reads the total. A total above zero means "positive." A total below zero means "negative." The further the total is from zero, the more confident the guess.
The starting settings are random, which is how real networks begin. They're also badly wrong. Dial A is negative, so praise words count against a review. Dial B is positive, so complaints count in its favor. Nobody will correct these by hand. Training has to do it.
For scoring, each review has a target. A positive review should total 5, and a negative review should total minus 5. The error on a review is the distance between the network's total and the target.
Walking Through the Training Steps
Step 1: Feed in one review and follow the numbers to a guess
The first review is "Great food, loved it!" It's labeled positive. It has two praise words, no complaint words, and one exclamation mark.
- Dial A: two praise words times minus 1 gives minus 2.
- Dial B: no complaint words times 2 gives 0.
- Dial C: one exclamation mark times 1 gives 1.
The total is minus 1. That's below zero, so the network guesses "negative."
Step 2: Compare the guess with the label and state the error
The label says positive, so the guess is wrong. The target for a positive review is 5 and the network's total was minus 1. The distance between them is 6, so the error on this review is 6.
The error says two things. The total was too low, and it was too low by a lot. Any adjustment should raise the total for this review.
Step 3: Assign blame to each dial
Now trace the error back to the dials, one at a time.
- Dial A contributed minus 2. It pushed the total down when it needed to go up. It gets the most blame, and it should be turned up.
- Dial B contributed nothing, because the review had no complaint words. It took no part in this error, so this review gives no reason to move it.
- Dial C contributed 1. It pushed the right way, though weakly. Turning it up would raise the total further.
This tracing is a hand version of backpropagation, the procedure that works backward from an error and gives each parameter its share of the responsibility (Lee and Trott 2023, "How language models are trained").
Step 4: Nudge each dial slightly
Each dial that took part moves one notch in the helpful direction. Dial A goes from minus 1 to 0. Dial C goes from 1 to 2. Dial B stays at 2.
One notch is a small move on purpose. Dial A is still not positive, so praise words still earn nothing. A single example hasn't fixed the network. It has shifted it a little.
Step 5: Run the review again, then train on a second review
With the new settings of 0, 2, and 2, the first review totals 2: nothing from Dial A, nothing from Dial B, and 2 from Dial C. The guess is now "positive," which is correct. The total is 3 short of the target, so the error has fallen from 6 to 3.
A second review now gets the same treatment. It's "Slow service, bad coffee!" and it's labeled negative. It has no praise words, two complaint words, and one exclamation mark.
- Dial A contributes 0.
- Dial B: two complaint words times 2 gives 4.
- Dial C: one exclamation mark times 2 gives 2.
The total is 6, so the network guesses "positive." The target for a negative review is minus 5, so the error is 11. The total needs to come down.
Blame goes to Dial B, which pushed up by 4, and to Dial C, which pushed up by 2. Dial A took no part. So Dial B moves down one notch, from 2 to 1, and Dial C moves down one notch, from 2 to 1.
Dial C has now been pulled both ways. The first review turned it up, and the second turned it back down. That's the correct outcome for a signal that appears in both kinds of review. An exclamation mark doesn't tell praise from complaint, and over many examples a dial like this would be expected to settle near zero.
With the settings at 0, 1, and 1, the second review totals 3. The guess is still "positive" and still wrong, with an error of 8 where it was 11. The first review now totals 1, with an error of 4. The second step cost the first review a little and helped the second review more.
Key Considerations
Real networks differ from this one in scale and not in kind. A large language model has billions of dials arranged in many layers, and its training runs through an enormous number of examples (Wolfram 2023, "Inside ChatGPT"). The move is the same: make a guess, measure the error, share out the blame, and adjust every dial slightly.
Two simplifications were made here. Real training sizes each nudge by how much blame the dial earned, where this example moved every dial exactly one notch. Real training also adjusts for a batch of examples at once, where this example used one review at a time.
A common mistake is to think the network stores each example it trains on. Look at what remains of the two reviews after training. The network holds three numbers. The words "Great food, loved it!" aren't kept anywhere. What's left of that review is its small effect on Dials A and C, already partly overwritten by the second review. The same is true at full scale. What training leaves behind is the adjusted settings, and those settings mix the effects of all the examples together.
Summary
Two training steps moved three dials from random settings toward useful ones, and the combined error on the two reviews fell at each step.
| Dial A | Dial B | Dial C | Error on review 1 | Error on review 2 | Combined error |
|---|
| Start | minus 1 | 2 | 1 | 6 | 10 | 16 |
| After step on review 1 | 0 | 2 | 2 | 3 | 11 | 14 |
| After step on review 2 | 0 | 1 | 1 | 4 | 8 | 12 |
- The start row scores both reviews with the random settings. The second review totals 5 there, which is 10 away from its target.
- The step on review 1 helped review 1 and slightly hurt review 2, because raising Dial C raised the total for both.
- The step on review 2 reversed that change to Dial C and lowered Dial B. The combined error fell again.
- The network is still wrong about review 2. Many more steps would be needed before Dial A turns positive and Dial B turns negative.
References
- Lee, Timothy B., and Sean Trott. 2023. "Large Language Models, Explained with a Minimum of Math and Jargon." Understanding AI, July 27, 2023.
- Wolfram, Stephen. 2023. "What Is ChatGPT Doing … and Why Does It Work?" Stephen Wolfram Writings, February 14, 2023.