The problem with cosine
A learning-rate schedule sets how big each optimiser step is over a run. The usual recipe for language models is a short linear warmup and then a cosine decay: half a cosine from the peak learning rate down to a small final value at the last step. With warmup , run length , peak and final fraction ,
The trouble is . The curve bends from the first step after warmup, and how fast it bends depends on how long the run will be, so a cosine run has to know its length before it starts. A checkpoint from the middle of it is not a finished model, because its learning rate is still high, and the run cannot be extended past without restarting the decay. Comparing four training lengths, as a scaling study must, means four separate runs. The Learning rate panel shows this: pick another length and the whole cosine curve changes with it.
Warmup, stable, decay
Warmup–stable–decay (WSD) splits the schedule into three parts. The warmup is the same as cosine's: here 100 steps rising linearly to the peak, 4e-3 (the AdamW tab's learning rate). Then the learning rate stays at the peak, the stable phase, for as long as wanted. Only at the end does it decay, here over the last 20 % of the run, down to the same peak that cosine ends at:
Here runs from 0 at the first decay step to 1 at the last, and is the decay shape. Until the schedule does not depend on at all. So one constant run, the trunk, serves every length: to get a finished model of steps, take the trunk's checkpoint at step and decay from there.
One trunk, every length
The page trains exactly that. The trunk runs 2,000 steps at the peak and saves its weights, AdamW's two moments and the batch generator's state at steps 200, 400, 800 and 1,600. Four linear decays branch off those checkpoints and end at 250, 500, 1,000 and 2,000 steps. Four cosine runs of the same lengths start from scratch with the same seed, batches and peak. Because each branch restores the generator, it sees exactly the batches a WSD run of that length from scratch would. Its first loss equals the trunk's at that step exactly.
The One trunk, every length table puts the results side by side. Here WSD ends below cosine at every length: 3.135 against 3.194 after 250 steps, 2.551 against 2.622 after 500, 2.141 against 2.203 after 1,000 and 1.877 against 1.908 after 2,000. How much of that is noise? Two runs from step 0 with the same settings do not stay bitwise identical on this GPU, and by the end of warmup their validation losses differ by up to 0.011, so the gaps of 0.03 to 0.07 are real but not large. Hägele et al. found at larger scale that a short cooldown, 20 % of the run or less, matches a cosine schedule tuned to that length.
The cost is the point. The four cosine runs take 3,750 steps; the trunk and four decays take 2,750, and any further length up to 2,000 steps needs only its own decay.
What the decay does
The Validation loss panel shows WSD's characteristic shape. On the flat stretch the loss keeps falling, but slowly: the trunk goes from 2.113 at step 1,600 to 2.053 at step 2,000, a gain of 0.060. The decay over the same 400 steps gains 0.236, from 2.113 to 1.877, and ends 0.176 below the trunk. A cosine run spreads that improvement over its whole length instead.
Why the flat stretch stalls and the decay helps has a simple picture, due to Wen et al.: the loss surface is like a river valley, steep across and gently sloping along. At a high learning rate each step overshoots across the valley, so the weights bounce between the walls while still drifting along the floor. Lowering the learning rate stops the bouncing and lets the weights settle onto the floor, and the progress made along the valley shows at once.
The bouncing is in the weights, not in the minibatch loss. In the The decay phase panel the loss on each step's own batch jumps about as much in the decay as on the flat trunk: its spread around a 40-step mean is 0.073 on the trunk and 0.074 late in the decay, because most of it is how hard each batch is. The What the decay does to the weights panel shows the weights directly. From the same checkpoint at step 1,600, the trunk's weights move by 41–42 % of their size in the next 400 steps and the linear decay's by 27–28 %. The decay does not take the weights further; it takes them lower.
Decay shapes
How the learning rate falls during the decay matters less than that it falls. The page decays the 2,000-step run three ways from step 1,600:
- linear,
- , , which drops fast at first and slowly at the end (Hägele et al.)
- cosine, , which drops slowly at first
They end at 1.872 (), 1.877 (cosine) and 1.877 (linear). The decay ends lowest, as Hägele et al. found, and moves the weights least (22–23 %), but its lead here is smaller than the drift between identical runs, so this small model cannot rank the shapes.
Where it came from
Constant learning rates with a drop at the end are old: image classifiers were trained with step schedules that cut the rate by 10 at fixed epochs, and Goyal et al. showed that a short warmup keeps large-batch training stable. Loshchilov and Hutter's SGDR introduced the cosine curve that became the language-model default. MiniCPM (Hu et al., 2024) named the warmup–stable–decay schedule and used it to train small models whose checkpoints could be decayed at any length. Hägele et al. (2024) showed that it reproduces cosine's losses while making scaling-law sweeps much cheaper. The Chinchilla tab uses that trick: its width-256 row is this trunk and these decays. The AdamW tab chooses the peak learning rate used here; μP shows how to keep it as the model grows.
Papers
- MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies Introduces the warmup–stable–decay schedule: a flat learning rate that can be decayed from any checkpoint, so one run serves many lengths.
- Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations Shows that a short cooldown from a constant learning rate matches cosine at every length, compares decay shapes (1 − √ among them) and branches cooldowns off one run, as this tab does.
- SGDR: Stochastic Gradient Descent with Warm Restarts The cosine learning-rate schedule the WSD runs are compared with.
- Understanding Warmup-Stable-Decay Learning Rates: A River Valley Loss Landscape Perspective Explains why the loss barely falls at a flat learning rate and drops during the decay: the weights move along a valley's floor while bouncing between its walls.
- Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour The linear warmup every run here starts with.