Concepts / Learning Rate Schedules

Learning Rate Schedules

A learning rate schedule can be checked by recording the rate at every training step and plotting those values.

  • Programming

Predicting the Shape Before Looking

Training code that changes a learning rate can look correct on the page and still behave differently when it runs. One practical way to check is to record the learning rate at every training step and then draw those recorded values as a graph. The graph turns a list of numbers into a shape you can inspect at a glance. Before reading any explanation, try to guess what that shape should be.

What do you think happens?

A learning rate schedule has a linear warmup phase followed by cosine decay. What overall shape should the plotted learning rate have across training steps?

  • It stays flat for the whole run

  • It rises during warmup, then falls along a cosine-shaped curve

  • It falls first, then rises steadily until the end

  • It jumps up and down at random

Reveal answer
Answer:

It rises during warmup, then falls along a cosine-shaped curve.

The source describes a rise-then-fall pattern: a linear warmup that increases the rate until it reaches its maximum, followed by cosine decay that reduces the rate gradually toward its minimum. If your guess matched the rise-then-fall pattern, you already have the main structure.

What a Learning Rate Schedule Is

Definition

A learning rate schedule is a rule that sets the learning rate as training progresses, rather than keeping it fixed.

The schedule described in this article has two named phases that occur in order. The first is the linear warmup phase, and the second is cosine decay. The learning rate starts with the warmup, and cosine decay takes over only after the warmup has finished. Because the phases are ordered, you can describe any step in a run by asking which phase it belongs to.

Tracing the Warmup Phase

During the warmup phase the learning rate increases in a linear way. In the schedule this article describes, the warmup lasts 20 steps and the rate climbs until it reaches its maximum. The index map below marks the three positions that matter most when you trace the early part of the curve: the first step, the end of warmup, and the later steps where decay happens.

Step 0warmup begins, rate is lowStep 10still rising linearlyStep 20warmup ends, maximum rateStep 40cosine decay, fallinggraduallyFinal steprate reduced toward minimumrisingrisingfallingfalling
As the step count increases, the learning rate rises during warmup, peaks at the end of the 20-step warmup, and then falls along a cosine curve.
Worked example

Which phase does a given step belong to?

Using the source's 20-step warmup, decide whether step 12 and step 27 fall in the warmup phase or the cosine decay phase, and what the learning rate should be doing at each.

  1. 1
    Recall the warmup length

    The warmup phase lasts 20 steps, so steps up to the end of warmup belong to the linear rise.

  2. 2
    Place step 12

    Step 12 comes before the 20-step boundary, so it belongs to warmup. The rate should be on its steady climb toward the maximum.

  3. 3
    Place step 27

    Step 27 comes after the boundary, so it belongs to cosine decay. The rate should now be falling gradually rather than rising.

Result

Step 12 is in warmup and should be rising. Step 27 is in cosine decay and should be falling gradually.

Where Cosine Decay Takes Over

Cosine decay starts only after the warmup ends. At that handoff the rate has reached its maximum, and from there it is reduced gradually until it reaches its minimum. The timeline below shows the order of these transitions, with the peak marking the boundary between the two phases.

Warmup beginsrate starts risingWarmup endsrate reaches its maximumCosine decayrate reduced graduallyMinimum reachedrate at its lowestlinear risehandoffgradual fall
The rate rises linearly until the warmup ends at its maximum, then cosine decay reduces it gradually toward its minimum.

Recording Rates and Plotting Them

The check works in three connected parts. The scheduler sets the learning rate for each step. The training run records the rate it used at every step. A plotting call then takes the step indices, one per training step, together with the recorded learning rates, and draws them with labeled axes. The plot is only as trustworthy as the recording, so the question to keep in mind is what shape the intended schedule should produce.

Schedulersets rate for each stepRecorded ratesone value per training stepPlotstep indices against ratesShape checkrise, peak, then fallrecorded each stepdrawn with axescompared to intended shape
The scheduler sets the rate, each step's rate is recorded, and the recorded values are plotted so the shape can be inspected.

The purpose of the plotting call is to confirm that the learning rate changed as intended. A plot that matches the rise-then-fall pattern is evidence that the schedule is doing what it was written to do. The plot turns a list of numbers into a shape, and that shape is what you compare against the expectation.

Finding Where a Plot Departs

When a plot does not match what you expected, the useful question is where it first diverges. Because the schedule has two ordered phases, you can check them in sequence. First confirm that the early segment rises steadily for the warmup length. Then find the point where the rise stops and check that the decline after it is gradual.

  • Common mistake

    Judging the whole curve at once

    Why it fails

    A single glance hides which phase is wrong, so you cannot tell whether the warmup or the handoff caused the problem.

    Do this instead

    Find the first step where the curve stops matching the expected phase, then check the phases in order.

  • Common mistake

    Expecting a fall during warmup

    What it looks like

    The rate drops over the first 20 steps instead of climbing.

    Why it fails

    Warmup is defined as a linear increase until the maximum is reached.

    Do this instead

    A falling curve before step 20 points to a problem in the warmup phase.

  • Common mistake

    Ignoring a rise after warmup should have ended

    What it looks like

    The rate keeps climbing past the 20-step boundary.

    Why it fails

    Cosine decay starts once warmup ends, so the rate should no longer be rising at that point.

    Do this instead

    A continued rise after the boundary points to a problem at the handoff between phases.

  • Common mistake

    Accepting a sharp drop during decay

    What it looks like

    The rate falls abruptly in the decay phase.

    Why it fails

    The source describes cosine decay as reducing the rate gradually, so a sharp drop does not match the expected shape.

    Do this instead

    Treat a steep decay as a departure from the expected curve and check the code that computes the decay.

Practice Reading a Plot

MEDIUM

A recorded schedule rises steadily from step 0 through step 20, then keeps rising until about step 35 before it starts to fall. Which phase boundary is misplaced or broken, and at which step does the plot first depart from the expected shape?

Hints
  • Start by confirming whether the early segment rises for the full 20-step warmup length.
  • Look for the point where the rise stops and compare it to the expected handoff at the end of warmup.
  • The first step where the curve stops matching the expected phase is the answer you need.

Summary of the Schedule Check

A warmup-then-cosine schedule rises linearly for 20 steps to its maximum, then falls gradually toward its minimum under cosine decay. Recording the rate at every step and plotting those values turns the schedule into a shape you can check. When a plot disagrees with that shape, locate the first step where it departs, rather than judging the whole curve at once.

At a glance

  • A learning rate schedule sets the rate as training progresses instead of keeping it fixed.
  • The described schedule has a linear warmup phase of 20 steps that rises to a maximum, followed by cosine decay that reduces the rate gradually toward its minimum.
  • Recording the learning rate at every training step and plotting those values lets you verify that the schedule behaves as intended.
  • To debug a plot, find the first step where the curve stops matching the expected phase, starting with the handoff at the end of warmup.

Related concepts

More concepts starting with L