Training: adjusting a model to reduce its errors
Training repeats one routine: measure how wrong the line is, nudge it, and measure again. This lesson shows how the line is found and what the size of each nudge does.
An email app puts a new message in the spam folder. You open the folder, find a real message and press Not spam. The filter made a mistake. Its numbers were set by adjusting them against many emails already marked spam or not spam, so that it makes few mistakes.
Each step measures the loss and nudges the line to lower it. Press Run 200 and watch the loss fall. Then move the step size, also called the learning rate, to its largest setting, press Reset and run 200 steps again.
More detail
Choosing the learning rate
The learning rate is the size of each step, and somebody has to choose it. If it is too small, training crawls, and you pay for computing power that is barely moving the line. If it is too large, each step overshoots the lowest loss and the line ends up worse than before, over and over, so the loss goes up when it should go down.
Nothing detects this for you. It is the most common reason a training run produces nothing, and it is the setting beginners change most often.
The line you moved has three numbers. A weight sets how much hours studied counts, another weight does the same for attendance, and the bias shifts the line. Each step nudges all three to lower the loss. Nobody writes the final line down.
You can now explain how a model finds its numbers by repeated nudging.
More detail
The terms on this screen
Loss is one score for how wrong the line is across all of the students. Lower is better. Cross-entropy is the formula that produces the loss, and it gives a large penalty when the model is confident and wrong. Gradient descent is the routine of working out the slope of the loss for each of the three numbers and moving each one a small step in the direction that lowers the loss.
Scale
A large language model does the same kind of adjusting to hundreds of billions of numbers, for months, on thousands of machines. The arithmetic is similar, and the cost is far larger.
Where the line came from
The lesson Training data and test data used a boundary line without showing where it came from. This is how that line is found. The two students the line still gets wrong are the same two as there, and no straight line can catch them. The fix is covered in Neural networks.