1.2.13Calculus & Optimization Basics

Learning rate effects on convergence

2,610 words12 min readdifficulty · medium

Definition & Core Concept


Derivation: Why η Appears in Gradient Descent

From Taylor Expansion (First Principles)

Goal: Minimize loss function L(θ)\mathcal{L}(\theta).

Step 1: Approximate L\mathcal{L} near current point θt\theta_t using 1st-order Taylor: L(θt+Δθ)L(θt)+θL(θt)TΔθ\mathcal{L}(\theta_t + \Delta\theta) \approx \mathcal{L}(\theta_t) + \nabla_\theta\mathcal{L}(\theta_t)^T \Delta\theta

Why this step? Taylor series lets us predict loss change for small moves. We keep only the linear term (gradient) because we assume small steps.

Step 2: To decrease L\mathcal{L}, choose Δθ\Delta\theta in direction opposite to gradient: Δθ=ηθL(θt)\Delta\theta = -\eta \nabla_\theta\mathcal{L}(\theta_t)

Why opposite? Gradient points uphill (direction of stepest increase). Negative gradient points downhill.

Why η? The gradient L\nabla\mathcal{L} has units [loss/parameter]. To get a parameter update [parameter units], we multiply by a scalar η. The magnitude of η controls step size.

Step 3: Update rule becomes: θt+1=θtηθL(θt)\theta_{t+1} = \theta_t - \eta \nabla_\theta\mathcal{L}(\theta_t)


Three Convergence Regimes

Figure — Learning rate effects on convergence

1. Learning Rate Too Small (η≪ optimal)

Mathematics: For strongly convex L\mathcal{L} with condition number κ\kappa, small η → convergence rate (1ημ)t(1 - \eta\mu)^t where μ\mu is strong convexity constant. Small η makes (1ημ)1(1-\eta\mu) \approx 1, so exponential decay is slow.


2. Learning Rate Too Large (η ≫ optimal)

Critical threshold: For L(w)=w2\mathcal{L}(w) = w^2, eigenvalue of Hessian is λ=2\lambda = 2. Stability requires η<2λ=1\eta< \frac{2}{\lambda} = 1. Our η=1.5 exceds this, causing exponential divergence.


3. Optimal Learning Rate (η in "sweet spot")

Theory: For strongly convex L\mathcal{L} with smoothness LL, optimal η ≈ 1/L. This balances curvature (second derivative) with gradient magnitude.


Quantitative Stability Analysis

For neural networks, LL is hard to compute (depends on Hessian eigenvalues), so we:

  1. Start with small η (e.g., 0.001)
  2. Grid search: try {0.1, 0.01, 0.001, 0.0001}
  3. Monitor training loss curve for divergence/stagnation

Common Mistakes


Adaptive Learning Rates (Modern Solution)


Practical Guidelines

Scenario Recommended η Reasoning
Convex (linear/logistic regression) 0.01 - 0.1 Can use larger; loss surface is smooth
Small neural network (MNIST) 0.001 - 0.01 Moderate non-linearity
Deep network (ResNet) 0.001 - 0.001 Many layers amplify gradient issues
Adam optimizer 0.001 (default) Adaptive normalization reduces sensitivity
Fine-tuning pretrained model 0.001 - 0.001 Already near good solution

Tuning protocol:

  1. Start at 0.001 (safe default)
  2. Train 1-2 epochs, check loss curve:
    • Loss explodes → decrease η by10×
    • Loss barely moves → increase η by 3-10×
  3. Once stable, tune by2× increments

Recall Explain to a 12-Year-Old

Imagine you're blindfolded in a hilly park, trying to find the lowest point. Your friend shouts directions: "Walk 5 steps north!" That's the gradient (direction).

But how big should your steps be? That's the learning rate.

  • Tiny steps (like baby steps): Safe! You won't fall into a ditch. But it takes FOREVER. You might be out there all day.
  • Giant steps (like leaping 10 feet): Super fast! But you might jump OVER the lowest spot, land on the other side of the hill, then jump back over it, back and forth, never actually stopping at the bottom.
  • Medium steps: Just right. You walk steadily downhill and reach the bottom in reasonable time.

The learning rate is like choosing your step size. Too small = slow. Too big = you overshoot and bounce around. Goldilocks = fast and steady.



Connections

  • Gradient Descent - η is the step size parameter in basic GD
  • Momentum - Adds velocity term; reduces sensitivity to η choice
  • Adam Optimizer - Per-parameter adaptive η; auto-tunes step sizes
  • Learning Rate Schedules - Time-varying η(t) for better convergence
  • Lipschitz Continuity - Smoothness constant L bounds safe η
  • Condition Number - High κ → need smaller η for stability
  • Hessian Matrix - Second derivatives determine optimal η
  • Backpropagation - Computes gradients that η scales

#flashcards/ai-ml

What does learning rate η control in gradient descent? :: The magnitude (step size) of parameter updates. It scales the gradient vector to determine how far to move in parameter space each iteration.

Write the gradient descent update rule with learning rate :: θt+1=θtηθL(θt)\theta_{t+1} = \theta_t - \eta \nabla_\theta \mathcal{L}(\theta_t)

What happens if learning rate is too small?
Convergence is very slow. Loss decreases monotonically but takes many iterations to reach minimum (glacier-like progress).
What happens if learning rate is too large?
Overshooting and divergence. Parameters oscillate around minimum with increasing magnitude, or loss explodes to infinity.
For L-smooth functions, what is the stability condition for η?
η<2L\eta < \frac{2}{L} where L is the Lipschitz constant of the gradient. Practical choice: η1L\eta \approx \frac{1}{L} for safety.
Why does adaptive learning rate (like Adam) help?
It uses per-parameter step sizes based on gradient history. Parameters with large typical gradients get smaller effective η, normalizing updates across dimensions with different scales.
If training loss increases from iteration1, what's likely wrong?
Learning rate is too large. The first update already overshot, indicating η exceds the stability threshold for this loss landscape.
Give the optimal η for minimizing L(w)=w2\mathcal{L}(w) = w^2 starting from w=1 in one step
η = 0.5. Since gradient is2w and Hessian eigenvalue is 2, optimal rate is 1/λ = 1/2.
What's the relationship between learning rate and number of iterations to converge?
Non-monotonic. Very small η → many iterations. Optimal η → fewest iterations. Too large η → infinite iterations (doesn't converge). There's a sweet spot.
Why can't we always use very large η to converge faster?
Large η causes overshooting. Updates jump past the minimum to the opposite side, often with increasing magnitude, leading to oscillation or divergence rather than convergence.

Concept Map

derives

gives

scales

controls

move opposite

sets step size

iterates toward

too low

too high

balanced

slow

oscillates

fast stable

Learning rate eta

Gradient descent update

Taylor expansion

Gradient vector

Step direction

Step magnitude

Too small eta

Too large eta

Optimal eta

Convergence

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho bhai, gradient descent mein learning rate (η) sabse important hyperparameter hai. Yeh control karta hai ki har iteration mein parameters ko kitna update karein. Socho aise: tum ek pahadi pe ho, aur sabse niche jana hai (loss minimize karna). Gradient tumhe direction bata hai—kidhar jana hai. Par kitne bade kadam maroge? Wahi learning rate decide karta hai.

Agar learning rate bohot chhota hai (jaise 0.001), toh tum bahut aahista chaloge. Har step mein thoda-thoda age badhoge. Loss kam to hoga, par itni slowly ki training khatam hi nahi hogi—ghanton lag jayenge! Dosri taraf, agar learning rate bohot bada hai (jaise 1.5), toh tum itne bade jumps maroge ki minimum ko cross kar jaoge, dosri side land karoge, phir wapas jump, aur aise hi oscillate karte rahoge. Kabhi converge hi nahi hoga, ulta loss badh jayega! Isliye sweet spot chahiye—na zyada chhota, na zyada bada.

Practical tip: Deep learning mein usually 0.001 se start karo (Adam optimizer ke sath). Agar loss pehle iteration mein hi explode ho raha, matlab η bohot bada hai—10x kam karo. Agar loss bilkul nahi ghat raha, matlab bohot chhota hai—3-5x badha do. Modern optimizers jaise Adam apne ap per-parameter rates adjust karte hain, isliye thoda zyada forgiving hain. Par samajh lena zaroori hai—learning rate tuning hi decide karti hai ki model converge karega ya nahi!

Go deeper — visual, from zero

Test yourself — Calculus & Optimization Basics

Connections