Adafactor is an optimizer that stores Adam's average of squared gradients approximately, using only the row sums and column sums of each weight matrix, greatly reducing optimizer memory. Shazeer and Stern (Google Brain) proposed it in 2018 (ICML 2018). It also drops momentum and adds a mechanism that limits the size of updates and a step size proportional to the scale of the weights.
Adam keeps two values for every parameter: the average of the gradient and the average of the squared gradient. The paper points out that this requires twice the memory of the model weights on top of the weights themselves, tripling memory usage. Because memory had not kept pace with compute and had become the limit on model size, this extra memory was a problem.
Adafactor reduces this memory in two ways.
- Store the second moment in factored form: for an weight matrix, instead of keeping all moving averages of squared gradients, it keeps only the row sums ( values) and the column sums ( values). For a matrix, for example, 4 million values become 5,000.
- Use no momentum (first moment): since it does not keep the average of the gradient either, the only extra memory is for the row and column sums.
Dropping momentum, however, can make training unstable. The paper traces the cause to stale second-moment estimates that make updates too large, and addresses it with "update clipping", which limits the size of updates, and a schedule that gradually increases the decay rate of the second moment. As an analogy, instead of memorizing every cell of a table, it remembers only the row totals and the column totals and estimates each cell when needed.

