How does a model know what to change?
When a prediction is off, nudging every setting at random is slow. The model needs a clue about which way would reduce the mistake.
LESSON 02 The useful mistake
A tiny compass that checks the slope, takes a step and tries again with a little less error.
00 Overview / start here
A model starts with a guess. Gradient descent is the repeatable adjustment loop that turns the size and direction of its error into a small next move.
When a prediction is off, nudging every setting at random is slow. The model needs a clue about which way would reduce the mistake.
Gradient descent measures the error, reads the local slope, and nudges the model in the direction that lowers the loss.
The model uses its current weight or parameters to make a prediction for one example.
Compare prediction with target. The gradient gives the local slope; the learning rate sets how large the step should be.
After the update, measure the loss again. The new setting becomes the input for another round.
If x = 1 and the current weight is w = 0.20, the prediction is 0.20 for a target of 0.80. With a 0.50 learning rate, the gradient is −0.60 and the next weight becomes 0.50.
01 See the landscape
Imagine the model's error as a landscape. The gradient is the local slope: it tells the model which direction should make the mistake smaller.
Drag the step slider or press the button. Notice how the loss gets smaller as the point moves into the valley.
The gradient does not know the answer. It only points toward a better next try.
02 Follow one update
The gradient turns a prediction error into a direction. Watch one tiny model measure its mistake, calculate the slope and move its weight.
Choose a starting weight, then apply one update. Every number is visible: prediction, loss, gradient and the next weight.
The model is under-confident. The gradient will push the weight up.
A gradient is useful because it makes a mistake actionable.
03 Tune the step size
The learning rate controls how far the model moves each time. Tiny steps are slow. Giant steps can jump over the valley.
Drag the learning rate, then compare three training runs. Click a path to copy its pace into the slider.
Balanced steps: fast enough to learn, gentle enough to stay in the valley.
Good training is a rhythm: measure, adjust, try again.
At the current point, the gradient is mostly a…
Pick one. The landscape will tell you if the picture clicks.
FAQ Gradient descent / quick answers
Use these compact answers to connect the landscape to the training loop.
Gradient descent is an optimization loop: measure the current error, read the local slope, and move the model’s parameters in the direction that should reduce the error.
The learning rate controls the size of each update. Small steps can be steady but slow; large steps can learn quickly or jump past a useful low point.
A large update treats the local direction as if it were safe for a long distance. If the step is too big, the parameter can cross the valley and make the next error larger.