Skip to content
AI.info

Training and optimization

Warmup, Decay, Restarts, and Schedule Design

Compare common learning-rate schedules, understand what their clocks measure, and align schedule phases with optimization evidence and training budgets.

By the end you can

Visual

A schedule is a policy over training time

The clock and the transition rules are part of the optimizer configuration. Each phase below is a decision somebody has priced, not a law of optimization. Before drawing any conclusion about which schedule was better, Shallue and colleagues tuned the learning rate, the momentum and the learning-rate decay schedule independently at every batch size, across 35 workloads. The rest of this lesson quotes the runs where each phase was actually measured. Batch size, budget and error bars attached.

FigureTimeline · 4 stops
  1. Initialization phase

    Small or cautious updates protect unstable activations and immature optimizer state.

  2. Rapid learning phase

    A larger rate explores useful directions and changes representations quickly.

  3. Refinement phase

    Lower rates reduce oscillation and make smaller corrections.

  4. Selection phase

    Late checkpoints are evaluated, averaged, or stopped under a declared policy.

Example

Warmup can address several different early-run problems

A warmup is useful only when its mechanism matches the failure. The first two cases below are not conjectures. Both were measured at a fixed peak rate by groups who published their error bars. In one of them the wrong warmup shape came out worse than no warmup at all.

  • Large global batch: the shape of the ramp is worth more than a point of top-1 error. Goyal and colleagues held ResNet-50 on ImageNet fixed and varied only the warmup. At minibatch 256 with learning rate 0.1 the baseline reached 23.60% ±0.12 top-1 validation error. At minibatch 8,192 the linear scaling rule — “When the minibatch size is multiplied by k, multiply the learning rate by k” — gives a reference learning rate of 3.2. The identical recipe then gave 24.84% ±0.37 with no warmup, 25.88% ±0.56 with a constant warmup held at 0.1 for 5 epochs, and 23.74% ±0.09 with a gradual warmup ramping linearly from 0.1 to 3.2 over the same 5 epochs. That last configuration is the one that trained in one hour on 256 GPUs. The paper is blunt about the middle one: “A constant warmup strategy (2b) actually degrades results: although the small constant learning rate can decrease error during warmup, the error spikes immediately after and training never fully recovers.” Shallue and colleagues, describing the same experiment from outside, mark where it stops: “Using this heuristic, a 90 epoch budget, and SGD with momentum without adjusting or tuning the momentum, they increased the batch size from 64 to 8,192 with no loss in accuracy. However, their learning rate heuristic broke down for even larger batch sizes.” The wrong warmup was worse than none.
  • Transformer training: whether early gradients are destructive depends on where layer normalization sits. Xiong and colleagues proved with mean field theory that at initialization the Post-LN Transformer has large expected gradients near the output layer, and showed experimentally that Pre-LN Transformers train to comparable results with the warm-up stage removed entirely. Their abstract draws the consequence in one line: “This motivates us to remove the warm-up stage for the training of Pre-LN Transformers.” A different group, on a different grid, found the same split. Liu and colleagues report: “Pre-LN converges in all 15 settings, and Post-LN diverges in 7 out of 15 settings; when Post-LN converges, it outperforms Pre-LN in 7 out of 8 settings”. Warmup here is a property of the architecture, not of Transformers as such.
  • Fine-tuning: Newly initialized heads and pretrained layers may need different early adaptation speeds.
  • Mixed precision: Initial overflows may interact with dynamic loss scaling and conceal a rate that becomes safe later.
  • Data curriculum: Early batches may differ systematically, so schedule and sampling phases should be designed together.

Comparison

Common schedules encode different beliefs about progress

They are policies, not universal laws. Each of the four families below has published numbers behind the belief it encodes.

Piecewise and cosine have been compared under matched tuning. Shallue and colleagues swept ResNet-50 on ImageNet with Nesterov momentum, batch size 1,024 and 150,000 steps, across six decay functions — constant, linear, cosine, exponential polynomial, inverse exponential polynomial and exponential — plus piecewise linear schedules with 1, 3 and 5 decay events. No family won: “it was possible to get good results with several of the schedules we tried”. They adopted linear decay only because it “performed at least as well as all other schedules we tried, while also being the simplest”.

Cosine's tie to a horizon fixed in advance has a measured cost. A 2024 paper opens its abstract with the complaint: “In this work, we argue that scale and training research has been needlessly complex due to reliance on the cosine schedule, which prevents training across different lengths for the same model size.” Hägele and colleagues replaced cosine decay with a constant learning rate plus a linear cooldown over the last 20% of steps. On a 210M-parameter model trained on SlimPajama that matched cosine almost exactly. A (1−sqrt) cooldown over only 5% of steps nearly matched cosine on a 20-billion-token run. On how much cooldown is enough, they report that “the benefits of extended cooldown periods plateau at around 20%”. The refinement phase can be a fifth of the run rather than the shape of the whole run.

Plateau response is not a vague idea. It is a shipped decision rule with published defaults, and the two dominant frameworks chose the same ones. Keras 3 states the premise — “Models often benefit from reducing the learning rate by a factor of 2-10 once learning stagnates.” — and its ReduceLROnPlateau callback defaults to monitor="val_loss", factor=0.1, patience=10, min_delta=0.0001 and cooldown=0. PyTorch 2.8's ReduceLROnPlateau — “Reduce learning rate when a metric has stopped improving.” — defaults to mode='min', factor=0.1, patience=10, threshold=0.0001 and cooldown=0. Those four numbers are the entire policy: how much to cut, how long to wait, what counts as an improvement, and how long to ignore the metric afterwards. Note what patience=10 counts. Not steps, not epochs: evaluation events. Change the validation cadence and you have changed the schedule without touching the schedule.

Cyclical and restart policies come with an accuracy-per-iteration figure. On CIFAR-10 a fixed-schedule baseline reached 81.4% test accuracy after 70,000 iterations. The triangular2 policy reached the same 81.4% after 25,000. In the same table a plain decay policy at 25,000 iterations gave 78.5%, and an exponential policy at 70,000 gave 79.1%. Leslie N. Smith published those runs in 2015, together with the LR range test and the triangular policies. The three policies he named — triangular, triangular2 and exp_range — are the three modes PyTorch ships to this day, in a scheduler documented as one that “Sets the learning rate of each parameter group according to cyclical learning rate policy (CLR).”

FigureComparison · 4 columns

Piecewise decay

Hold a rate, then reduce it at chosen milestones.

  • Strength: easy to inspect
  • Risk: brittle milestones
  • Clock: usually steps or epochs
  • Use: stable known recipes

Cosine decay

Decrease smoothly toward a lower endpoint.

  • Strength: gradual refinement
  • Risk: tied to planned horizon
  • Clock: fixed budget
  • Use: finite training runs

Plateau response

Reduce after validation progress stalls.

  • Strength: evidence-triggered
  • Risk: noisy metric decisions
  • Clock: evaluation events
  • Use: moderate-cost experiments

Cyclical or restart

Raise the rate again according to a cycle.

  • Strength: renewed exploration
  • Risk: extra instability
  • Clock: cycle definition
  • Use: selected optimization regimes

Warmup can hide a bad peak rate rather than solve it

A long warmup may postpone divergence until expensive compute has already been spent. It can also consume a large fraction of a short fine-tuning run.

Test the peak region, inspect early update ratios, and compare against a genuinely lower-rate baseline. Warmup should have a diagnosed purpose.

The original Transformer paper turned warmup into a formula. Vaswani and colleagues describe “increasing the learning rate linearly for the first warmup_steps training steps, and decreasing it thereafter proportionally to the inverse square root of the step number”, and then fix the constant: “We used warmup_steps = 4000.” The same section opens with the optimizer the ramp sits inside — “We used the Adam optimizer [20] with β1 = 0.9, β2 = 0.98 and ϵ = 10−9”. The ramp, the decay and the moment estimates were chosen together, in one arrangement.

What a diagnosis looks like in practice is the Pre-LN result. Xiong and colleagues did not tune the warmup. They located the cause — large expected gradients near the output layer of a Post-LN Transformer at initialization — moved the layer normalization, and removed the warm-up stage entirely. The reverse move confirms the diagnosis rather than contradicting it. Where the cause is still present, Liu and colleagues report that “removing the warmup stage in Transformer training results in more severe consequences such as model divergence”. The same deletion is safe in one architecture and fatal in the other. That is what it means for warmup to have a purpose. You can say which failure it is holding back, and you can name the change that would make it unnecessary.

Do not use warmup as an amnesty for an unsafe schedule.

Choose a clock that matches the consumed resource

An epoch changes meaning when dataset size, sampling, accumulation, or worker count changes. Step count changes meaning when batch size changes.

For language training, tokens often provide a clearer budget. Other tasks may use examples, frames, environment interactions, or optimizer updates. Record the chosen clock explicitly.

The clock and the budget have to be the same number. Hoffmann and twenty-one co-authors tied one to the other. They find that “setting the cosine cycle length too much longer than the target number of training steps results in sub-optimally trained models”, and give the rule in tokens: “when training a model over D tokens, we should pick a cosine cycle length that decays 10× over approximately D tokens”. A schedule stretched past the run leaves the model mid-decay.

The sharpest demonstration that optimizer steps are a poor clock is a paper in which the schedule and the batch are interchangeable. Samuel L. Smith and colleagues open their abstract with the substitution: “It is common practice to decay the learning rate. Here we show one can usually obtain the same learning curve on both training and test sets by instead increasing the batch size during training.” It holds for SGD, SGD with momentum, Nesterov momentum and Adam, reaching equivalent test accuracies after the same number of epochs but with far fewer parameter updates. The conference version closes with “We train ResNet-50 on ImageNet to 76.1% validation accuracy in under 30 minutes.”; the earlier version of the abstract closes with “We train Inception-ResNet-V2 on ImageNet to 77% validation accuracy in under 2500 parameter updates, efficiently utilizing training batches of 65536 images”. Under 2,500 updates is not a small amount of training. It is a normal amount of training counted on the wrong clock.

A schedule cannot be interpreted without knowing what advances it.

Steps

Design a schedule from the budget backward

Start with the evidence horizon, then choose phases. Step 2's “short range test” is not folklore. It has an author and a procedure. Leslie N. Smith set it out: “It is a “LR range test”; run your model for several epochs while letting the learning rate increase linearly between low and high LR values.” On the CIFAR-10 network in that paper the test suggested bounds of 0.001 and 0.006, and those bounds are what the cyclical runs were then built on. The point of the step is that the peak region is measured under the batch regime you will actually train in, before any warmup or decay is layered on top of it.

FigureProcess · 5 steps
  1. 1. Define the total resource

    Specify optimizer steps, tokens, examples, or wall-clock budget.

  2. 2. Estimate the peak range

    Use prior evidence or a short range test under the target batch regime.

  3. 3. Diagnose the start

    Add warmup only when early instability or state formation justifies it.

  4. 4. Choose a refinement policy

    Set decay or plateau rules that leave enough budget for smaller corrections.

  5. 5. Align evaluation cadence

    Ensure validation can observe each schedule phase without excessive test reuse.

Analogy

A runner planning effort across a race

Runners start cautiously, settle into a strong pace, and reserve controlled effort for the finish. A single pace may waste energy or cause an early collapse.

The plan works only because the distance is known before the gun. Warmup, decay and restarts make the same bet on a budget fixed in advance: phase-aware control under a finite budget. The analogy also marks where the bet can be dropped. A constant rate followed by a cooldown over the last fifth of the run is the runner who does not need the distance announced in advance. That is why such a schedule can be stopped at several lengths for the same model size, and a cosine cannot.

Schedule design allocates update magnitude across the run.

A fair schedule comparison must match more than final step

Compare equal data and compute budgets, the same checkpoint-selection rule, and equivalent validation access. One schedule may appear better because it receives more effective exploration or more selection opportunities.

The largest controlled test of that suspicion is a public database of 71,638,836 loss measurements, over 168,160 individual models, across 35 workloads. Shallue and colleagues released it in 2019, having tuned the learning rate, the momentum and the learning-rate decay schedule independently at every batch size. The finding is stated in the abstract: “Along the way, we show that disagreements in the literature on how batch size affects model quality can largely be explained by differences in metaparameter tuning and compute budgets at different batch sizes.” They were not resolving the argument about which setting wins. They were showing that most of the argument was about unequal tuning and unequal budgets. Once those were held equal in their own schedule sweep, “it was possible to get good results with several of the schedules we tried”. A schedule comparison that is not tuned equally at both settings is reporting the tuning.

Plot performance against examples, tokens, wall-clock time, and energy when those budgets matter. A schedule can win on one axis and lose on another. Loshchilov and Hutter argued restarts on the same terms. Their SGDR decays the rate within each run and then restarts it warm — “Within the i-th run, we decay the learning rate with a cosine annealing for each batch” — and on CIFAR-10 and CIFAR-100 they “demonstrate new state-of-the-art results at 3.14% and 16.21%, respectively”. Those two numbers mean something only because both arms saw the same budget. A restart schedule handed extra epochs proves nothing at all.

Schedule quality is inseparable from the resource and selection policy.

Position

A schedule constant is a fact about one run, never a default

Schedule advice travels as constants. “We used warmup_steps = 4000.” The line gets pasted into configs that share little with the run it came from. Read the sentences around it and it stops travelling so easily. Vaswani and colleagues were describing one arrangement: the rate rises linearly for the first warmup_steps training steps, decays thereafter by the inverse square root of the step number, and Adam runs underneath it — “We used the Adam optimizer [20] with β1 = 0.9, β2 = 0.98 and ϵ = 10−9”. Four thousand is a coordinate inside that setup, not a property of warmup.

The unit is the harder problem. Warmup there is counted in steps. This lesson has already said what a step is worth: step count changes meaning when batch size changes. Samuel L. Smith and colleagues showed the strong form of that. Decay and batch growth are substitutable, so the same learning curve can be reached with a fixed rate and a growing batch — reaching 77% validation accuracy “in under 2500 parameter updates, efficiently utilizing training batches of 65536 images”. Four thousand steps under one batch regime and four thousand under another are different quantities of training. The same number, a different amount of data through the model.

A constant can also be right only in company. The gradual warmup of Goyal and colleagues ramps from 0.1 to 3.2 over 5 epochs. Detach it from the minibatch of 8,192 and from the linear scaling rule that produced 3.2, and there is nothing left to ramp toward. Detach the shape and it inverts: the constant warmup, same length, same batch, same peak, gave 25.88% ±0.56 against 24.84% ±0.37 for no warmup at all. Five epochs is not the finding. The relationship between the ramp, the batch and the peak is the finding.

The matching failure at the other end of the curve was measured too. Hoffmann and twenty-one co-authors find that “setting the cosine cycle length too much longer than the target number of training steps results in sub-optimally trained models”. Their rule sets a cycle that decays tenfold over roughly the tokens the run will see. A schedule inherited from a larger budget does not quietly shrink to fit yours. It leaves the model mid-decay.

Sometimes the constants are not copied by a person at all. They arrive as defaults. Keras 3 and PyTorch 2.8 both ship plateau decay at factor=0.1, patience=10, threshold or min_delta 0.0001 and cooldown=0. Nobody diagnosed those four numbers for your run, and patience=10 is counted in your evaluation events, at whatever cadence you happened to set.

Something does survive copying, and it is not the numbers. Warmup survives as a diagnosis: this was unstable early, here is the evidence, here is the change that would make it unnecessary — Xiong and colleagues moved the layer normalization and removed the warm-up stage. Decay survives as an assumption about a horizon fixed in advance, an assumption Hägele and colleagues showed you can drop for a constant rate plus a cooldown over the last 20% of steps. Restarts survive as a comparison discipline: the 3.14% and 16.21% of Loshchilov and Hutter count because the arms shared a budget, and Shallue and colleagues then found across 168,160 models that most published disagreement was tuning and budget rather than the setting under study.

So a schedule number is never a setting on its own. Ask what advances the clock, how long the run is, and at what batch size. Without those three, a schedule is a shape rather than a configuration.

Key takeaways