Skip to content
mlmentorship

How do you choose a learning rate?

Check update stability, propose a learning-rate peak, then test its schedule from a clean starting state.

Published · 8 min read ·Core ·Mixed

ML breadth · active recall

Practice before you read

8 minutes. Explain the mechanism, why it works, when it fails, and one alternative.

ML breadth · closed-book attempt

How do you choose a learning rate?

Explain the mechanism, why it works, when it fails, and one alternative.

Problem

Context. The exact one-dimensional SGD fixture below isolates learning-rate behavior before considering noisy, scheduled training. Task. Compare the three constant rates, explain convergence or divergence, and propose a controlled learning-rate selection procedure. Describe how warmup, decay, optimizer choice, and intended run length affect the final comparison. Constraints. Use the stated loss, gradient, and starting point for the fixture; do not add momentum or stochastic noise. A short range test proposes candidates rather than proving the best full-run schedule. Use plain SGD on $L(w)=5w^2$, starting at $w_0=1$ with exact gradient $10w$. Compare constant rates $0.1$, $0.2$ and $0.25$. Which rates reduce the loss, and what changes when the intended run uses a schedule?

08:00recommended time

Closing or reloading clears the scratchpad. Only score, weak rubric dimensions, attempt count, and retry date can be stored locally.

Reading depth

Choose a learning-rate policy by comparing update behavior and validating a complete training schedule rather than a single sweep result.

Problem

Context. The exact one-dimensional SGD fixture below isolates learning-rate behavior before considering noisy, scheduled training.

Task. Compare the three constant rates, explain convergence or divergence, and propose a controlled learning-rate selection procedure. Describe how warmup, decay, optimizer choice, and intended run length affect the final comparison.

Constraints. Use the stated loss, gradient, and starting point for the fixture; do not add momentum or stochastic noise. A short range test proposes candidates rather than proving the best full-run schedule.

Use plain SGD on , starting at with exact gradient . Compare constant rates , and . Which rates reduce the loss, and what changes when the intended run uses a schedule?

Candidate first, controlled run second

Choose the useful descent region, not the unstable end of the sweep

Choose the useful descent region before instabilityFor loss x squared, the update multiplies x by one minus twice the learning rate. These three-step fixtures contract, oscillate, or grow. A range test still requires observed task evidence.Same quadratic; different updatedistancesRate 0.1: multiply the coordinate by0.8Rate 0.9: multiply the coordinate by-0.8Rate 1.1: multiply the coordinate by-1.2Oscillation can contract; oversizedsteps grow.
Derivation
Read a learning-rate range test from too small through useful descent to instability An original qualitative plot shows training loss against learning rate on a logarithmic horizontal axis. At very small rates the loss is nearly flat. It then falls, with a hatched candidate band around the sustained steep descent. Farther right the curve bottoms and turns sharply upward in an instability region marked with crosses. The selected candidate is before the minimum and blow-up, not at either one. 1 · SWEEP LR UP; WATCH LOSS too small candidate steep descent unstable 10⁻⁷ 10⁻⁴ 10⁻¹ learning rate (log scale) → training loss
Use the selected candidate as the peak of a warmup and decay schedule A learning-rate schedule begins low, rises linearly during a short warmup to the candidate peak selected by the range test, then follows a curved decay over the remaining training steps to a lower final rate. A vertical dotted guide marks the end of warmup, and the peak has a double-ring marker. The figure emphasizes that the selected value is a peak, not a constant rate used for every step. 2 · USE IT AS THE PEAK warmup selected peak decay start warmup end finish training step → learning rate
the first plot proposes a rate before instability. The second assigns that candidate to a schedule. These qualitative curves are not measured results or proof of an optimal peak.
Check: Which LR from the sweep becomes the schedule peak? Why is the unstable endpoint not the choice?
Read it this way: For loss x squared, the update multiplies x by one minus twice the learning rate. These three-step fixtures contract, oscillate, or grow. A range test still requires observed task evidence.
Does crossing the minimum necessarily mean the iterations diverge?

Range-test references: Smith (2017) and the fastai learning-rate finder documentation.

Calculate the updates

For plain SGD, . Contraction requires , so .

RateDecision
Reaches the minimum
Oscillates without progress
Diverges

Finite values alone do not establish progress. The boundary rate never improves this loss. This calculation is not an Adam benchmark or a universal neural-network bound.

Test a candidate

Record the optimizer, loss reduction, batch, initialization, precision and intended training length. Use a disposable run to increase rates while recording loss and update behavior. For sweep steps, a geometric sweep can use

Choose a candidate in sustained descent, with margin before instability. Restore the starting model and optimizer state, then test the intended schedule on controlled runs. Compare representative validation results and stability at the same budget. A sweep changes weights along its path; its points are not independent rate trials.

Change the run

1. Double the curvature

New task: replace the loss by .

Picture and change: the gradient becomes . Recompute contraction from .

Check: the interval becomes . The old rate now oscillates without progress.

Use when: loss scaling, parameterization or optimizer changes the effective update.

2. Specify a shorter training horizon

New task: use steps, warmup steps, peak and final rate .

Picture and change: choose the schedule separately from the peak. At schedule position , use

Check: positions , , and give rates , , and .

Use when: the step budget changes. These fractions describe this fixture, not a universal schedule.

Do not continue from a failed sweep

Diverged weights and accumulated Adam moments are not a clean starting state. Reload model, optimizer and schedule state; control data order and randomness for the comparison. Otherwise a failed sweep can invalidate the candidate test.

Try changing the batch

Doubling batch size also changes loss reduction from mean to sum. What must be checked first?

Check your answer

Restore the intended reduction or account for its doubled gradient scale. Only then test a batch-scaling heuristic under controlled conditions.

Optimizer and training regime

Adam uses accumulated, coordinate-dependent moments, so its effective update is not simply plain SGD’s gradient times a rate. Batch-scaling rules require assumptions. Neither linear scaling for SGD nor square-root scaling for Adam is universal. The large-minibatch SGD recipe combines scaling with specific training conditions and warmup.

Fine-tuning must balance adaptation against preserving useful behavior. Compare layer updates and held-out behavior instead of assuming pretrained weights are well-conditioned. Fixed fine-tuning, SFT or preference-training rate ranges do not transfer automatically between models and objectives.

Schedules and diagnostics

Warmup limits early updates; its usefulness and mechanism depend on optimizer, parameterization and model. The Transformer schedule, cosine decay, step decay and one-cycle use different time profiles. Compare them at a stated training budget rather than declaring one always superior.

If every reasonable rate fails, inspect data, initialization, gradient scale, loss implementation and numerical precision. Reducing the rate does not repair incorrect labels or a broken backward pass.

Related: debug a model that is not learning and bias and variance.