Learning Rate Calculator
Pick a starting learning rate for a neural network and the hard part is not the first epoch, it is the hundredth: too hot and training diverges, too cold and it crawls. This calculator plans the schedule before you spend GPU time on it. Choose from constant, step decay, exponential decay, polynomial decay, cosine annealing or warmup plus decay, and it returns the final rate, the midpoint rate, total optimizer steps from your batch and dataset sizes, and the decay factor that says how much of the starting rate survives.
Quick Answer
With the pre-filled step decay run (initial rate 0.001, 100 epochs, decay rate 0.96 every 30 epochs), the rate drops three times and finishes at 8.8474e-4, with 9.6000e-4 at halfway and 31,300 total steps from 10,000 samples at batch size 32. Naming note: this page covers the machine learning learning rate, the optimizer step size, not the manufacturing learning curve.
Key takeaways
- The schedule matters as much as the starting rate: on identical settings, the six schedules finish from 100% of the initial rate (constant) down to 1.0% (polynomial and cosine).
- Epochs are what you plan in; steps are what frameworks count. Batch and dataset size convert one to the other, in the same result here.
- The decay factor is the fastest sanity check: final rate divided by initial rate, so 0.884736 means the schedule shaved only 11.5% off the rate.
- Blank fields are not errors here. Every empty or zero field falls back to its pre-filled default, a trap if you meant the zero.
- Quick Answer
- How to use the learning rate calculator
- The six schedules and their formulas
- Worked example: step decay over 100 epochs
- Reading the outputs honestly, including the quirks
- Choosing a starting rate and a schedule that fit
- What competing calculators miss
- Frequently asked questions
- Add This Calculator to Your Website
- References
How to use the learning rate calculator
Set the starting rate and schedule, fill in the fields that schedule shows, then read the final and midpoint rates. The calculator is pre-filled with the step decay example used throughout this page.
- Initial learning rate: the rate at epoch zero, the peak rate a published recipe names.
- Schedule: pick one of the six. The form hides fields the schedule does not use: step decay asks for a step size, polynomial for a power and a floor, cosine for a floor, warmup for warmup epochs plus a decay rate.
- Total epochs: the full training length. Schedules are defined against it, so a cosine run planned for 100 epochs and stopped at 50 ends halfway down the curve, not at the floor.
- Batch and dataset size: these change nothing about the rate itself. They convert epochs into optimizer steps (313 per epoch in the example), the unit schedulers in PyTorch's optimizer documentation actually step on.
- Read the result: final rate, midpoint rate, average, decay factor and the formula, plus a recommended range of one tenth to ten times your starting rate: a search bracket, not a verdict.
The six schedules and their formulas
All six are the standard schedules the major frameworks ship, and each formula is the exact one the calculator runs. The names match PyTorch's StepLR, ExponentialLR, PolynomialLR and CosineAnnealingLR, and the Keras schedule family.
| Schedule | Formula the tool runs | Final rate on the example settings |
|---|---|---|
| Constant | α = α₀ | 1.0000e-3 |
| Step decay | α = α₀ × γ^floor(epoch / step size) | 8.8474e-4 |
| Exponential decay | α = α₀ × γ^epoch | 1.6870e-5 |
| Polynomial decay | α = max(α_min, α₀ × (1 − t/T)^p) | 1.0000e-5 |
| Cosine annealing | α = α_min + (α₀ − α_min) × (1 + cos(πt/T)) / 2 | 1.0000e-5 |
| Warmup + decay | Linear rise to α₀ over the warmup epochs, then α₀ × γ^(t − warmup) | 2.5375e-5 |
Two of these deserve a closer look. Step decay only moves at block boundaries: with a step size of 30, epochs 0 to 29 run at the full rate, so the midpoint readout at epoch 50 has taken exactly one cut. Exponential decay compounds every epoch instead; at γ = 0.96 over 100 epochs it removes 98.3% of the rate, against step decay's 11.5%. Confusing the two is the scheduling mistake this calculator exists to catch. The powers behind both are repeated multiplication, the operation the exponent calculator isolates.
Worked example: step decay over 100 epochs
The pre-filled run is step decay from 0.001 over 100 epochs, multiplying by 0.96 every 30 epochs, on 10,000 samples at batch size 32. Every figure below is the calculator's own output.
- Steps per epoch = ceil(10,000 ÷ 32) = 313 (312 full batches plus a partial batch of 16)
- Total steps = 100 × 313 = 31,300
- Drops taken = floor(100 ÷ 30) = 3, so final rate = 0.001 × 0.96³ = 8.8474e-4
- At epoch 50, one drop has landed: 0.001 × 0.96 = 9.6000e-4
- Decay factor = 8.8474e-4 ÷ 0.001 = 0.884736
Run the same starting rate through all six schedules and the spread is the lesson. The bars show the share of the starting rate alive at epoch 100:
Polynomial and cosine land exactly on the minimum rate of 1e-5, by construction: polynomial reaches zero at epoch 100 and is clamped to the floor, while cosine ends on the floor because cos(π) = −1 zeroes the moving part of its formula. The curve's shape is the ordinary cosine function the cosine calculator evaluates, rescaled into a rate.
Reading the outputs honestly, including the quirks
Most outputs mean exactly what their labels say. Four come with fine print worth knowing before you quote them; the final and midpoint rates and the decay factor are exact evaluations of the formulas above.
- Average learning rate: for step, polynomial, cosine and warmup this is the plain mean of the starting and ending rates, not a time-weighted average. Only exponential decay reports a true average, from the geometric series. Treat the others as orientation, not precision.
- Recommended range: your initial rate times 0.1 and times 10, nothing smarter. It marks the bracket a search would sweep, in the spirit of the range test in Apache MXNet's learning rate finder tutorial; not a recommendation for your model.
- Blank, zero and non-numeric fields fall back to defaults. Clear the initial rate and the tool uses 0.001; type 0 for epochs and it uses 100. Sharpest case: polynomial power. A typed 0 is silently treated as power 1, because the fallback cannot tell a typed zero from an empty field.
- Edge cases print what the math gives. Exponential decay at a decay rate of exactly 1 keeps the final rate at the initial rate, but the average prints NaN, because the true-average formula divides by (1 − γ). Cosine annealing with a floor above the initial rate makes the rate grow, and the decay factor reports that honestly (10.000000 on a 0.001 start, 0.01 floor).
- Steps per epoch rounds up. A partial final batch counts as a full step; frameworks run with drop_last count one fewer. The schedule is unaffected, being defined over epochs.
Choosing a starting rate and a schedule that fit
There is no universal good learning rate, only a good rate for a given model, optimizer, batch size and dataset, and the signs of a miss are readable in the loss curve. Too high makes the loss oscillate or climb; in the worst case the run diverges. Too low makes the loss fall so slowly that training time becomes the binding constraint.
Three working rules cover most cases. First, find the neighbourhood before you schedule: the range test from Leslie Smith's cyclical learning rates work, where the rate rises during a short probe run and you pick a value below where the loss turns unstable, is still the fastest way to locate a sane starting point. Second, warm up when the start is fragile: large-batch training benefits from a short linear ramp, the practice Goyal and co-authors used to train ImageNet in an hour, and the warmup plus decay mode here models that shape. Third, match the schedule to the budget: cosine and polynomial suit fixed-length runs, step decay suits training where you know where progress stalls. Decay is compounding in reverse; the exponential growth calculator shows the same machinery with the factor above 1.
What competing calculators miss
The field for this keyword is thin:
- Savvy Calculator's learning rate calculator: a single exponential model, current rate = initial rate × e^(decay × step). One schedule only, with no step, polynomial, cosine or warmup options and no step counting.
- Calculator Ultra's learning rate calculator: a different quantity altogether, the percentage change between an initial and a current production rate. Useful for operations reporting, useless for planning an optimizer schedule.
- Wright's law calculators (for example xdage's learning curve tool): the production learning curve done properly, unit cost against cumulative output. A different tool for a different question; it shares nothing but the name.
- Framework documentation (PyTorch, Keras, TensorFlow): exact schedule definitions, but documentation never lets you compare six schedules on your own numbers before writing code.
- The gap this page fills: six schedules on one set of inputs, final and midpoint rates side by side, the epoch-to-step conversion in the same result, and the quirks (the power-zero fallback, the decay-rate-1 NaN average) stated on the page instead of discovered mid-run.
Frequently asked questions
It is the step size of the optimizer: each training step moves the model weights against the loss gradient by an amount scaled by the learning rate. Too large overshoots and can make training diverge; too small makes progress slow and can stall it.
An epoch is one full pass over the dataset; a step is one batch update. Steps per epoch is dataset size divided by batch size, rounded up; total steps is that figure times the epochs. The schedules here are defined over epochs, while most frameworks count scheduler steps in batches, hence the conversion in the result.
Use cosine annealing or polynomial decay when the training length is fixed in advance, because both are defined against that total. Use step decay when you know where progress stalls. Use warmup plus decay when the start is unstable or the batch is large. Constant is a baseline, rarely the best final choice.
It is the final learning rate divided by the initial learning rate: the share of the starting rate that survives the run. The worked example ends at 0.884736, a gentle schedule. A factor near 0.01 means the schedule removes almost all of the rate, normal for cosine and polynomial runs ending on their floor.
That happens in exponential decay mode when the decay rate is exactly 1. The true-average formula divides by (1 minus the decay rate), which is zero, so the average is undefined and the tool prints NaN rather than hiding it. Final and midpoint rates are still correct: at a decay rate of 1 the rate never changes.
The field falls back to its pre-filled default: 0.001 for the initial rate, 100 for epochs, 0.96 for the decay rate, and so on. This also applies to typed zeros, which is why a polynomial power of 0 is treated as power 1. Only negative initial rates or epoch counts produce the error message.
No. The manufacturing learning curve, Wright's law, says the time or cost of the Xth unit follows Y = aX^b, so an 80 percent learning rate means each doubling of output cuts unit time to 80 percent of its previous level. This page covers the other meaning: the optimizer step size for training machine learning models. The two share a name and nothing else.
No. Batch and dataset size only change the step counts; the schedule is computed from the rate fields alone. In real training, larger batches are often paired with a higher initial rate (the linear scaling rule), but this calculator reports the schedule you entered rather than rescaling it.
Add This Calculator to Your Website
Embed this calculator on your own site with the code below. Pick a size to preview it live, then copy the code.
Powered by Calculator Zilo
References
- PyTorch documentation. torch.optim: learning rate schedulers. Accessed October 22, 2026.
- TensorFlow. tf.keras.optimizers.schedules.CosineDecay. Accessed October 22, 2026.
- Keras. Learning rate schedules API. Accessed October 22, 2026.
- Loshchilov, I. and Hutter, F.. SGDR: Stochastic Gradient Descent with Warm Restarts. Accessed October 22, 2026.
- Goyal, P. et al.. Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour. Accessed October 22, 2026.
- Smith, L. N.. Cyclical Learning Rates for Training Neural Networks (WACV 2017). Accessed October 22, 2026.
- Apache MXNet. Learning Rate Finder tutorial. Accessed October 22, 2026.
- Kingma, D. P. and Ba, J.. Adam: A Method for Stochastic Optimization. Accessed October 22, 2026.
