Why a constant rate is the wrong answer twice
Early in training the parameters are random, so large steps are cheap and useful. Late in training they are nearly right, and a large step overshoots a minimum it had already found.
One constant rate has to serve both, so it is either too small at the start or too large at the end. A schedule is the admission that the right rate changes.
Warmup, and what it is protecting
For the first few hundred or few thousand steps the rate is ramped from near zero up to its peak.
Adaptive optimisers need it most. The second moment estimate is built from almost no samples at step one, so the adaptive denominator is unreliable exactly when the steps are largest.
Skipping warmup on a transformer is a common way to produce a loss that diverges in the first hundred steps and never recovers.
Cosine decay, which is the current default
- : the total number of steps planned.
- : the floor, often a tenth of the peak or zero.
It falls slowly at first, fastest in the middle, and slowly again at the end, which spends most of the budget near useful rates rather than near the extremes.
Step decay multiplies by a constant every steps instead. It works, and the visible drops in the loss curve at each step are a sign of a rate that had been too large for a while.
One schedule, in order
- Fix the total number of steps in advance, because cosine needs to know where the end is.
- Ramp linearly from near zero to the peak over the warmup steps.
- Decay by cosine from the peak towards the floor over the remaining steps.
- Update the rate every step rather than every epoch.
- Log it alongside the loss, so a bad schedule is visible rather than inferred.
The interaction nobody expects
The peak rate and the batch size are tied. A run that works at batch 256 will often diverge at batch 1024 unless the peak rate is raised with it.
Model width matters too. A wider model needs a smaller peak rate, which is why the same recipe fails when scaled up without adjustment.
Changing the total step count changes the whole curve, so a run stopped early under a cosine schedule did not reach the low rates where most of the final accuracy is won.
That is the one real drawback: the schedule commits to a budget before the first step, and a shortened run is not the same as a shorter schedule.