M06 / FOUNDATIONS

Optimizers. How weights
actually move downhill.

The loss tells you which way is down (the gradient). The optimizer decides how far and how smartly to step. Plain gradient descent zig-zags and stalls; momentum and adaptive methods like Adam navigate ravines and saddles far better. Race them on the same surface and watch.

EXPERIMENT 06.01 · OPTIMIZER.RACE METHODS · 6 STATUS · LIVE
Gradient descent in one line → θ ← θ − η · ∇L(θ). The gradient ∇L points uphill; we step the opposite way, scaled by learning rate η. Every optimizer below is a smarter version of this update — adding memory (momentum) or per-parameter step sizes (adaptive).
// 01

The race · same surface, same start, six optimizers

SURFACE
A simple convex bowl — every optimizer reaches the bottom.
SHOW
CONTROLS
BASE LR η 0.050
SPEED 3
LOSS SURFACE · trajectories iter 0
LOSS vs ITER
STANDINGS
// 02

What each one adds

OPTIMIZER IDEA UPDATE WATCH OUT
SGDstep opposite the gradientθ −= η·gzig-zags in ravines, slow
Momentumaccumulate a velocityv = μv − η·g; θ += vcan overshoot the minimum
NAGmomentum, but look ahead firstgrad at θ+μvslightly more stable than plain momentum
AdaGradper-param LR ∝ 1/√(past grad²)G += g²; θ −= η·g/√GLR decays to 0, stalls late
RMSPropAdaGrad with a forgetting factorE = ρE+(1−ρ)g²needs LR tuning
Adammomentum + RMSProp, bias-correctedm, v moments → θ −= η·m̂/√v̂the default; sometimes generalizes worse than SGD
Try this → Switch to RAVINE and run. Watch SGD bounce across the valley walls while Adam and Momentum glide down the floor. Then try ROSENBROCK — the classic hard case — and crank the LR until SGD diverges. This is exactly why Adam became the go-to default for deep nets.