๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #109

One Cycle Learning Rate

The One Cycle policy (Leslie Smith) combines warmup and decay into a single deliberate cycle spanning the entire training run โ€” rising to a peak, then falling below even the original starting rate โ€” and was shown to enable dramatically faster training ("super-convergence") in some settings.

The Shape of One Cycle

peak lr low start even lower finish

A rise phase (like warmup), a fall phase back to the starting rate, and a final annealing phase to an even smaller rate than the start.

Three Phases

PhaseWhat HappensPurpose
1. RiseLearning rate increases from a low starting value to a peak, over roughly the first 30โ€“45% of trainingLike warmup โ€” cautious early steps, then rapid, aggressive progress once stabilized
2. FallLearning rate decreases back down to (roughly) the starting valueBegins consolidating progress after the aggressive peak phase
3. Final annealingLearning rate drops to a value much smaller than the original starting rate, for a short final stretchCareful fine-tuning to settle into a strong final minimum

Momentum Often Cycles Inversely

The One Cycle policy commonly cycles momentum in the opposite direction โ€” decreasing momentum while the learning rate rises (allowing the larger steps to be more directly gradient-driven), and increasing momentum as the learning rate falls (letting the optimizer's accumulated direction stabilize convergence during the careful final phase).

Code

import torch.optim as optim
from torch.optim.lr_scheduler import OneCycleLR

optimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.9)
total_steps = 1000
scheduler = OneCycleLR(
    optimizer,
    max_lr=0.1,
    total_steps=total_steps,
    pct_start=0.3   # 30% of training spent in the "rise" phase
)

for step in range(total_steps):
    # ... forward pass, loss, backward pass, optimizer.step() ...
    scheduler.step()   # called every STEP, not every epoch, for OneCycleLR specifically

Unlike the other schedules in this category, OneCycleLR is designed to be stepped once per training batch, not once per epoch โ€” because its phases are defined relative to the total number of training steps across the entire run.

Why "Super-Convergence"

Leslie Smith's original research found that One Cycle, using a peak learning rate much higher than what would typically be considered "safe," could train some models to strong accuracy in dramatically fewer total epochs than a conventional fixed or gradually-decaying schedule โ€” essentially trading a brief, controlled period of aggressive, higher-risk learning for a large net time savings, bookended by careful warmup and fine-tuning phases that keep the aggressive middle phase from destabilizing training.

Common Mistakes

  • Calling scheduler.step() once per epoch for OneCycleLR (as is correct for most other schedulers) instead of once per batch โ€” this desynchronizes the schedule from its intended per-step design and produces incorrect learning rate values throughout training.
  • Choosing max_lr without first estimating a reasonable range (e.g. via a learning-rate range test) โ€” One Cycle's benefits depend on the peak being aggressive but not so large that training destabilizes during the rise phase.

Interview Relevance

Q: "What makes the One Cycle learning rate policy different from a standard warmup-then-decay schedule?" One Cycle deliberately pushes the peak learning rate higher than typical warmup-then-decay schedules would use, and often cycles momentum inversely alongside it โ€” the combination of an aggressive peak phase (for fast progress) with careful bookending rise and final-annealing phases (for stability) is what enables the "super-convergence" effect: strong final accuracy in fewer total epochs than more conservative schedules.

Key Takeaways โ€” Optimization & LR Scheduling

  • Batch, stochastic and mini-batch gradient descent differ only in how much data informs each update โ€” mini-batch is the practical default everywhere.
  • Momentum smooths the update direction; Nesterov improves it further by looking ahead before computing the gradient.
  • AdaGrad introduced per-parameter adaptive rates but shrinks them irreversibly; RMSProp fixes this with a decaying average; Adam adds momentum plus bias correction on top of RMSProp's idea; AdamW fixes Adam's broken interaction with weight decay.
  • A fixed learning rate is a compromise between early speed and late precision โ€” scheduling (step, exponential, cosine, warmup, one-cycle) resolves that tension across a single training run.

Next: Backpropagation returns to the chain-rule mechanics from Calculus for DL, this time walking through a complete numerical backpropagation example end to end โ€” the missing piece connecting how the gradients this whole category has been optimizing actually get computed.

Practice Question

Why does OneCycleLR need to know the total number of training steps in advance, unlike a schedule like ExponentialLR?

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

One Cycle Learning Rate โ€“ FAQs

Quick answers about learning One Cycle Learning Rate in Deep Learning.

This free note from CodingNow 2.0 explains One Cycle Learning Rate in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including One Cycle Learning Rate, is 100% free with no signup required.
With focused practice, most students grasp One Cycle Learning Rate in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now