Learning rate scheduler calculator

Pick a schedule, the initial learning rate and the step or epoch you are interested in. The calculator gives the learning rate there, using the same formulas as PyTorch's schedulers and Hugging Face's warmup schedules, so you can check a config before a long training run.

Learning rate at t0.0008535534
Share of the initial rate
0.853553
Phase
Decay

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose a schedule.
  2. Enter the initial learning rate, the step t you want to check and the total T.
  3. Optionally set warmup steps, and the schedule’s own settings: decay interval and γ, final rate or power.
  4. Read the learning rate at t, its share of the initial rate and whether t is in warmup.

Formulas

With warmup W, τ = t − W counts steps after warmup and L = T − W is the decay length.

  • Warmup (t < W): lr = lr₀ × t ÷ W
  • Step: lr = lr₀ × γ^⌊τ ÷ s⌋
  • Exponential: lr = lr₀ × γ^τ
  • Cosine: lr = min + (lr₀ − min) × (1 + cos(π τ ÷ L)) ÷ 2
  • Linear: lr = lr₀ + (min − lr₀) × τ ÷ L
  • Polynomial: lr = (lr₀ − min) × (1 − τ ÷ L)^p + min

For cosine, linear and polynomial, τ stops at L: after T steps the rate stays at the final value.

Worked example

Cosine annealing from 0.001 to 0 over 100 epochs, no warmup, at epoch 25:

  • τ ÷ L = 25 ÷ 100 = 0.25, cos(π × 0.25) = 0.70711;
  • (1 + 0.70711) ÷ 2 = 0.853553;
  • lr = 0.001 × 0.853553 = 0.0008535534, that is 0.853553 of the initial rate.

With 10 warmup epochs, epoch 5 gives 0.001 × 5 ÷ 10 = 0.0005; epoch 55 is 45 of the 90 decay epochs — exactly halfway — and also gives 0.0005.

Step decay from 0.1, ×0.1 every 30 epochs: at epoch 65, ⌊65 ÷ 30⌋ = 2 decays, so lr = 0.1 × 0.1² = 0.001.

Tips

  • Warm up large models. A few hundred to a few thousand warmup steps keep Adam from taking huge first steps while its statistics are still noisy.
  • Keep a floor. A small final rate (for example 10 % of the initial one) often works better than decaying all the way to 0.
  • Count the total steps exactly: epochs × batches per epoch. The train/test split calculator gives the batches per epoch.

Frequently asked questions

What is cosine annealing?

A schedule that lowers the learning rate along half a cosine wave: lr = min + (lr₀ − min) × (1 + cos(π t ÷ T)) ÷ 2. It starts flat, falls fastest in the middle and flattens again near the end. It is PyTorch's CosineAnnealingLR without restarts and a very common default for training transformers and CNNs.

How does warmup work?

During the first W steps the rate rises linearly from 0 to the initial rate: lr = lr₀ × t ÷ W, as in Hugging Face's get_linear_schedule_with_warmup and get_cosine_schedule_with_warmup. After warmup, the decay runs over the remaining T − W steps.

What is the difference between step and exponential decay?

Step decay multiplies the rate by γ every s steps and keeps it constant in between (PyTorch StepLR), for example ×0.1 every 30 epochs. Exponential decay multiplies by γ at every step (ExponentialLR), so the rate falls smoothly.

Should t count steps or epochs?

Either, as long as t, T, W and s use the same unit. PyTorch schedulers usually step once per epoch; transformer training usually steps the scheduler after every optimizer step.

More in Developer

All tools in this category: Developer ·Updated November 7, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.