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

Exponential Decay

Exponential decay shrinks the learning rate smoothly and continuously every single step, rather than in the sudden jumps of step decay โ€” trading step decay's simplicity for a gentler, gradually-shrinking curve.

Formula

\[ \eta_t = \eta_0 \cdot \gamma^{t} \]

\(\gamma\) (e.g. 0.95, 0.99) is a decay rate applied every single epoch (or step) โ€” unlike step decay's \(\gamma\), which only applies at discrete intervals.

Numerical Example

With \(\eta_0=0.1\), \(\gamma=0.95\): epoch 0: \(0.1\); epoch 10: \(0.1\times0.95^{10}\approx0.0599\); epoch 30: \(0.1\times0.95^{30}\approx0.0215\) โ€” a smooth, continuous shrinkage rather than step decay's flat-then-drop pattern.

Graph

A smooth, continuously decreasing curve โ€” steep early, flattening as it approaches zero.

Code

import torch.optim as optim
from torch.optim.lr_scheduler import ExponentialLR

optimizer = optim.SGD(model.parameters(), lr=0.1)
scheduler = ExponentialLR(optimizer, gamma=0.95)

for epoch in range(30):
    # ... training loop for this epoch ...
    scheduler.step()
    print(scheduler.get_last_lr())

Step Decay vs Exponential Decay

Step DecayExponential Decay
ShapeFlat segments, sudden dropsSmooth, continuous shrinkage
InterpretabilityVery easy to reason about ("halves every 10 epochs")Slightly less intuitive, but avoids abrupt loss-curve jumps
HyperparametersStep size \(s\) and decay factor \(\gamma\)Just decay rate \(\gamma\)

Common Mistakes

  • Choosing a \(\gamma\) too close to 1 (e.g. 0.999) expecting meaningful decay โ€” over a typical training run, this decays extremely slowly and may barely differ from a constant learning rate in practice.
  • Choosing a \(\gamma\) too far from 1 (e.g. 0.7) โ€” the learning rate can shrink to near-zero within just a handful of epochs, effectively freezing training prematurely.

Interview Relevance

Q: "When might you prefer exponential decay over step decay?" When you want a smoother loss curve without the small, temporary jumps that can appear right at step decay's sudden drop points โ€” exponential decay changes the learning rate a tiny amount every single step instead of in occasional large jumps, at the cost of being slightly less intuitive to reason about directly.

Practice Question

With \(\eta_0=0.05\) and \(\gamma=0.9\), what is the learning rate at epoch 5? (You can approximate \(0.9^5 \approx 0.59\).)

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

Exponential Decay โ€“ FAQs

Quick answers about learning Exponential Decay in Deep Learning.

This free note from CodingNow 2.0 explains Exponential Decay 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 Exponential Decay, is 100% free with no signup required.
With focused practice, most students grasp Exponential Decay 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