Gradients and learning rate
What it is
A gradient gives the local direction in which each parameter increases loss, including both direction and sensitivity. Gradient descent moves the opposite way: θ ← θ − learning_rate × ∇θ loss. In practice, a mini-batch estimates that direction from a small random sample of examples; the estimate is noisy, but is much cheaper than computing the full dataset gradient and that noise can help escape unhelpful local geometry. One optimiser step updates every trainable parameter once after backpropagation has populated its gradient.
Why it matters
The learning rate controls the basic trade-off: too high diverges or bounces past a solution; too low makes progress impractically slow. This is why a loss curve is a diagnostic instrument, not merely a score: smooth stagnation, erratic spikes, and steady decline call for different interventions. Mini-batch size also changes the noise and number of updates per epoch, so it cannot be tuned independently of the learning rate.
In the real world: How a model nudges its weights after every batch; the step size decides whether training takes hours or never works.
Visual example
Interactive optimisationChoose a learning rate, take updates, and watch the same loss either settle, oscillate, or explode.
Why this matters
A learning rate is not an abstract setting: it is the length of every downhill step. This tiny objective makes the stable and unstable regimes visible immediately.
- 1Set ηTry 0.2 first, then compare it with 0.8 and 1.1.
- 2StepEach click applies the derivative of the displayed loss.
- 3Read the curveLoss should fall toward zero; sustained growth means the step is too large.
Interpreting a noisy mini-batch loss as failure. Batch estimates are noisy by design; evaluate a moving average or validation loss before changing the whole training setup.
Practise it: ReLU, Forward and Backward, Adam, One Step at a Time