Adam or Gauss-Newton? A Comparative Study In Terms of Basis Alignment and SGD Noise
Bingbin Liu, Rachit Bansal, Depen Morwani, Nikhil Vyas, David Alvarez-Melis, Sham M. Kakade
TL;DR
The paper investigates how the choice of basis for diagonal preconditioning and gradient noise from mini-batching influence the performance of Adam versus Gauss-Newton (GN) diagonal preconditioners. By separating basis effects (identity vs GN eigenbasis) from diagonal scaling (Adam vs GN$^{-1}$ or GN$^{-1/2}$) and analyzing linear and logistic models, the authors derive conditions under which GN is optimal and where Adam can outperform GN, especially under misaligned bases. They demonstrate that in full-batch settings, Adam can surpass GN and GN$^{-1}$, while in stochastic settings Adam behaves similarly to GN$^{-1/2}$, with equivalence holding across bases for linear regression under Gaussian inputs. These theoretical insights are supported by comprehensive experiments on convex and non-convex tasks, including MLPs and Transformers, confirming the practical relevance of basis alignment and gradient-noise considerations for diagonal preconditioners and suggesting avenues for designing auto-tuning optimizers that retain the favorable properties of Adam across batch regimes.
Abstract
Diagonal preconditioners are computationally feasible approximate to second-order optimizers, which have shown significant promise in accelerating training of deep learning models. Two predominant approaches are based on Adam and Gauss-Newton (GN) methods: the former leverages statistics of current gradients and is the de-factor optimizers for neural networks, and the latter uses the diagonal elements of the Gauss-Newton matrix and underpins some of the recent diagonal optimizers such as Sophia. In this work, we compare these two diagonal preconditioning methods through the lens of two key factors: the choice of basis in the preconditioner, and the impact of gradient noise from mini-batching. To gain insights, we analyze these optimizers on quadratic objectives and logistic regression under all four quadrants. We show that regardless of the basis, there exist instances where Adam outperforms both GN$^{-1}$ and GN$^{-1/2}$ in full-batch settings. Conversely, in the stochastic regime, Adam behaves similarly to GN$^{-1/2}$ for linear regression under a Gaussian data assumption. These theoretical results are supported by empirical studies on both convex and non-convex objectives.
