ML & Deep Learning Foundations·Question 22 of 55Intermediate

Why do transformer training recipes use learning-rate warmup, and what does the rest of the schedule look like?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Warmup ramps the LR linearly from ~0 to peak over the first few hundred to few thousand steps. Three reinforcing reasons transformers need it:

  1. Adam's second-moment estimate is unreliable early. v̂ is an EMA over a handful of noisy gradients, so the adaptive step m̂/√v̂ can be wildly mis-scaled; a full-size LR on top of that causes destructive early updates. (RAdam formalised this variance problem; warmup is the practical fix.)
  2. Early transformer training is fragile. At init, attention distributions and the loss landscape are ill-conditioned; large steps can push the model into a state with exploding gradient norms or a loss divergence it never recovers from. Original post-LN transformers were unusable without warmup; pre-LN reduced but didn't eliminate the need.
  3. Large batches. The linear-scaling regime (big batch → big LR) makes the first steps even more dangerous; Goyal et al. introduced warmup for exactly this in the ImageNet-in-1-hour work.
Full worked answer with diagram

Warmup ramps the LR linearly from ~0 to peak over the first few hundred to few thousand steps. Three reinforcing reasons transformers need it:

  1. Adam's second-moment estimate is unreliable early. v̂ is an EMA over a handful of noisy gradients, so the adaptive step m̂/√v̂ can be wildly mis-scaled; a full-size LR on top of that causes destructive early updates. (RAdam formalised this variance problem; warmup is the practical fix.)
  2. Early transformer training is fragile. At init, attention distributions and the loss landscape are ill-conditioned; large steps can push the model into a state with exploding gradient norms or a loss divergence it never recovers from. Original post-LN transformers were unusable without warmup; pre-LN reduced but didn't eliminate the need.
  3. Large batches. The linear-scaling regime (big batch → big LR) makes the first steps even more dangerous; Goyal et al. introduced warmup for exactly this in the ImageNet-in-1-hour work.

After warmup, the standard is cosine decay from peak LR down to ~10% of peak over the full token budget (the Chinchilla/Llama-style recipe). Decaying matters: high LR late in training keeps the model bouncing around the minimum; annealing lets it settle, and the final low-LR phase disproportionately improves the model.

A modern alternative worth naming: WSD (warmup - stable - decay) - hold LR constant after warmup, then decay sharply only in the last ~10-20% of training. The benefit is operational: you can branch a decayed "finished" checkpoint off a still-running stable-phase run at any time, which suits continued pretraining and data-mixture experiments (popularised by MiniCPM, and close in spirit to the multi-step and constant-then-decay schedules in DeepSeek's reports).

Worth sketching. Drawing WSD as a branch off the stable phase explains its whole selling point: you can cut a finished checkpoint whenever you like.

flowchart LR
    A["LR near zero"] -->|"linear ramp over<br/>hundreds to thousands of steps"| B["Peak LR"]
    B -->|"cosine decay over<br/>the token budget"| C["About 10% of peak"]
    B -->|"WSD: hold flat"| D["Stable phase"]
    D -->|"sharp decay over<br/>the last 10 to 20%"| E["Finished checkpoint"]
    D -->|"branch at any point"| F["Data mixture and continued<br/>pretraining experiments"]

What a good answer covers

  • Warmup ramps the LR linearly from ~0 to peak over the first few hundred to few thousand steps
  • Adam's second-moment estimate is unreliable early
  • Early transformer training is fragile
  • Large batches
  • After warmup, the standard is cosine decay from peak LR down to ~10% of peak over the full token budget…

Key terms: Warmup · Early transformer training is fragile · Large batches · cosine decay

Interviewer follow-ups to expect

  1. What actually goes wrong if you skip warmup - describe the failure signature in the loss/grad-norm curves. Why does cosine-to-zero interact badly with wanting to resume training?

  2. How would you set peak LR for a model 10× bigger?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep