Momentum buffer 2026-11-05
A momentum buffer stores an accumulated history of gradients for an optimization algorithm. In one common convention, a parameter vector , supplied gradient , learning rate and constant coefficient obey the recurrence relation
The buffer belongs to the optimizer state: it remembers earlier inputs even when the current parameters are unchanged. This is the undampened momentum convention used by PyTorch stochastic gradient descent with weight decay and the Nesterov accelerated gradient method disabled; its documented first buffer is the first gradient, agreeing with this recurrence from . Other conventions absorb the learning rate into the stored buffer, so a buffer value needs its update convention to be interpreted.[ref]
Repeated substitution gives the exponentially weighted gradient history
To verify this identity, substitute its expression for into : multiplication by raises every old exponent by one, and the added is precisely the new exponent-zero term. The formula holds at because its sum is empty, completing the mathematical induction.
For an original scalar example with and a constant supplied gradient , the geometric series yields . At , and the limit is 10. The buffer is an unnormalized sum: multiplying it by changes its scale, and would require a corresponding learning rate adjustment to preserve these parameter updates.
The same memory explains why momentum can temporarily oppose the current gradient. If , and the new scalar gradient is , then . With a positive learning rate, the parameter still decreases, although the present negative gradient alone would call for an increase. Persistence can carry motion through rapidly alternating gradients, but this example also shows why the rule need not decrease the objective function at every step.
Nesterov accelerated gradient method Created 2026-09-28 Updated 2026-11-05
For a differentiable convex function on a Euclidean space with -Lipschitz gradient, , one form of the Nesterov accelerated gradient method uses
starting with . The first extrapolation is zero. Each later step uses the previous displacement to form an extrapolated point , then evaluates the gradient there.[ref]
If a global minimizer exists with , the objective error is . Reaching error therefore takes iterations. The parameter schedule and convex smoothness hypotheses are part of that guarantee.
The same extrapolation can be combined with a proximal gradient method step to handle an additional nonsmooth convex term.
When has full row rank, projected gradient ascent with step has linear convergence and requires
iterations, up to the initial-error constant. The accelerated projected method of Nesterov requires
Without full row rank, the general smooth-convex bounds are and , respectively, when a dual optimum lies within distance of the initial point.
Choose
so the smooth maximum error is at most and the Lipschitz gradient constant is
Suppose a minimizer of lies within distance of the starting point. The Nesterov accelerated gradient method can find such that
in
iterations. If minimizes , then the smoothing inequalities imply
This improves the nonsmooth subgradient method dependence from to .