What training benefit does a long cosine tail provide near run end?
A long cosine tail gives a smooth late-stage learning-rate landing, reducing volatility and helping checkpoints consolidate small gains.
Picture landing an airplane. The pilot does not cut the engines from full power to zero in one second. Power comes down gradually, and the last part of the approach is a long, gentle glide. During the glide the plane still moves forward, but the bumps get smaller and smaller until it settles on the runway. A long cosine tail is that glide. Near the end of training, the model still learns useful details, but each update carries some random wobble. Big steps turn the wobble into bumps. Shrinking the steps slowly lets the model keep moving forward while the bumps fade, so it settles at a lower loss and the final checkpoints stay steady. The landing only works if the pilot knows where the runway ends.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
The learning-rate schedule sets how big the optimizer's steps are at each point in training. Most large pretraining runs warm up for a short time, then follow a cosine curve down to a small floor at the last step.
A cosine curve falls slowly at first, fastest in the middle, and slowly again at the end. That last slow part is the tail. A long tail gives a lower and steadier final loss, and the reason lies in how update noise depends on the learning rate.
The shape of the cosine schedule
After warmup, the cosine schedule sets the learning rate at step t of T as:
The slope of a cosine is zero at both ends. So the learning rate leaves the peak slowly, drops fastest at the midpoint, and approaches the floor slowly. Take a peak of 3e-4, a floor of 3e-5 and 100K steps. The learning rate is 2.6e-4 at step 25K, 1.65e-4 at 50K, 5.6e-5 at 80K and 3.7e-5 at 90K. The last 20% of steps all sit below about 10% of the peak-to-floor range, and about 22% of all steps run below twice the floor.
This shape came into deep learning with SGDR, which used cosine annealing between warm restarts. Large language models use a single cycle. GPT-3 decayed to 10% of its peak over 260B of its 300B tokens, then held 10% to the end. Chinchilla decayed 10x and set the cycle length to match the number of training tokens.
So the tail is not a small add-on. In a cosine run, a fifth of the training steps happen at a learning rate close to the floor.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- GPT-3 used cosine decay to 10% of the peak learning rate over 260B tokens, then kept training at 10%.
- Chinchilla decayed the learning rate 10x on a cosine matched to the token count, and found that a cycle more than 25% too long clearly hurt.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does the loss often fall fastest during the decay rather than earlier, when the learning rate is high?
Separate progress along the valley floor from bouncing across the valley walls. Decay removes the bouncing that hid the progress already made.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Treating the tail as wasted steps because the learning rate is small. Much of the final loss drop happens as the learning rate decays, and a cycle longer than the run never gets there.
60 second bullets to scan on the way to the call.
The cosine schedule formula and its flat ends
Share of steps spent near the floor
Primary sources. Browse if you want the original framing.
- Loshchilov and Hutter, SGDR: Stochastic Gradient Descent with Warm Restarts
- Hoffmann et al., Training Compute-Optimal Large Language Models
- Hägele et al., Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations
- Wen et al., Understanding Warmup-Stable-Decay Learning Rates: A River Valley Loss Landscape Perspective
- Bergsma et al., Straight to Zero: Why Linearly Decaying the Learning Rate to Zero Works Best for LLMs
Same topic, related formats. Practice these next.