FoundationsChecking saved investigationReading browser-local route memory before showing a continuation.

Foundation Lab

SGD & Momentum: The Workhorses of Optimization

Momentum is still used to train most vision models and is the default for many frameworks

Concept 57 of 100OptimizationPhase 3
#57SGD+MomentumOptimization
key equationv_{t+1} = \mu v_t + \nabla L, \quad \theta_{t+1} = \theta_t - \eta v_{t+1}

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 57 of 100SGD+MomentumOptimization / Phase 3: Optimization & generalization
Current question

Momentum = exponential moving average of gradients, so it smooths over mini-batch noise

v_{t+1} = \mu v_t + \nabla L, \quad \theta_{t+1} = \theta_t - \eta v_{t+1}
PredictionCommit before the demo.

Ask what should change when the equation is manipulated, then let the visualization test that expectation.

EvidenceCompare local witness and source.

Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue through the atlas.

Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.

Why It Matters for Modern Models

  • Momentum is still used to train most vision models and is the default for many frameworks
  • Understanding momentum explains why adaptive methods (Adam) can be worse for generalization
  • Nesterov momentum provides optimal convergence rates for convex optimization

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Momentum = exponential moving average of gradients, so it smooths over mini-batch noise
  • Heavy ball analogy: momentum lets you roll through small bumps and ravines in the loss landscape
  • Nesterov looks ahead: "if I keep going this way, what would the gradient be?"

Interactive Visualization

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.

Key Equation
vt+1=μvt+L,θt+1=θtηvt+1v_{t+1} = \mu v_t + \nabla L, \quad \theta_{t+1} = \theta_t - \eta v_{t+1}

Vanilla SGD:

θt+1=θtηL(θt)\theta_{t+1} = \theta_t - \eta \nabla L(\theta_t)

Momentum (Polyak):

vt+1=μvt+L(θt)v_{t+1} = \mu v_t + \nabla L(\theta_t)
θt+1=θtηvt+1\theta_{t+1} = \theta_t - \eta v_{t+1}

Nesterov Momentum (look-ahead gradient):

vt+1=μvt+L(θtημvt)v_{t+1} = \mu v_t + \nabla L(\theta_t - \eta \mu v_t)
θt+1=θtηvt+1\theta_{t+1} = \theta_t - \eta v_{t+1}

With momentum μ0.9\mu \approx 0.9, effective learning rate is η/(1μ)=10η\eta / (1 - \mu) = 10\eta.

Canonical Papers

On the importance of initialization and momentum in deep learning

Sutskever et al.2013ICML
Read paper →

A method for unconstrained convex minimization problem with the rate of convergence O(1/k²)

Nesterov1983Soviet Mathematics Doklady
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.