Control how far every optimizer step can move.

A learning-rate schedule is a time-varying update budget. Compare warmup, constant, linear, and cosine schedules while watching cumulative movement and the final low-rate refinement phase.

Draw the schedule

The optimizer does not experience one learning rate.

Warmup starts cautiously while moments, activations, and distributed statistics stabilize. The peak rate drives rapid movement. Decay reduces update scale later, often helping the run settle into a useful basin. The schedule must be defined against optimizer steps, not vague wall-clock progress.

Learning-rate timeline

Step 0 · warmup begins
learning rateoptimizer steps →
Current learning rate0.0

Update scale at the active optimizer step.

Warmup steps100

Optimizer updates before the peak rate.

Integrated LR budget0.17

Approximate sum of rates over the run.

Final / peak ratio10%

How softly the schedule ends.

Warmup protects the beginning

Large early updates can be unstable before adaptive moments or normalization statistics become representative. Warmup gradually exposes the model to the peak rate.

lr(t) = peak_lr × t / warmup_steps

Cosine spends more time near the floor

After warmup, cosine annealing bends smoothly from peak to minimum. Linear decay removes rate at a constant pace; neither is universally best.

lr(t) = min + ½(peak−min)(1 + cos(πp))

Count optimizer steps, not microbatches

Gradient accumulation, skipped mixed-precision updates, resumed checkpoints, and changing dataloader lengths can alter the number of parameter updates. The scheduler and optimizer must agree on when a real step occurred.

Primary reading

Attention Is All You Need Vaswani et al.CosineAnnealingLR PyTorchOptimization Schedules Hugging Face Transformers