Gradient descent: improving predictions
Training can improve a model through many small changes. Follow one simple update, then see how the step size affects what happens next.
A guess can improve in steps.
Imagine a bead resting somewhere on the inside of a smooth bowl. It can move toward the low point a little at a time. In training, the “bowl” is a picture of how well different model settings perform; the model does not literally roll downhill.
This lesson follows six ideas in order: prediction, error, loss, slope, learning rate, and update.
Use one invented example: a tiny model predicts a package’s mass using a single adjustable number, w. The known target is 4 units, and the first prediction is w = 0. The error is prediction minus target, so it starts at −4 units.
A loss turns the mismatch into a score. For this example, use L(w) = ½(w − 4)². Squaring makes the score non-negative, and a prediction nearer 4 has a lower score. The loss starts at 8; at the target, it is 0.
Use the slope to choose a direction.
The gradient tells which way the loss rises most steeply at the current setting. For this one-number example, its slope rule is dL/dw = w − 4. This derivative is supplied as the rule for the toy; the optional math pathway explains derivatives in more depth.
At w = 0, the slope is −4. A negative slope means the loss falls if w moves a little to the right. Gradient descent subtracts the slope multiplied by the learning rate from the current setting.
Work it through with a learning rate of 0.25. The first update is 0 − 0.25 × (−4) = 1. The error shrinks, and the loss drops from 8 to 4.5. From there, the slope is 1 − 4 = −3, so another update gives 1 − 0.25 × (−3) = 1.75, with loss about 2.53.

An update is one calculated change to the adjustable setting. Training repeats updates; it does not usually jump straight from the first guess to a perfect answer.
The steepest-descent direction and learning-rate update are standard optimization ideas. See Goodfellow, Bengio and Courville, Deep Learning, sections on gradient-based optimization and optimization for training deep models.
Change the step size.
In the example above, 0.25 takes a moderate step toward the target. A lower learning rate makes each step smaller; a high one can jump across the low point. Watch how the next setting and loss respond.
- Start with the selected rate, 0.25, and take one step.
- Reset, choose 0.05, and compare how far the marker moves.
- Reset, choose 2.2, and watch the marker cross the target.
This made-up example has one adjustable prediction, w, and one known target: 4. Start at w = 0. Each step uses the slope of this bowl and the selected rate to calculate a new value.
Step 0. Prediction w = ; loss = .
Current slope = -4.00. The next update is w− rate × slope.
Invented target and values. This deterministic toy uses the exact gradient of L(w) = ½(w − 4)², with no added randomness. It is not a live model or a complete training setup.
What this bowl leaves out.
With this exact bowl starting at w = 0, a rate of 0.25 steadily reduces the loss. A rate of 2.2 overshoots the target on the first update and raises the loss; later updates alternate across the target and move farther out. This is a result for the stated toy equation, not a rule that every large rate behaves the same way in every model.
A real training run changes many parameters using examples and a chosen loss. Its loss surface can have more complicated shapes, so a rate that helps in one setting may be too small or too large in another. Gradient descent describes a repeated update process, not a promise of instant or perfect learning.
This lesson showed a slope for one adjustable number. How error supplies gradients across multiple layers belongs in the next lesson on backpropagation. Batches, epochs and training settings come later.
Quick questions
- Does one update guarantee the best prediction?
- No. It changes the setting once; later steps may still be needed.
- Does a larger rate always help?
- No. It can make progress faster in some cases, but it can also overshoot.
Follow one update
A direction, then a step.
Gradient descent uses the loss slope to choose a direction, then the learning rate sets the step size. Training repeats those updates, checking whether they improve the chosen loss.