How many gradients a momentum buffer remembers
symbolic▲▲△Unroll the momentum recurrence into a sum over past gradients, identify the weights, and derive the effective window length. Then say what and each mean in steps, and what the buffer’s magnitude is for a constant gradient.
Hint
Substitute the recurrence into itself a few times. The coefficients form a sequence you can recognise and sum.
Solution
Unrolling. The recurrence is the first half of (I.7.5). With :
The buffer is a weighted sum of every gradient so far, with weights decaying geometrically. Nothing is forgotten exactly; contributions become negligible.
The window. The natural measure is the mean age of a contribution, weighted by its coefficient:
so the buffer averages over roughly recent steps — the usual statement, differing from by one.
Moving from to is not a small adjustment: it multiplies the memory by ten.
Magnitude for a constant gradient. If for every step, the sum is geometric:
The buffer settles at , which is at . The step is , so momentum multiplies the effective step size by in any direction where the gradient is consistent. Raising without lowering is a learning-rate increase in disguise, and it is a common way to make a stable configuration diverge while believing only the smoothing changed.
Why the asymmetry helps. In a direction where the gradient oscillates in sign, consecutive terms cancel and stays small. In a direction where it is consistent, they accumulate to . Momentum damps the first and amplifies the second, which is exactly the discrimination the ill-conditioned problem of I.7.B03 requires — and it is why the improvement there was a factor of fifty rather than a modest smoothing.
The variant worth knowing. Some formulations use , which normalises the weights to sum to one and removes the gain. PyTorch’s SGD uses the first form and its Adam uses the second, so the same means a different effective step in the two — a fact worth checking before porting a configuration between them.