Skip to content
StackDecode

LR Schedule Visualiser

Plot learning-rate schedules (cosine, warmup, step, one-cycle…) and overlay up to three.

NewmediumRuns in your browser

How it works

A learning-rate schedule changes the optimiser’s step size during training. Large rates early make fast progress; small rates late settle into a minimum. Here t is the current step, T the total steps, and η₀ the base rate.

  • Constant

    ηt=η0\eta_t=\eta_0
  • Step decay

    ηt=η0 γ⌊t/step⌋\eta_t=\eta_0\,\gamma^{\lfloor t/\text{step}\rfloor}
  • Exponential

    ηt=η0 γt\eta_t=\eta_0\,\gamma^{t}
  • Cosine annealing

    ηt=ηmin⁡+12(η0−ηmin⁡)(1+cos⁡πtT)\eta_t=\eta_{\min}+\tfrac12(\eta_0-\eta_{\min})\left(1+\cos\tfrac{\pi t}{T}\right)
  • Warmup + cosine

    ηt={η0 t/wt<wηmin⁡+12(η0−ηmin⁡)(1+cos⁡π(t−w)T−w)t≥w\eta_t=\begin{cases}\eta_0\,t/w & t<w\\ \eta_{\min}+\tfrac12(\eta_0-\eta_{\min})\left(1+\cos\tfrac{\pi (t-w)}{T-w}\right) & t\ge w\end{cases}
  • One-cycle

    ηstart=ηmax⁡div,  ηend=ηstartfinal div\eta_{\text{start}}=\tfrac{\eta_{\max}}{\text{div}},\ \ \eta_{\text{end}}=\tfrac{\eta_{\text{start}}}{\text{final div}}
  • Warmup avoids instability from large updates on randomly initialised weights; it is standard for transformers.
  • One-cycle follows PyTorch’s OneCycleLR with cosine annealing: it starts at max_lr / div_factor, peaks at max_lr, then falls to start / final_div_factor.
  • The plot is sampled to at most 300 points; the table shows exact values at key steps. Log scale hides zero values, which cannot be plotted on a log axis.