Momentum › A Worked Example: Tracking Velocity Through an Update
Language AI HandbookAll chapters Momentum › A Worked Example: Tracking Velocity Through an UpdateOne section · Sections in this chapter12 / 18 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To solidify the mechanics, let us trace through a few steps of momentum by hand on a simple two-parameter problem. Consider a loss function (a narrow valley with curvature ratio 25:1 between the two dimensions). Starting at with learning rate and momentum (PyTorch formulation), initial velocity .
The gradient at position is:
Step 1: Gradient at is .
Step 2: Gradient at is .
Notice what happened: the velocity in the direction (the steep dimension) jumped from 50 to 70, even though the step reduced by half. The velocity has overshot and is now pointing in the wrong direction. This will cause oscillations in before damping out.
Step 3: Gradient at is .
The velocity is shrinking (from 70 to 53) because the gradient flipped sign. Meanwhile velocity is growing from 1.0 to 1.88 to 2.634, because the gradient in has been consistently positive. After many steps, the velocity will oscillate and decay while velocity grows steadily. This is precisely the dampening-oscillations, accelerating-consistent-directions behavior described earlier, made concrete in numbers.