Momentum

Intuition

Plain gradient descent zig-zags across narrow valleys. Momentum treats the parameters like a heavy ball: it accumulates velocity in consistent directions and damps oscillations.

Precise explanation

For each parameter θ\theta with gradient gg:

v←βv+g,θ←θ−ηv,v \leftarrow \beta v + g,\qquad \theta \leftarrow \theta - \eta v,

with vv initialised to zeros of the same shape and β∈[0,1)\beta \in [0, 1) (typically 0.9). β=0\beta = 0 is plain SGD. Velocity is optimiser state, kept per parameter between steps. (Some libraries write v←βv+(1−β)gv \leftarrow \beta v + (1-\beta) g; that only rescales the learning rate.)

Worked example

η=0.1\eta = 0.1, β=0.9\beta = 0.9, constant gradient 1: v = 1, 1.9, 2.71 … so the steps grow 0.1, 0.19, 0.271 — acceleration along a consistent slope.

Common mistakes

  • Re-initialising velocity every step (then it is plain SGD).
  • Sharing one velocity array between parameters.
  • Mutating the caller's gradient arrays.

Why this matters

Momentum (and its descendants such as Adam) is how practically every network is trained; FedAvg servers can also apply momentum to aggregated updates.

References