Learning Rate Finder

Find the optimal learning rate for your AI model training.

Training Configuration

B

Recommended Learning Rate

2.0e-5

Range: 2.0e-6 - 6.0e-5

🔥Warmup Steps
57
📉Weight Decay
0.01

Training Schedule

Steps per Epoch313
Total Steps (3 epochs)939
Warmup Steps57

Tips: Use cosine annealing schedule. If training diverges, reduce LR by 2-5x. If training is slow, try increasing LR.

What Is a Learning Rate Finder?

The learning rate finder is a planning tool that estimates a sensible starting learning rate (LR) for training or fine-tuning a neural network, along with a search range, warmup schedule and weight decay. The learning rate is arguably the single most important hyperparameter in deep learning: it controls how large a step the optimizer takes down the loss landscape on every update. Set it too high and the loss explodes or oscillates and the model diverges; set it too low and training crawls, wastes GPU hours, and may settle in a poor local region. This learning rate calculator turns four practical inputs — task type, model size in billions of parameters, batch size, and optimizer — into a concrete recommendation you can drop straight into your training config.

Rather than relying on a single magic number, the calculator anchors each scenario to a community-validated base learning rate and then scales it. Full fine-tuning of large language models is conservative (around 2e-5), pre-training from scratch is more aggressive (around 1e-4), LoRA / PEFT adapters tolerate higher rates (around 1e-4 because only a small fraction of weights update), and RLHF / DPO alignment is extremely delicate (around 1e-6 to avoid destroying a carefully tuned policy). On top of that base value the tool applies a model-size correction and a batch-size correction so that the recommended optimal learning rate tracks the way real training runs behave.

Because the output is a starting point and a range — not a guarantee — the finder pairs naturally with an empirical LR-range test, where you sweep the learning rate upward over a few hundred steps and watch where the loss curve bottoms out before climbing again. Use this AI training calculator to seed that sweep with a defensible value, saving you from blindly guessing and from the costly divergence that follows an over-large step.

How the Learning Rate Finder Calculates Your Recommendation

The calculator multiplies a task-specific base learning rate by three adjustment factors and then derives a search range, warmup, and weight decay. Each factor maps directly to a well-known scaling heuristic used by practitioners training transformers and other deep networks.

First, the size multiplier reflects the observation that larger models are more sensitive and need smaller steps. It scales as the square root of the ratio between a 7-billion-parameter reference and your model: sqrt(7e9 / params). A 7B model gets a multiplier of 1.0, a 70B model gets roughly 0.32, and a 1B model gets about 2.65. Second, the batch multiplier follows the linear scaling rule — doubling the effective batch size roughly doubles the gradient signal-to-noise, so you can afford a proportionally larger step. It is simply batch / 32. Third, the optimizer multiplier accounts for the fact that adaptive optimizers like AdamW, Adam, and Adafactor work on a normalized gradient scale (multiplier 1.0), plain SGD with momentum needs about 10x larger rates, and the Lion optimizer prefers roughly 10x smaller rates (multiplier 0.1).

The search range frames the recommendation: the minimum is one tenth of the recommended LR and the maximum is three times it, giving a sweep band for an empirical test. The training schedule is computed from your dataset: steps per epoch equal the dataset size divided by the batch size (rounded up), total steps assume three epochs, and warmup spans the first 6% of total steps. Finally, weight decay defaults to 0.01 when AdamW is selected (decoupled weight decay is its defining feature) and 0 otherwise.

Recommended Learning Rate Formula

LR = baseLR(task) × sqrt(7e9 / params) × (batch / 32) × optMult

Where:

  • LR= Recommended starting learning rate
  • baseLR(task)= Task base rate: pretraining 1e-4, finetuning 2e-5, lora 1e-4, rlhf 1e-6
  • params= Model parameters = model size (billions) × 1e9
  • batch= Training batch size (samples per step)
  • optMult= Optimizer factor: AdamW/Adam/Adafactor 1.0, SGD 10, Lion 0.1

Understanding the Inputs and Outputs

Each input on the learning rate finder shapes the recommendation in a predictable way. Knowing what each does lets you reason about the result instead of treating it as a black box.

Input Effect on Learning Rate
Task Type Sets the base rate. Pre-training (1e-4) and LoRA (1e-4) are highest; full fine-tuning (2e-5) is moderate; RLHF/DPO (1e-6) is lowest.
Model Size (B) Larger models lower the LR via the inverse square-root rule; smaller models raise it.
Batch Size Larger batches raise the LR linearly relative to a batch of 32.
Optimizer SGD multiplies by 10, Lion by 0.1, adaptive optimizers by 1.0.
Dataset Size Does not change the LR; it sets steps per epoch, total steps, and warmup steps.

The outputs include the recommended learning rate, a min-max range to sweep, warmup steps (about 6% of total steps), weight decay, and a derived training schedule with steps per epoch and total steps across three epochs. Read the recommended LR as a center point: begin there, watch the loss for the first few hundred steps, and nudge toward the maximum if learning is sluggish or toward the minimum if the loss spikes. The range exists precisely because the ideal value is dataset- and architecture-dependent, and a short sweep within these bounds almost always lands near the sweet spot.

Warmup, Weight Decay, and the Cosine Schedule

A good learning rate is only half the story; how you schedule it over training matters just as much. The learning rate finder recommends a warmup phase covering roughly the first 6% of total steps. During warmup the LR ramps linearly from near zero up to the recommended value, which prevents the large, noisy gradients of early training from destabilizing freshly initialized or freshly unfrozen weights. This is standard practice for transformer training and is especially important for adaptive optimizers whose second-moment estimates are unreliable in the first few hundred updates.

After warmup, most modern runs follow a cosine annealing (cosine decay) schedule that smoothly lowers the LR from its peak down toward a small floor by the end of training. Cosine decay tends to outperform step decay and constant schedules because it spends more time at moderate rates early and gently fine-tunes near the end. The calculator also surfaces weight decay: 0.01 for AdamW, whose decoupled weight decay regularizes weights independently of the gradient update, and 0 for optimizers where coupling weight decay into the gradient would interact badly with adaptive scaling.

Putting it together, a typical recipe from this AI training calculator looks like: linear warmup for ~6% of steps to the recommended LR, cosine decay for the remainder, AdamW with weight decay 0.01, and the min-max range available if you need to retune. If your loss diverges, halve the LR or extend warmup; if it plateaus too early, raise the LR toward the maximum or lengthen the cosine tail. These levers, guided by the finder's numbers, cover the vast majority of practical tuning situations.

Why Getting the Learning Rate Right Saves Time and Money

The learning rate determines whether an expensive training run succeeds or burns GPU hours on a diverging or stalled model. A single failed multi-GPU fine-tuning run can cost hundreds of dollars in cloud compute, and an LR that is merely suboptimal — not catastrophic — can leave several points of accuracy on the table that no amount of extra data recovers. Using a learning rate calculator to seed a principled starting value and a tight search range is one of the highest-leverage habits in applied deep learning.

Consider the asymmetry: searching for a learning rate is cheap, but a bad choice is expensive. An LR-range test costs a few hundred steps; a divergence discovered after twelve hours of training costs a full run. By anchoring to validated base rates and applying the square-root size rule, the linear batch rule, and optimizer-aware scaling, this finder gives you a number that is rarely more than a factor of two or three away from optimal — close enough that a brief sweep nails it. That is the difference between guessing and engineering.

The tool is equally useful for newcomers and experienced practitioners. Beginners get a safe default that avoids the classic mistake of copying a learning rate from an unrelated tutorial. Experts get a quick sanity check before committing cluster time, and a consistent baseline when comparing optimizers or model sizes. Whether you are doing LoRA fine-tuning on a single GPU, full fine-tuning a 13B model, or aligning a policy with RLHF, starting from a calibrated optimal learning rate keeps your experiments fast, reproducible, and economical.

Worked Examples

Full Fine-tuning a 7B Model with AdamW

Problem:

You are fully fine-tuning a 7B model on 10,000 samples with batch size 32 using AdamW. What learning rate, range, and schedule should you use?

Solution Steps:

  1. 1Base rate for full fine-tuning = 2e-5; size multiplier = sqrt(7e9 / 7e9) = 1.0.
  2. 2Batch multiplier = 32 / 32 = 1.0; AdamW optimizer multiplier = 1.0.
  3. 3Recommended LR = 2e-5 × 1.0 × 1.0 × 1.0 = 2e-5; range = 2e-6 to 6e-5.
  4. 4Steps per epoch = ceil(10000 / 32) = 313; total steps = 313 × 3 = 939; warmup = ceil(939 × 0.06) = 57.

Result:

Recommended LR 2.0e-5 (range 2.0e-6 to 6.0e-5), 57 warmup steps, 939 total steps, weight decay 0.01.

LoRA Fine-tuning a 70B Model

Problem:

You run LoRA fine-tuning on a 70B model with batch size 16 and AdamW. What is the recommended learning rate?

Solution Steps:

  1. 1Base rate for LoRA = 1e-4; size multiplier = sqrt(7e9 / 70e9) = sqrt(0.1) ≈ 0.3162.
  2. 2Batch multiplier = 16 / 32 = 0.5; AdamW multiplier = 1.0.
  3. 3Recommended LR = 1e-4 × 0.3162 × 0.5 × 1.0 ≈ 1.58e-5.
  4. 4Range = 1.58e-6 to 4.74e-5; weight decay 0.01 because AdamW is selected.

Result:

Recommended LR about 1.6e-5 (range about 1.6e-6 to 4.7e-5) with weight decay 0.01.

Pre-training a 1B Model with SGD

Problem:

You pre-train a 1B model from scratch using SGD with momentum and a large batch size of 256. What learning rate does the finder suggest?

Solution Steps:

  1. 1Base rate for pre-training = 1e-4; size multiplier = sqrt(7e9 / 1e9) = sqrt(7) ≈ 2.6458.
  2. 2Batch multiplier = 256 / 32 = 8.0; SGD optimizer multiplier = 10.0.
  3. 3Recommended LR = 1e-4 × 2.6458 × 8.0 × 10.0 ≈ 2.12e-2.
  4. 4Range = 2.12e-3 to 6.35e-2; weight decay = 0 because the optimizer is not AdamW.

Result:

Recommended LR about 2.1e-2 (range about 2.1e-3 to 6.4e-2) with weight decay 0.

Tips & Best Practices

  • Start at the recommended learning rate, then run a short range test within the min-max bounds to confirm.
  • Always use linear warmup for the first ~6% of steps to avoid early divergence with transformers.
  • Pair the recommended rate with a cosine annealing schedule for smooth decay toward the end of training.
  • If the loss diverges or spikes, cut the learning rate by 2-5x or extend the warmup phase.
  • If training stalls or learns slowly, nudge the rate toward the maximum of the suggested range.
  • Keep weight decay at 0.01 for AdamW and 0 for SGD or Lion, as the optimizer dictates.
  • Remember the linear scaling rule: when you increase batch size, scale the learning rate up proportionally.
  • Larger models are sensitive, so trust the inverse square-root reduction and avoid copying small-model rates.

Frequently Asked Questions

For full fine-tuning of large language models, a learning rate near 2e-5 with AdamW is a well-established starting point. The learning rate finder scales this base value by your model size and batch size, so a 7B model at batch 32 lands at 2e-5 while larger models drop lower. Always confirm with a short sweep, because the ideal value depends on your dataset and architecture.
Larger models have more parameters and sharper, more sensitive loss landscapes, so a step size that is safe for a small model can overshoot and destabilize a big one. This calculator applies an inverse square-root rule, sqrt(7e9 / params), so a 70B model receives roughly one third the rate of a 7B model. The square-root form is a practical compromise that tracks observed behavior across many transformer training runs.
The linear scaling rule states that when you multiply the batch size by k, you should multiply the learning rate by roughly k as well, because the larger batch produces a cleaner gradient that supports a bigger step. The finder implements this as batch / 32, so doubling the batch from 32 to 64 doubles the recommended learning rate. The rule holds well in the moderate-batch regime but should be paired with warmup at very large batches.
Warmup steps are the initial phase where the learning rate ramps linearly from near zero up to the target value, here about 6% of total steps. Warmup prevents the large, noisy gradients of early training from destabilizing the model, and it lets adaptive optimizers build reliable moment estimates before taking full-size steps. Skipping warmup is a common cause of early divergence, especially with transformers and AdamW.
Use the recommended learning rate as a calibrated starting point and the min-max range as the bounds for a quick empirical range test. Sweep the rate upward over a few hundred steps and pick the value just before the loss starts climbing. This combination of a principled seed plus a short sweep is far more reliable than copying a number from an unrelated tutorial.
The calculator recommends weight decay of 0.01 for AdamW and 0 otherwise. AdamW uses decoupled weight decay, which regularizes weights independently of the adaptive gradient update and is its defining advantage over plain Adam. For optimizers where coupling weight decay into the gradient interacts poorly with adaptive scaling, the tool sets it to 0 to avoid unintended regularization effects.

Sources & References

Last updated: 2026-06-05

💡

Help us improve!

How would you rate the Learning Rate Finder?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.