Optimizers
Learning Rate Scheduling
A schedule chooses the multiplier for each next gradient update; its effect is measured by the actual objective after a stated budget.
Exact bowl · 1×(x²+2y²)
Constant. Shared round 0 of 100. Selected schedule: 0 updates, objective 8.500000, Ready. Next rate 0.450000, index 0, Constant.
Constant. Shared round 0 of 100. Selected schedule: 0 updates, objective 8.500000, Ready. Next rate 0.450000, index 0, Constant.
Map: cross = draggable common start; origin cross = known minimum; circle/solid = selected; square/dashes = constant; diamond/arrow = next actual update. Curves are sampled exact ellipses. Map segments crop at ±3; outside markers are omitted. Independent pixel scales can distort angles. Raw values are never clipped.
Rate view: faint curves are planned discrete rates, including rates a stopped run may never use; solid overlay records selected applied rates. Circle/square = last applied rate; diamond = next; crosses = phase boundaries; triangle = editable base rate. Lines join samples; step drops and restarts use vertical boundaries. Loss view uses log₁₀(1+f), with raw objectives below and in inspection.
Selected schedule: 0 recorded points outside the map. Constant computes at every stage, even while hidden.
- Selected schedule
- Common start
- Next actual endpoint
Every mathematical edit pauses and restarts both runs.
Every mathematical edit restarts both runs from the common start. View and sandbox changes only pause. Budget: 100 updates per run; no tolerance early stop.
Starting point and budget
Paused. Step applies one update to each active run.
Numerical stop: non-finite values or |coordinate| > 100000000. Last attempted update is retained raw. Maximum 200 updates. No clipping, projection or added noise in the computation.
Next update 1 · index 0: base 0.450000 × multiplier 1.000000 = applied rate 0.450000 · Constant
Last applied rate: none; no updates yet
Current θ: -2.000000, 1.500000; exact g: -4.000000, 6.000000
Last actual Δ: 0.000000, 0.000000
Next requested −ηg: 1.800000, -2.700000
Next actual Δ: 1.800000, -2.700000; endpoint: -0.200000, -1.200000; full objective: 2.920000
Actual Δ measures the representable endpoint minus the current point; a nonzero requested −ηg can round to no movement.
m(t)=1
Selected schedule: 0 updates / 0 update-gradient evaluations. Ready. These observations do not end the update budget.
Counts include zero-rate/zero-gradient updates. Current-point diagnostics, previews and display geometry are extra analytical work, outside the update-gradient budget. No wall-clock or generalisation comparison.
Which rate will the next update actually use?
After the next selected-schedule update, will the full objective be lower, higher or unchanged within tolerance?
A constant rate can contract this bowl, even while its y coordinate changes sign. Oscillation alone does not imply growing loss.
- Completed updates t
- Schedule multiplier
- Applied rate B×m(t)
- Actual −ηg
- Measure full objective
Applied rate
The base rate multiplied by the schedule value at the index of the next update.
Check this stage
Challenge
From (-2,1.5), multiplier one, reach selected loss below 0.1 within twenty updates. Constant is allowed; this is an update budget, not a speed race.
Selected loss < 0.1 in at most twenty updates from the stated start.
Challenge not yet solved.
Check your understanding
Follow the rate chosen for each update into its actual displacement and loss. Compare a selected schedule with constant descent from the same start and budget.
Which rate moves the parameters?
A schedule changes the size of the next update. It does not change the derivative or guarantee a better result. This lab uses exact full-gradient descent on one bowl, so you can isolate the schedule without noisy samples, momentum or adaptive scaling.
Move the common-start cross, or open Starting point and budget and edit its coordinates. Press Step. The selected circle moves to the previously proposed diamond, using the rate printed above the update. The last applied rate then records that exact incoming value. Switch the supporting view to Actual full-objective history to inspect the consequence.
From stage two, the square and dashed line show constant-rate descent from the same start. Both active runs receive one gradient update per shared round, each evaluated at its own parameters. The comparison is actual objective after an explicit update budget. Preview, diagnostics and display calculations are extra analytical work; this is no measurement of training speed or generalisation.
Count updates, not epochs
Let be the number of completed updates. The first update uses index zero, and a budget of updates applies indices . An epoch means a pass through a dataset. There is no sampled dataset or epoch in this experiment.
The base rate is , the schedule multiplier is , and the applied rate is . With parameters and a positive objective multiplier :
At the original start with , the gradient is . Set the base to : the first constant update adds , landing at with loss . Step decay with interval and factor uses next. Its second point is , with loss . Under the hood retains the gradient, displacement and incoming rate for both updates.
Hold, drop or decay smoothly
Constant uses . Step decay uses , so the first updates use the base rate and update uses the first dropped rate. Exponential uses , multiplying on every update. A factor of zero leaves the first plateau or first update intact, then applies zero rates.
Choose Decay too early in the last stage, then Run remaining budget. The selected exponential uses base , factor and forty updates. Compare its residual error with constant descent at that same budget. A tiny rate can leave the parameters almost fixed while the gradient remains substantial. Back to working restores the whole preceding experiment, including its history and clocks.
For cosine, is the minimum/base ratio:
For , our applied samples include both endpoints: base at index zero and at index . With and , the multipliers are . The final zero rate consumes an update but makes no displacement. It does not prove that the point is a minimum. With we apply the base rate once: one update cannot contain two distinct endpoints. A smooth curve supplies no universal advantage over step or constant rates.
What happens at a restart?
Select Cosine restarts. The local index is inside a cycle of length , using a cosine with denominator . When would equal , the next cycle begins at and restores the base rate before that update. The period grows by the chosen integer multiplier. Parameters are retained; no optimiser memory exists here.
These are half-open cycles. The continuous minimum at is replaced by the next peak and is never an applied sample. A period of two with base and floor zero applies . A period of one keeps applying base. A partial final cycle ends at its actual rate; the budget adds no extra minimum-rate update. This boundary convention differs from the finite cosine above.
Restarting a rate does not guarantee escape from a minimum. At this bowl’s exact origin the gradient stays zero at every rate. The original SGDR paper retains parameters too and explicitly avoids claiming an observed multimodality effect in its experiments.
Does this bowl need warm-up?
Warm-up can help particular neural-network training setups tolerate larger target rates. Large-minibatch experiments address rapidly changing early networks; research into warm-up mechanisms studies changing sharpness and conditioning. Neither mechanism is simulated by this fixed-Hessian bowl. Smaller early rates can simply spend useful budget more slowly, and an excessive peak can still grow error.
Our warm-up setting counts applied ramp updates, capped at and printed as effective W. Zero skips the ramp; one starts at the peak. For , the ramp includes zero and the peak at index . The remaining updates cosine-decay from that peak to at the final applied update. If , only the ramp fits: it ends at base and has no decay phase. For , the single update uses base.
Rate-only one-cycle is a separate cosine rise/fall variant. For , its peak index is . It rises from ratio to one, then falls to . With it applies ; with , . It does not cycle momentum or reproduce all OneCycleLR defaults. Its name describes the rate shape, not a performance promise.
Read the movement honestly
For this quadratic, Hessian eigenvalues are and . A coordinate in a mode of curvature multiplies by per update. At a constant rate, every positive mode contracts for . Sign reversal can begin above while contraction continues. A boundary mode can alternate without shrinking; a missing mode cannot grow. For a varying schedule the factors multiply over the actual sequence. One expansive update alone proves no long-run outcome, and none of these bounds transfers to momentum, Adam or a different objective.
Try Contracting alternation, then Step: changes sign while full loss falls. High-rate growth shows a different observation. Multiplying the objective by ten also multiplies its gradient and curvature by ten; dividing the rate by ten preserves the same displacement.
The map crops segments outside and omits outside markers. It never clips or projects an optimisation update. Read raw values in inspection. Rate lines join discrete samples; step/restart boundaries are drawn vertically. The loss view maps to for display; tables and readouts preserve untransformed objective values.
Three consecutive material loss increases are labelled observed growth. A small gradient (norm at most ) and a known-minimum objective tolerance () are separate observations. None ends the common budget. Each run stops independently at its declared budget or a numerical limit: non-finite computed values or an absolute coordinate above . The attempted update remains recorded. Cancellation retains completed updates and makes no convergence claim.
Repeat an experiment
Every mathematical edit pauses and restarts both runs: schedule, base, budget, floor, decay, warm-up, restart settings, scale or starting coordinates. Stage changes retain base, start and budget, reset the other settings and choose that stage’s schedule. Supporting-view and sandbox changes pause while retaining the experiment. Replay restarts current settings and explicitly plays once through a bounded run. Reduced motion retains manual Step and explicit bounded computation.
Seeking restores both complete computational states. Step after seeking branches and discards the old future. Reset controls keeps the guided stage and restores its defaults; it also discards failure recovery. Share copies starting settings and stage, opening paused at update zero with fresh histories. Computed iterates and run history stay in memory; they are never rounded into manual starting controls for a link.
The formulas are checked against D2L scheduling and PyTorch’s step, exponential, cosine and restart references. Their scheduler-call and epoch conventions must be translated to this lab’s explicit applied-update clock.
Stage recap
Constant rate
A constant rate can contract this bowl, even while its y coordinate changes sign. Oscillation alone does not imply growing loss.
Drop the rate
Step decay holds then drops; exponential decay multiplies on every update. Either can leave substantial error when the remaining rates are too small.
Follow the cosine
Our finite cosine includes both endpoints. Restart cycles instead use half-open periods and restore the base rate at each boundary while retaining parameters.
Try warm-up
Warm-up changes how the budget is spent. This exact-gradient bowl has no changing curvature or noisy early batches, so a warm-up is optional and can delay useful progress.
Reference
- Indexing
- t completed updates selects rate η_t for update t+1. Applied indices are 0…H−1; no epochs are simulated.
- Update
- f=c(x²+2y²), g=c(2x,4y), θ_next=θ−B m(t)g. Exact full gradients; no optimiser memory.
- Step / exponential
- m=γ^floor(t/D) / γ^t. Drops are based on updates; γ=0 removes all rates after the first plateau/update.
- Cosine
- m=r+(1−r)(1+cos(πt/(H−1)))/2. H>1 includes both endpoints; H=1 uses base.
- Warm-up
- W=0 skips ramp; W=1 starts at peak; W≥2 includes zero and peak at W−1. W=H is ramp only. W is capped at H.
- Restarts
- k=0…Pᵢ−1; cosine denominator Pᵢ. At the boundary restore base and multiply period. Minimum is approached, not applied; parameters are retained.
- Rate-only one-cycle
- Cosine rise from r+0.1(1−r) to 1, then fall to r. Peak index clamp(round(0.3(H−1)),1,H−2). H=2 uses [1,r]; H=1 uses [1]. No momentum cycling.
- State boundary
- Mathematical edits restart both runs. Links restore starting settings paused at zero; failure recovery and history seeking restore complete in-memory runs.
Break it on purpose
Decay too early and the rate can become tiny while the gradient and optimisation error remain large. A zero final rate is a schedule endpoint, not evidence of a minimum. High rates can also grow error; leaving the map is only display cropping.
Explore next
- Gradient DescentThe gradient measures local change; descent subtracts the learning-rate-scaled gradient and measures the actual result.
- SGD, momentum and AdamAn optimiser combines the current gradient with its own memory to choose an actual displacement.
- Learning CurvesA learning curve measures what changes when the same fitting rule receives more observations; its shape is evidence about this experiment.