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

Foundation Lab

Adam & Adaptive Gradient Methods

Large foundation models almost universally use Adam or AdamW for pretraining and fine-tuning

Concept 3 of 100OptimizationPhase 3
#3AdamOptimization
key equation\theta_{t+1} = \theta_t - \alpha \frac{\hat m_t}{\sqrt{\hat v_t} + \varepsilon}

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 3 of 100AdamOptimization / Phase 3: Optimization & generalization
Current question

Geometric explanation of how per-coordinate scaling with 1/√vₜ interacts with overparameterized nets—why it sometimes hurts generalization vs SGD

\theta_{t+1} = \theta_t - \alpha \frac{\hat m_t}{\sqrt{\hat v_t} + \varepsilon}
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 in the newer notebook.

This atlas page keeps the working demo; the domain notebook carries the fuller Intuition -> Math -> Code -> Demo sequence.

Why It Matters for Modern Models

  • Large foundation models almost universally use Adam or AdamW for pretraining and fine-tuning
  • RLHF and diffusion training use Adam-style optimizers to handle noisy gradients and widely varying scales

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Geometric explanation of how per-coordinate scaling with 1/√vₜ interacts with overparameterized nets—why it sometimes hurts generalization vs SGD
  • How Adam bias-correction and exponential averaging interact with curriculum and non-stationary objectives (e.g. RLHF)

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
θt+1=θtαm^tv^t+ε\theta_{t+1} = \theta_t - \alpha \frac{\hat m_t}{\sqrt{\hat v_t} + \varepsilon}

For gradient gt=θLt(θt)g_t = \nabla_\theta L_t(\theta_t):

mt=β1mt1+(1β1)gtvt=β2vt1+(1β2)gt2m^t=mt/(1β1t),v^t=vt/(1β2t)θt+1=θtαm^tv^t+ε\begin{aligned} m_t &= \beta_1 m_{t-1} + (1-\beta_1) g_t \\ v_t &= \beta_2 v_{t-1} + (1-\beta_2) g_t^2 \\ \hat m_t &= m_t / (1-\beta_1^t),\quad \hat v_t = v_t / (1-\beta_2^t) \\ \theta_{t+1} &= \theta_t - \alpha \frac{\hat m_t}{\sqrt{\hat v_t} + \varepsilon} \end{aligned}

Convergence analyses show that naïve Adam can diverge on simple convex problems and motivate variants like AMSGrad.

Canonical Papers

Adam: A Method for Stochastic Optimization

Kingma & Ba2014ICLR
Read paper →

On the Convergence of Adam and Beyond

Reddi et al.2018ICLR
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.