Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Fast at first, careful at the end
A large learning rate makes quick progress but leaves the weights jittering around a good solution, because every mini-batch pushes them a bit differently. A small rate settles precisely but is slow. Schedules get both: a high rate for most of training, then a gradual reduction so the jitter dies down. Many schedules also start with a short warm-up from a tiny rate, because the first steps of a freshly initialised network can be wild.
Choosing a schedule is free, and often improves the final model as much as a better architecture. Nearly every published training recipe specifies one: cosine with warm-up for vision transformers and language models, step decay for classic ResNets, and warmup–stable–decay for recent language models because it allows training to be extended without restarting.
- 1. Annealing the learning rate at the end mainly…
- 2. Warm-up means…
- 3. Large language models commonly use…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
For a T-step run with peak rate η:
- Step: η·γ^⌊t/s⌋, for example γ = 0.1 every s = 30 epochs.
- Exponential: η·γᵗ, with γ = (η_final/η)^(1/T). To fall from 1 to 0.01 in 2 steps, γ = 0.1.
- Cosine: η_min + ½(η − η_min)(1 + cos(πt/T)). It is η at the start, η/2 halfway and η_min at the end.
- Linear warm-up: η·(t + 1)/W for the first W steps.
- One-cycle: rise linearly from about η/25 to η over the first 30%, then fall to near 0.
- Triangular (cyclical): rise and fall between η_min and η with period c.
- Warmup–stable–decay (WSD): warm up, hold η, then decay to 0 over the last 10–20% of the run.
Average rate as a fraction of the peak (T = 1000, step decay at 1/3 and 2/3):
| schedule | constant | WSD (20% decay) | one-cycle | cosine | step | exponential (to 10⁻³) |
|---|---|---|---|---|---|---|
| mean / peak | 1.0 | 0.90 | 0.51 | 0.50 | 0.37 | 0.145 |
- 1. Cosine's rate halfway through is…
- 2. WSD's average rate with a 20% linear decay is…
- 3. One-cycle's peak occurs at about…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Schedules in code
Exercise 1. All seven schedules hit their defining values: peak, end, warm-up ramp, the step drop at step 333, and the triangular cycle’s turning points. The averages are those in the table above.
Practice.
- Schedules are usually defined per optimiser step, not per epoch, so they work with any batch size.
- With Adam or AdamW use a warm-up of a few hundred to a few thousand steps (often 1–5% of the run).
- Cosine to zero (or 10% of the peak) is a robust default when the total number of steps is known in advance.
- WSD is used when it is not known: hold the peak, save checkpoints, and run a short decay from any checkpoint to get a finished model (Hu et al., 2024; Hägele et al., 2024).
- After changing the batch size, retune the peak; the schedule’s shape can usually stay.
# torch.optim.lr_scheduler: StepLR, ExponentialLR, CosineAnnealingLR, OneCycleLR, CyclicLR, LinearLR + SequentialLR- 1. Schedules are best defined per…
- 2. WSD is convenient when…
- 3. A typical Adam warm-up lasts…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Annealing and the noise floor. For SGD with step η on a quadratic with curvature μ and gradient-noise variance σ², the stationary expected loss is proportional to ησ²/(2 − ημ). It shrinks with η but never reaches zero at a constant rate. Decreasing η towards zero removes this floor, while the earlier large steps did the fast travel (A6-3-7 derives this).
Why warm-up.
- At initialisation, gradients and curvature can be large, so a full-size step can push the network into a bad region.
- Adam’s second-moment estimate v̂ is based on very few gradients early on, so its per-coordinate step sizes are unreliable.
- Post-LayerNorm transformers are known to diverge without warm-up (Xiong et al., 2020).
Liu et al. (2020) traced the second reason and proposed RAdam (E3-11) as an alternative.
Cyclical rates (Smith, 2017) periodically raise the rate. This may help escape poor regions and gives a cheap ensemble of snapshots at each low point (Huang et al., 2017).
Schedule-free methods (Defazio et al., 2024) replace the schedule by iterate averaging and reach similar results without knowing T in advance.
- 1. At a constant rate, SGD's stationary loss is proportional to…
- 2. One reason Adam needs warm-up is…
- 3. Snapshot ensembles use…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Which schedule for a small network?
History.
- H. Robbins and S. Monro (1951) gave conditions for decreasing step sizes to converge.
- Step decay became standard with AlexNet and ResNet.
- I. Loshchilov and F. Hutter (2017) introduced cosine annealing with warm restarts (SGDR).
- L. Smith (2017, 2019) introduced cyclical learning rates and one-cycle (“super-convergence”).
- P. Goyal et al. (2017) used linear warm-up to train ImageNet with large batches.
- S. Hu et al. (2024) introduced WSD for MiniCPM; A. Hägele et al. (2024) studied it at scale.
Exercise 2. The spirals network trained with Adam (mini-batches of 16, 300 steps). Each schedule was run at four peak rates; the table shows the final full-data loss, averaged over three seeds.
| schedule | 0.01 | 0.03 | 0.1 | 0.3 |
|---|---|---|---|---|
| constant | 0.022 | 0.0094 | 0.121 | 0.527 |
| step (÷10 at 1/3 and 2/3) | 0.229 | 0.036 | 0.0090 | 0.066 |
| cosine | 0.111 | 0.014 | 0.0046 | 0.028 |
| WSD (20% decay) | 0.027 | 0.0046 | 0.012 | 0.206 |
The best value in each row is reproducible. Entries above about 0.05 come from unstable runs and differ between platforms; for example, constant at 0.3 gave 0.527 natively and 0.901 in the browser.
- Cosine and WSD ended about twice as low as the best constant rate (0.0046 against 0.0094).
- Cosine’s best peak (0.1) was higher than the best constant rate (0.03). A high rate is fine if it is annealed away. WSD, which spends 90% of the peak on average, preferred a lower peak, like constant.
- Step decay only matched the constant rate: its rate fell to a hundredth of the peak for the last third of training, too early to make use of it.
- Warm-up: at peak 1.0 cosine failed with or without a 30-step warm-up (0.70 and 0.49 natively). At peak 0.3 warm-up improved the loss from 0.028 to 0.017 natively but worsened it from 0.022 to 0.051 in the browser: runs at such high rates are chaotic, and tiny rounding differences change them. So no conclusion about warm-up at 0.3 is safe from three seeds.
- Lesson: annealing to zero matters most; warm-up is a safeguard, not a substitute for a sensible peak, and its benefit on this small network was not measurable.
Schedules in AI, robotics and aerospace
- Foundation models: warm-up plus cosine or WSD is standard; WSD lets teams extend a run when more data or compute arrives.
- Perception networks for vehicles and robots are commonly trained with cosine or one-cycle schedules for strong final accuracy in a fixed budget.
- Continual retraining: WSD-style checkpoints let a fleet model be finished (decayed) at any time for deployment while the main run continues.
References
- I. Loshchilov, F. Hutter (2017). “SGDR: stochastic gradient descent with warm restarts.” Proc. ICLR.
- L. N. Smith (2017). “Cyclical learning rates for training neural networks.” Proc. WACV.
- L. N. Smith, N. Topin (2019). “Super-convergence: very fast training of neural networks using large learning rates.” Proc. SPIE 11006.
- P. Goyal et al. (2017). “Accurate, large minibatch SGD: training ImageNet in 1 hour.” arXiv:1706.02677.
- S. Hu et al. (2024). “MiniCPM: unveiling the potential of small language models with scalable training strategies.” arXiv:2404.06395.
- A. Hägele, E. Bakouch, A. Kosson, L. Ben Allal, L. Von Werra, M. Jaggi (2024). “Scaling laws and compute-optimal training beyond fixed training durations.” Advances in NeurIPS.
- A. Defazio, X. Yang, H. Mehta, K. Mishchenko, A. Khaled, A. Cutkosky (2024). “The road less scheduled.” Advances in NeurIPS.