Too big, it explodes. Too small, it crawls.
The learning rate, step by step: why one number decides whether training works at all. Backpropagation tells every weight which way to move: its gradient. It doesn't say how far. That's the job of the learning rate, wri
The learning rate, step by step: why one number decides whether training works at all.
Backpropagation tells every weight which way to move: its gradient. It doesn't say how far. That's the job of the learning rate, written ฮท (eta). Every step of gradient descent is
w โ w โ ฮท โL
The gradient comes from the model. The learning rate is a setting you choose, and it is the first one people tune. This article shows what it does on the smallest possible example, why there is a hard limit on how big it can be, and how practitioners pick it and change it during training. The ideas follow the CS878 Deep Learning lecture on learning rates.
One weight on a bowl
Take a single weight and the loss L(w) = wยฒ, a bowl with its bottom at w = 0. The gradient is 2w, so one step is
w โ w โ ฮท ยท 2w = (1 โ 2ฮท) ยท w
Start at w = 2, where the loss is 4, and try four learning rates:
- ฮท = 0.01: each step multiplies w by 0.98. After ten steps, w has only reached 1.634 and the loss is still 2.67. It crawls.
- ฮท = 0.4: each step multiplies w by 0.2. Two becomes 0.4, then 0.08, then 0.016. Fast.
- ฮท = 0.9: each step multiplies w by โ0.8. The weight jumps to the other side of the bowl each time (โ1.6, 1.28, โ1.024, 0.819), but the jumps shrink, so it still lands.
- ฮท = 1.1: each step multiplies w by โ1.2. The jumps grow: โ2.4, 2.88, โ3.456, 4.147. The loss climbs 5.76, 8.29, 11.94, 17.20. It explodes.
One weight on the bowl L = wยฒ, four learning rates: crawls, fast, zig-zags, explodes.
Why the edge is at one
Everything depends on the factor 1 โ 2ฮท. After t steps, w_t = (1 โ 2ฮท)^t ยท wโ.
- Below ฮท = 0.5, the factor is between 0 and 1: the weight slides in without overshooting.
- At ฮท = 0.5, the factor is 0: one jump lands exactly on the bottom.
- Between 0.5 and 1, the factor is between โ1 and 0: the weight flips sides but shrinks.
- At ฮท = 1, the factor is โ1: it bounces between 2 and โ2 forever.
- Past 1, the factor is below โ1: it grows every step.
Nothing here is special to wยฒ. For any bowl L = (ฮป/2) wยฒ, with curvature ฮป (the second derivative), the factor is 1 โ ฮทฮป. So training is stable only if 0 < ฮท < 2/ฮป, and one jump lands at ฮท = 1/ฮป. For L = wยฒ, ฮป = 2: the edge is 1 and the one jump is 0.5.
The factor 1 โ 2ฮท decides everything: slides in below 0.5, one jump at 0.5, zig-zags up to 1, explodes past 1.
Millions of directions
A real network has millions of weights, so the loss has millions of directions, and they are not equally steep. Take two weights and L = ยฝ(wโยฒ + 10 wโยฒ): one direction with curvature 1 (flat), one with curvature 10 (steep). Each step multiplies wโ by (1 โ ฮท) and wโ by (1 โ 10ฮท).
Starting from (4, 1):
- ฮท = 0.02: the steep direction shrinks fast (ร0.8 per step) but the flat one barely moves (ร0.98). After ten steps the weights are at (3.27, 0.11): done on the steep side, stuck on the flat side.
- ฮท = 0.21: 0.21 is past 2/10, the edge of the steep direction. wโ is multiplied by โ1.1 each step: 1, โ1.1, 1.21, โ1.331, 1.464. It explodes.
- ฮท = 2/11 โ 0.18: the best single fixed rate, 2/(ฮป_min + ฮป_max). Both directions shrink by 9/11 per step, and after ten steps the weights are at (0.54, 0.13).
The steep direction sets the speed limit, ฮท < 2/ฮป_max, and the flat direction then crawls. Even the best fixed rate shrinks the error by only (ฮบ โ 1)/(ฮบ + 1) = 9/11 per step, where ฮบ = ฮป_max/ฮป_min = 10 is how uneven the valley is.
The valley L = ยฝ(wโยฒ + 10wโยฒ): the steep side sets the speed limit; the best fixed step is 2/11.
Picking a starting rate
Two quick checks get you most of the way:
- Before training, look at the first loss. For softmax with C classes and small random weights, it should be about ln C, which is 2.30 for ten classes. If it isn't, something else is wrong.
- Try a few learning rates a factor of ten apart: 1e-1, 1e-2, 1e-3, 1e-4. Run each for about a hundred iterations and keep the one whose loss drops fast without blowing up. Too small barely moves; too big turns into NaN.
Trying 1e-4 to 1e-1 from the same starting loss of 2.30: keep the one that drops fast.
Try it in PyTorch
The bowl example, at the learning rate that explodes:
w, lr = 2.0, 1.1
for t in range(4):
w = w - lr * 2 * w
print(round(w, 3))
It prints โ2.4, 2.88, โ3.456, 4.147. Change lr to 0.5 and w lands on 0 in one step.
In a real training loop the learning rate is one argument of the optimizer. A quick sweep tries a few values a factor of ten apart:
import torch
# model = your network
for lr in (1e-1, 1e-2, 1e-3, 1e-4):
opt = torch.optim.SGD(model.parameters(), lr=lr)
... # train ~100 iterations, keep the lr whose loss drops fast
Shrinking the rate during training (decay schedules) is its own episode.
Key takeaways
- The learning rate sets how far each gradient step goes; it is chosen, not learned.
- On a bowl with curvature ฮป, each step multiplies the error by 1 โ ฮทฮป: stable only if ฮท < 2/ฮป, one jump at ฮท = 1/ฮป.
- In a real network the steepest direction sets the speed limit, so the flat directions crawl.
- Start by checking the first loss (ln C), then try rates a factor of ten apart and keep the one that drops fast.
This article is part of Deep Learning, Visually by Logit Solutions AI: short animated explainers that cover one idea at a time, each with a written version like this one.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.


