Learning Rate Warmup › A Worked Example
Language AI HandbookAll chapters Learning Rate Warmup › A Worked ExampleOne section · Sections in this chapter11 / 16 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To make warmup concrete, let's trace through a specific training configuration and see exactly what the learning rate schedule looks like.
Consider training a medium-size transformer (300M parameters) with these settings:
- Total training steps: 100,000
- Warmup steps: 2,000
- Peak learning rate:
- Minimum learning rate:
- Decay schedule: cosine decay after warmup
At step , the warmup formula gives:
This is nearly zero. Adam's statistics are unreliable at this point, and this tiny learning rate ensures the first update is tiny and harmless regardless of the gradient magnitude.
At step , halfway through warmup:
Adam has now seen 1,000 gradient observations and has reasonable second-moment estimates. The learning rate is half the peak, which is a meaningful training rate while still being conservative enough for the optimizer's current state.
At step , warmup complete:
The learning rate reaches its peak. Adam's second-moment estimates have stabilized (we crossed the threshold), and the model has begun to develop basic representations. Cosine decay begins from this point.
At step , end of training, the cosine decay progress is , giving:
The learning rate ends at the minimum, one-tenth of the peak. This final low learning rate allows the model to fine-tune its parameters without overshooting the local minimum it has found during the main training phase.
Scaling Up: From 256 to 4,096 Batch Size
Now consider what happens when you scale the same 300M parameter model to a larger compute cluster, increasing batch size from 256 to 4,096 (a 16x increase). Applying the linear scaling rule:
New peak learning rate:
New warmup steps:
The first update at step 1 with the new configuration is:
Notice that the first-step learning rate is identical to the original configuration. This is not a coincidence. When both the peak learning rate and the warmup duration scale by the same factor , their ratio stays constant, and the per-step learning rate at any fractional position within warmup is preserved. This is the mathematical reason the two configurations are training-equivalent during warmup: the gradient step sizes at each warmup fraction are the same, and the model sees the same effective learning rate trajectory relative to the total warmup budget.
This equivalence breaks at the level of absolute step count: the large-batch run completes the same fractional training milestone in far fewer wall-clock steps (because each step processes 16x more data), but the per-token compute and gradient statistics at each checkpoint are comparable. This is why the linear scaling rule with proportional warmup maintains training quality: it preserves the statistical structure of the training trajectory across batch size changes.
The Effect of Warmup on Adam's Moment Estimates: A Concrete Trace
To make the optimizer-statistics argument tangible, let's trace exactly what happens to Adam's second-moment estimate for a single parameter across the first 2,000 steps of warmup.
Suppose a particular embedding parameter has a true gradient standard deviation of . The true gradient variance is . We want Adam's second-moment estimate to converge to this value before taking large steps.
With , the bias-corrected second moment at step converges toward the true variance as:
But the expected value alone does not tell the whole story. The variance of around its expected value is the issue. At step (very early in warmup), the estimate is based on only 10 noisy gradient observations, heavily weighted toward the initial zero. The relative error in the estimate can easily exceed 50%, meaning the optimizer might behave as if the true gradient variance is or instead of . A 2x error in the second-moment estimate translates directly to a error in the step size, since Adam's update scales as .
By step , the exponential moving average has accumulated enough samples that the estimate is reliable. The initialization influence has decayed to , meaning only 37% of the second-moment estimate's weight is still on the zero initialization, while 63% comes from actual gradient observations. At this point, the step size variation due to estimation error is under 10%, which is acceptable for taking large updates safely.
This is precisely why warmup duration and the Adam parameter are tightly linked. If you reduce to 0.99, the initialization influence at step 100 is already , matching what takes 1,000 steps with . A lower effectively speeds up the statistics stabilization, allowing shorter warmup. This relationship is exploited in some modern training setups that use to enable faster adaptation during early training and continued training stages.