Improving Adaptive Moment Optimization via Preconditioner Diagonalization Son Nguyen, Bo Liu, Lizhang Chen, Qiang Liu Abstract Modern deep learning heavily relies on adaptive optimization methods like Adam and its variants, celebrated for their robustness against model scale and ease of hyperparameter tuning. However, the gradient statistics employed by these methods often do not leverage sufficient gradient covariance information, leading to suboptimal updates in certain directions of the parameter space and potentially slower convergence. In this work, we keep track of such covariance statistics in the form of a structured preconditioner matrix. Unlike other works, our approach does not apply direct approximations to estimate this matrix. We instead implement an invertible transformation that maps the preconditioner matrix into a new space where it becomes approximately diagonal . This enables a diagonal approximation of the preconditioner matrix in the transformed space, offering several computational advantages. Empirical results show that our approach can substantially enhance the convergence speed of modern adaptive optimizers. Notably, for large language models like LLaMA, we can achieve a 2x speedup in sample efficiency compared to Adam. In addition, our method can also be integrated with memory-efficient optimizers to manage computational overhead. 1] The University of Texas at Austin ] {sonnv77, bliu, lzchen, lqiang}@utexas.edu 1 Introduction In the realm of deep learning optimization, finding efficient and reliable solutions to complex problems has become a central challenge. As model scales and datasets continue to expand, such optimization problems usually demand extensive training time and substantial computational resources to achieve state-of-the-art performances. Standard first-order methods, such as stochastic gradient descent (SGD) and its variants, have emerged as canonical tools for training large-scale deep networks. These methods are straightforward to implement using modern automatic differentiation frameworks and are easily adaptable to non-conventional training setups [ Konečnỳ et al. 2016 , Li et al. 2020 , Finn et al. 2017 ] . However, despite their strong theoretical grounding [ Şimşekli et al. 2019 , Zhou et al. 2020 , Smith et al. 2021 , Tian et al. 2023 ] , first-order methods typically require meticulous tuning of hyperparameters to ensure the optimization process can converge to the desired local optima [ Zhang et al. 2022 ] . In practice, these methods often struggle when navigating highly non-convex loss surfaces, a common characteristic of deep learning models. Pathological features like saddle points, flat regions, and sharp valleys in the loss landscape can significantly hinder convergence, leading to inefficient training. To tackle these challenges, optimization techniques have evolved to incorporate curvature geometry or second-order information, providing more adaptive and efficient updates. A classic family of such algorithms is preconditioned gradient methods, in which the gradient is premultiplied by a matrix called a preconditioner before each optimization step. Classic algorithms in this family include Newton methods [ Bonnans et al. 2006 ] and Natural Gradient [ Martens 2020 ] , which employ the inverses of local Hessian and Fisher Information Matrix as preconditioners, respectively. Although preconditioning methods typically exhibit much faster convergence than first-order approaches, their practical application is limited by the size of most real-world problems, as they demand quadratic storage and cubic computation time for each gradient update [ Fletcher 2000 , Bonnans et al. 2006 ] . In addition to preconditioning, adaptive moment estimation is another line of work that has been highly influential in deep learning optimization. These methods, including AdaGrad [ Duchi et al. 2011 ] , Adam [ Kingma and Ba 2014 ] , AMSGrad [ Reddi et al. 2019 ] , and Adafactor [ Shazeer and Stern 2018 ] dynamically adapt the learning rate of each parameter throughout the optimization process by leveraging cumulative second-order gradient statistics. While their theoretical foundations are not yet fully explored, these algorithms have demonstrated more robust empirical results than SGD in various domains and often exhibit better convergence behaviors in practice [ Loshchilov and Hutter 2017 , Zhang et al. 2020 , Kunstner et al. 2024 , Zhang et al. 2024 ] . Our approach . In this work, we explore adaptive moment-based algorithms from the perspective of preconditioning methods. We are driven by the understanding that the second-moment estimates in these algorithms can be derived from the diagonal approximation of a structured preconditioner. We propose to improve this approximation by applying an invertible transformation that maps the preconditioner into a new space where it becomes approximately diagonal. In this transformed space, the diagonal elements of the preconditioner can be accumulated to estimate second-order statistics better. Since the transformation is invertible, we can formulate the update on the original parameter space by doing a simple projection back. Our key contributions are outlined as follows: 1. Our approach is designed to be both straightforward and versatile, facilitating easy integration into existing adaptive moment-based optimizers such as RMSprop, Adam, and its variants. 2. We establish a convergence guarantee for the general framework without requiring typical strong assumptions. This guarantee is significant because it is broadly applicable to a wide range of adaptive optimizers, ensuring reliable performances in diverse scenarios. 3. We can effortlessly adapt our method to memory-efficient optimizers, enabling practical training of large models while preserving strict theoretical guarantees of convergence. 4. Empirical results show that our proposed methods can substantially enhance the convergence speed and efficiency of adaptive moment-based optimization baselines. Particularly in pretraining large-scale models like LLaMA, our approach can achieve a speedup of 1.5x to 2x compared to the Adam, but with manageable computational overhead. Notations : For any matrices \bm{\mathrm{A}},\bm{\mathrm{B}} of size m\times n , we use \sqrt{\bm{\mathrm{A}}} for element-wise square root, \bm{\mathrm{A}}^{2} for element-wise square, and \bm{\mathrm{A}}/\bm{\mathrm{B}} for element-wise division. The symbol \bm{\mathrm{A}}^{\top} stands for the transpose matrix, \langle\bm{\mathrm{A}},\bm{\mathrm{B}}\rangle=\text{trace}(\bm{\mathrm{A}}^{\top}\bm{\mathrm{B}}) represents the inner products of matrices, and \bm{\mathrm{A}}\otimes\bm{\mathrm{B}} is the Kronecker product. Let \mathrm{diag}(.) denote the diagonal matrix, and \text{vec}(.) denote the vectorization of a matrix. We write [t]=\{1,\ldots,t\} as the first t positive integers. 2 Preliminaries and Background We consider an unconstrained, continuous optimization problem \min_{\bm{\mathrm{W}}\in\mathbb{R}^{d}}\mathcal{L}(\bm{\mathrm{W}};\bm{\mathrm{X}}) , with \bm{\mathrm{X}} denotes observations, \mathcal{L}:\mathbb{R}^{d}\rightarrow\mathbb{R} is a proper differentiable and lower bounded objective function. 2.1 Preconditioned Gradient Descent The iterative scheme of preconditioned gradient descent can be expressed as follows: \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}-\eta_{t}\bm{\mathrm{C}}(t)\nabla\mathcal{L}(\bm{\mathrm{W}}_{t};\bm{\mathrm{X}}), (1) where the matrix \bm{\mathrm{C}}(t) is referred to as preconditioner. When \bm{\mathrm{C}}(t) is set to the identity matrix, the update simplifies to ordinary gradient descent. To capture curvature informativeness, systematic designs of \bm{\mathrm{C}}(t) have been developed using local numerical approximations. Classic algorithms in this category, including Newton methods and Natural Gradient, utilize the inverse of Hessian and Fisher Information Matrix, respectively, as preconditioners. These methods offer a built-in mechanism for curvature awareness, promoting larger updates in directions associated with small Hessian eigenvalues to swiftly navigate flat regions while limiting movement in directions with large Hessian eigenvalues to avoid sharp valleys. However, for large-scale models, further approximations to the preconditioners are necessary to ensure their practicality. Various techniques have been proposed for this purpose, such as Quasi-Newton methods [ Fletcher 2000 ] , Gaussian-Newton estimators [ Botev et al. 2017 , Martens 2020 , Liu et al. 2023 ] , K-FAC [ Martens and Grosse 2015 , Grosse and Martens 2016 ] . 2.2 Adaptive Moment Estimation These methods, such as AdaGrad and Adam dynamically adjust learning rates for each parameter by incorporating a form of gradient-based statistics. Specifically with Adam, it estimates both first and second-order moments by maintaining exponential moving averages (EMA) on the mean and uncentered variance of gradient information across iterations. Let \bm{\mathrm{G}}_{\tau}\triangleq\nabla\mathcal{L}(\bm{\mathrm{W}}_{\tau};\bm{\mathrm{X}}) denote the gradient of loss function at iteration \tau , the update rules are defined as: \displaystyle\bm{\mathrm{M}}_{t} \displaystyle=\hat{\beta}_{1t}\bm{\mathrm{M}}_{t-1}+(1-\hat{\beta}_{1t})\bm{\mathrm{G}}_{t}\triangleq\EMA_{\tau\in[t]}\left[\bm{\mathrm{G}}_{\tau}\right] \displaystyle\bm{\mathrm{V}}_{t} \displaystyle=\hat{\beta}_{2t}\bm{\mathrm{V}}_{t-1}+(1-\hat{\beta}_{2t})\bm{\mathrm{G}}_{t}^{2}\triangleq\EMA_{\tau\in[t]}\left[\bm{\mathrm{G}}_{\tau}^{2}\right] \displaystyle\bm{\mathrm{W}}_{t+1} \displaystyle=\bm{\mathrm{W}}_{t}-\eta_{t}\frac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon} where \hat{\beta}_{1t},\hat{\beta}_{2t} are the decay moment coefficients, \epsilon is the smoothing tolerance constant to avoid numerical instability. In principle, the first moment amplifies the gradient in directions that are consistently the same sign and dampens the gradient in directions that are reversing sign. Meanwhile, the second moment captures the curvature by adjusting the step size based on gradient magnitude: smaller steps in steep-gradient regions to avoid overshooting and larger steps in shallow-gradient regions for faster convergence. 2.3 Adaptive Moment Estimation via Diagonal Preconditioning Approximation Let us examine the matrix case where \bm{\mathrm{W}} represents a weight parameter with dimensions m\times n . We analyze a preconditioner \bm{\mathrm{C}}_{t} exploiting the second-order moment of accumulated gradients in the following inverse form: \bm{\mathrm{C}}_{t}=\left[\mathbb{E}_{p(\bm{\mathrm{X}})}[\text{vec}(\bm{\mathrm{G}}_{t})\text{vec}(\bm{\mathrm{G}}_{t})^{\top}]+\epsilon\bm{\mathrm{I}}_{mn}\right]^{-1/2} (2) We have \bm{\mathrm{C}}_{t} as a positive definite matrix of size mn\times mn , which is quadratic to the size of model parameter \bm{\mathrm{W}} . An analytical formulation of this quality is often intractable in practice. However, under the assumption of stationary gradient distribution, we can approximate the expectation by leveraging minibatch sampling in conjunction with the exponential moving average technique. We then obtain an empirical preconditioner defined by: \bm{\mathrm{C}}_{t}=\left[\EMA_{\tau\in[t]}\left[\text{vec}(\bm{\mathrm{G}}_{\tau})\text{vec}(\bm{\mathrm{G}}_{\tau})^{\top}\right]+\epsilon\bm{\mathrm{I}}_{mn}\right]^{-1/2}, (3) where \bm{\mathrm{G}}_{\tau}:=\frac{1}{|\mathcal{B}_{\tau}|}\sum_{\bm{\mathrm{X}}\in\mathcal{B}_{\tau}}\nabla\mathcal{L}(\bm{\mathrm{W}}_{\tau};\bm{\mathrm{X}}) is the minibatch gradient at training step \tau . This empirical preconditioner closely resembles the full matrix version of AdaGrad [ Duchi et al. 2011 ] , but instead of using a cumulative sum, we apply an exponential moving average (EMA). Directly calculating and storing the matrix \bm{\mathrm{C}}_{t} is computationally expensive, particularly with modern network architectures, since it requires inverting a very large matrix. A practical way to alleviate this bottleneck is by using diagonal approximation: \displaystyle\bm{\mathrm{C}}_{t}^{(d)} \displaystyle=\left[\EMA_{\tau\in[t]}\mathrm{diag}\left(\text{vec}(\bm{\mathrm{G}}_{\tau})\text{vec}(\bm{\mathrm{G}}_{\tau})^{\top}\right)+\epsilon\bm{\mathrm{I}}_{mn}\right]^{-1/2} \displaystyle=\mathrm{diag}^{-1/2}\left(\EMA_{\tau\in[t]}\left[\text{vec}(\bm{\mathrm{G}}_{\tau}^{2})+\epsilon\right]\right). (4) The diagonal preconditioner \bm{\mathrm{C}}_{t}^{(d)} represents the inverse root square of the second-order gradient accumulator, which is widely adopted as the adaptive moment estimation in optimizers such as AdaGrad, RMSprop, Adam, and variants. Implementing this diagonal approximation offers advantages in both computational efficiency and memory usage. Amari et al. 2019 also demonstrate that the off-diagonal components of \bm{\mathrm{C}}_{t} are smaller than the diagonal components by a factor of 1/\sqrt{N} , where N is the number of elements in the matrix. This insight contributes to understanding the practical success of optimizers like AdaGrad, Adam, and others. However, by omitting the off-diagonal elements, the algorithm does not incorporate gradient correlations, which can be particularly useful in accelerating optimization [ Martens and Grosse 2015 , Gupta et al. 2018 , Liu et al. 2023 ] . 3 Preconditioner Diagonalization with Gradient Projection Algorithm 1 AdaDiag and AdaDiag++ for matrix parameter \bm{\mathrm{W}} of size m\times n , m\leq n Inputs: moment coefficients \beta_{1},\beta_{2} , smoothing term \epsilon=10^{-8} , regularization constant \lambda Initialization: weight parameters \bm{\mathrm{W}}_{0}\in\mathbb{R}^{m\times n} , initial moments \bm{\mathrm{M}}_{0},\bm{\mathrm{V}}_{0}\leftarrow 0 repeat t\leftarrow t+1 \bm{\mathrm{G}}_{t}=\nabla\mathcal{L}(\bm{\mathrm{W}}_{t};\mathcal{B}_{t}) if t\text{ mod }T=0 then \bm{\mathrm{P}}_{t},\ \_,\ \bm{\mathrm{Q}}_{t}^{\top} = torch.linalg.svd ( \bm{\mathrm{G}}_{t} , full_matrices=True ) else \bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t}^{\top}\leftarrow\bm{\mathrm{P}}_{t-1},\bm{\mathrm{Q}}_{t-1}^{\top} end if \widetilde{\bm{\mathrm{G}}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t} \widetilde{\bm{\mathrm{G}}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}\bm{\mathrm{Q}}_{t} \bm{\mathrm{M}}_{t}=\hat{\beta}_{1t}\bm{\mathrm{M}}_{t-1}+(1-\hat{\beta}_{1t})\widetilde{\bm{\mathrm{G}}}_{t} \bm{\mathrm{V}}_{t}=\hat{\beta}_{2t}\bm{\mathrm{V}}_{t-1}+(1-\hat{\beta}_{2t})\widetilde{\bm{\mathrm{G}}}_{t}^{2} \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}-\eta_{t}\left(\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}+\lambda\bm{\mathrm{W}}_{t}\right) \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}-\eta_{t}\left(\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}\bm{\mathrm{Q}}_{t}^{\top}+\lambda\bm{\mathrm{W}}_{t}\right) until stopping criterion is met return optimized parameter \bm{\mathrm{W}}_{t} To leverage the off-diagonal components of the preconditioner matrix, one can implement structural approximations, like Gaussian-Newton estimators [ Botev et al. 2017 , Martens 2020 , Liu et al. 2023 ] , or Kronecker factorization [ Martens and Grosse 2015 , Gupta et al. 2018 ] . In this section, we approach the problem from a different perspective of preconditioner diagonalization. Specifically, we will rationalize the diagonal approximation assumption by applying an implicit orthogonal transformation on the preconditioner matrix \bm{\mathrm{C}}_{t} . Intuitively, this technique will rotate the gradients to align with coordinate axes partially, ultimately causing the matrix \bm{\mathrm{C}}_{t} to become approximately diagonal. Moreover, we will show that this transformation is invertible via a network reparameterization, leading to a simple update on the original parameter space. Figure 1 : Histograms of off-diagonal elements \mathcal{C}(\bm{\mathrm{G}}_{\tau}) (original) and \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) ( two-sided projection), corresponding to the two first layers of ResNet50 trained on ImageNet1k. In this experiment, we set the frequency T=500 and plot histograms at iterations with and without SVD applied. Recall \bm{\mathrm{G}}_{\tau} is a matrix of size m\times n , with m\leq n . Define \mathcal{C}(\bm{\mathrm{G}}_{\tau})\triangleq\text{vec}(\bm{\mathrm{G}}_{\tau})\text{vec}(\bm{\mathrm{G}}_{\tau})^{\top} , then: \bm{\mathrm{C}}_{t}=\left[\EMA_{\tau\in[t]}\left[\mathcal{C}(\bm{\mathrm{G}}_{\tau})\right]+\epsilon\bm{\mathrm{I}}_{mn}\right]^{-1/2}. (5) Let’s start by drawing some intuitions through the diagonalization of matrix \mathcal{C}(\bm{\mathrm{G}}_{\tau}) . Given the special formula of \mathcal{C}(\bm{\mathrm{G}}_{\tau}) , we can perform a straightforward approach using Singular Value Decomposition (SVD) on the gradient \bm{\mathrm{G}}_{\tau} . Suppose we have \bm{\mathrm{G}}_{\tau}=\bm{\mathrm{P}}_{\tau}\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top}, in which \bm{\mathrm{P}}_{\tau},\bm{\mathrm{Q}}_{\tau} are orthogonal matrices of size m\times m,n\times n , respectively, and \bm{\mathrm{\Sigma}}_{\tau} is a diagonal matrix of size m\times n . Substituting this representation into \mathcal{C}(\bm{\mathrm{G}}_{\tau}) gives us: \displaystyle\mathcal{C}(\bm{\mathrm{G}}_{\tau}) \displaystyle=\text{vec}(\bm{\mathrm{P}}_{\tau}\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top})\text{vec}(\bm{\mathrm{P}}_{\tau}\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top})^{\top} \displaystyle=(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})^{\top}(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})^{\top} Since \bm{\mathrm{\Sigma}}_{\tau} is a diagonal matrix, we have \text{vec}(\bm{\mathrm{\Sigma}}_{\tau})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})^{\top} is almost diagonal (off-diagonal elements are mostly zero). Moreover, the matrix \bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau} satisfies (\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})^{\top}=(\bm{\mathrm{Q}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top})\otimes(\bm{\mathrm{P}}_{\tau}\bm{\mathrm{P}}_{\tau}^{\top})=\bm{\mathrm{I}}_{mn} , so we can consider \bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau} as an orthogonal diagonalizing matrix with: (\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})^{-1}\mathcal{C}(\bm{\mathrm{G}}_{\tau})(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{P}}_{\tau})=\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})^{\top}. Alternatively, the diagonalization process above can be equivalently derived from \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) , with \widetilde{\bm{\mathrm{G}}}_{\tau}\triangleq\bm{\mathrm{P}}^{\top}_{\tau}\bm{\mathrm{G}}_{\tau}\bm{\mathrm{Q}}_{\tau}=\bm{\mathrm{\Sigma}}_{\tau} . This rotation aligns the gradient \widetilde{\bm{\mathrm{G}}}_{t} with coordinate axes and consequently induces a roughly diagonal structure on \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) . 3.1 Periodic Subspace Projection Figure 2 : Sparsity of one-sided projection. The analysis presented above applies only to the iteration in which SVD is implemented. However, it is impractical to utilize SVD at every iteration of the training procedure due to computational overhead. Fortunately, there are recent works on low-rank gradient projection [ Gur-Ari et al. 2018 , Gooneratne et al. 2020 , Zhao et al. 2024 , Liang et al. 2024 ] indicating that the optimization process usually acts on low-dimensional subspaces. GaLore [ Zhao et al. 2024 ] exploits this concept by showing that the training trajectory can be divided into continual subspaces, from which the gradients within each subspace can be governed by a common spanning basis. GaLore deployed this idea by periodically applying SVD on the gradients to extract projection matrices. Mathematically, during each period of length T , say [\kappa T,(\kappa+1)T] , the gradient \bm{\mathrm{G}}_{\tau} can be decomposed as: \bm{\mathrm{G}}_{\tau}\approx\bm{\mathrm{P}}_{\kappa}\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\kappa}^{\top}\quad\forall\tau\in[\kappa T,(\kappa+1)T] where \bm{\mathrm{P}}_{\kappa},\_,\bm{\mathrm{Q}}_{\kappa}^{\top}\leftarrow\text{SVD}(\bm{\mathrm{G}}_{\kappa T}) are kept the same throughout the period. We can adapt this assumption to our framework. In this way, we can expect that our projected gradients in each period are still approximately diagonal, namely: \widetilde{\bm{\mathrm{G}}}_{\tau}\triangleq\bm{\mathrm{P}}^{\top}_{\kappa}\bm{\mathrm{G}}_{\tau}\bm{\mathrm{Q}}_{\kappa}\approx(\bm{\mathrm{P}}^{\top}_{\kappa}\bm{\mathrm{P}}_{\kappa})\bm{\mathrm{\Sigma}}_{\tau}(\bm{\mathrm{Q}}_{\kappa}^{\top}\bm{\mathrm{Q}}_{\kappa})=\bm{\mathrm{\Sigma}}_{\tau}. As a result, we can achieve a desired diagonal structure on \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}),\forall\tau\in[\kappa T,(\kappa+1)T] . Why the full matrices \bm{\mathrm{P}}_{\kappa},\bm{\mathrm{Q}}_{\kappa} matter: connection and difference with Galore . It is essential to note that, since GaLore’s focus is on memory efficiency, they just implemented truncated SVD to capture the top- K representation of the gradient matrices. This assumption is reasonable when considering that gradients are low-rank matrices. However, using truncated SVD involves careful tweaking of the K values and more importantly, the gradient projection step has to be executed on the smaller dimension of the matrix. 1 1 1 Let’s omit subscripts \tau,\kappa for simplicity. Consider \bm{\mathrm{G}}_{m\times n}\approx\bm{\mathrm{P}}_{m\times K}\bm{\mathrm{\Sigma}}_{K\times K}\bm{\mathrm{Q}}_{n\times K}^{\top} as the truncated SVD of gradient matrix \bm{\mathrm{G}}_{m\times n} with m\leq n . The GaLore algorithm performs a gradient projection as \widetilde{\bm{\mathrm{G}}}=\bm{\mathrm{P}}_{m\times K}^{\top}\bm{\mathrm{G}} , which maps n vectors of size m from \bm{\mathrm{G}} onto the subspace spanned by K vectors of size m from \bm{\mathrm{P}}_{m\times K} . Since K\leq m\leq n , this operator is more effective than projecting in larger dimensions, i.e. \widetilde{\bm{\mathrm{G}}}=\bm{\mathrm{G}}\bm{\mathrm{Q}}_{n\times K} . On the other hand, our framework would require sophisticated modifications in GaLore, of which \bm{\mathrm{P}}_{\kappa},\bm{\mathrm{Q}}_{\kappa} need to be the full matrices or K is at least the effective rank. This guarantees that \bm{\mathrm{P}}_{\kappa},\bm{\mathrm{Q}}_{\kappa} can form complete bases for the rows and columns of the gradient matrices in each period. To make the algorithm effortless, we propose to adopt the full matrices instead of tunning effective rank K . One-sided projection . Instead of using two-sided projection as described so far, we can opt for a simpler version involving just one-sided projection, namely \widetilde{\bm{\mathrm{G}}}_{\tau}\triangleq\bm{\mathrm{P}}^{\top}_{\tau}\bm{\mathrm{G}}_{\tau}=\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top} , then we have: \displaystyle\mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) \displaystyle\triangleq\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau})\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau})^{\top}=\text{vec}(\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top})^{\top} \displaystyle=(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{I}}_{m})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})\text{vec}(\bm{\mathrm{\Sigma}}_{\tau})^{\top}(\bm{\mathrm{Q}}_{\tau}\otimes\bm{\mathrm{I}}_{m})^{\top}. The projected gradient \widetilde{\bm{\mathrm{G}}}_{\tau}=\bm{\mathrm{\Sigma}}_{\tau}\bm{\mathrm{Q}}_{\tau}^{\top} inherently exhibits a sparse structure as illustrated in Figure 2 . This is because \bm{\mathrm{\Sigma}}_{\tau} is a diagonal matrix and the smallest singular values on the diagonal will zero out the magnitude of corresponding rows on \bm{\mathrm{Q}}_{\tau} . In Figure 1 and 13 , we further show the histograms of off-diagonal elements of \mathcal{C}(\bm{\mathrm{G}}_{\tau}) and \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) (both two-sided and one-sided ), corresponding to the two first layers of ResNet50 trained on ImageNet1k. We can observe notable differences in sparsity patterns of off-diagonal elements of \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) compared to the original \mathcal{C}(\bm{\mathrm{G}}_{\tau}) over iterations. The matrix \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) is roughly diagonal, enabling a more accurate diagonal approximation for the preconditioner matrix \widetilde{\bm{\mathrm{C}}}_{t} . 3.2 Gradient Projection Implies Network Reparameterization In the previous sections, we demonstrated that we can rotate the gradients \bm{\mathrm{G}}_{\tau} to \widetilde{\bm{\mathrm{G}}}_{\tau} in such a way that the matrix \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) is approximately diagonal. Consequently, it induces a diagonal approximation of \widetilde{\bm{\mathrm{C}}}_{t} as follows: \displaystyle\widetilde{\bm{\mathrm{C}}}_{t}^{(d)} \displaystyle=\left[\EMA_{\tau\in[t]}\mathrm{diag}\left[\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau})\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau})^{\top}\right]+\epsilon\bm{\mathrm{I}}_{mn}\right]^{-1/2} \displaystyle=\mathrm{diag}^{-1/2}\left[\EMA_{\tau\in[t]}\left[\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau}^{2})+\epsilon\right]\right], (6) The preconditioned gradient at iteration t then becomes: \widetilde{\bm{\mathrm{C}}}_{t}^{(d)}\text{vec}(\widetilde{\bm{\mathrm{G}}}_{t})=\frac{\text{vec}(\widetilde{\bm{\mathrm{G}}}_{t})}{\sqrt{\EMA_{\tau\in[t]}\left[\text{vec}(\widetilde{\bm{\mathrm{G}}}_{\tau}^{2})+\epsilon\right]}} (7) However, this quantity cannot be directly applied to update the weight parameters, as the gradient projection implicitly imposes a reparameterization on the weight space. In Figure 3 , we illustrate how the update in equation 7 can be utilized to learn a rotated network rather than the original one. This rotated network introduces two auxiliary layers defined by \bm{\mathrm{P}}_{\kappa},\bm{\mathrm{Q}}_{\kappa}^{\top} , and reparameterizes the original weight parameters as \widetilde{\bm{\mathrm{W}}}=\bm{\mathrm{P}}_{\kappa}^{\top}\bm{\mathrm{W}}\bm{\mathrm{Q}}_{\kappa} . While this transformation does not alter the forward pass of the original network, it does lead to a corresponding gradient, represented as: \displaystyle\nabla_{\widetilde{\bm{\mathrm{W}}}}\mathcal{L}(\widetilde{\bm{\mathrm{W}}};\bm{\mathrm{X}}) \displaystyle=\bm{\mathrm{P}}_{\kappa}^{\top}\nabla_{\bm{\mathrm{W}}}\mathcal{L}(\widetilde{\bm{\mathrm{W}}};\bm{\mathrm{X}})\bm{\mathrm{Q}}_{\kappa} \displaystyle\underset{\text{same forward response}}{=}\bm{\mathrm{P}}_{\kappa}^{\top}\nabla_{\bm{\mathrm{W}}}\mathcal{L}(\bm{\mathrm{W}};\bm{\mathrm{X}})\bm{\mathrm{Q}}_{\kappa}, which is equivalent to our two-sided gradient projection. Therefore, we can derive the preconditioned gradient descent for the rotated network using the following update: \widetilde{\bm{\mathrm{W}}}_{t+1}=\widetilde{\bm{\mathrm{W}}}_{t+1}-\eta_{t}\frac{\widetilde{\bm{\mathrm{G}}}_{t}}{\sqrt{\EMA_{\tau\in[t]}\left[\widetilde{\bm{\mathrm{G}}}_{\tau}^{2}+\epsilon\right]}} (8) of which, we dropped the vectorization to ensure dimensional compatibility. Since \bm{\mathrm{P}}_{\kappa} and \bm{\mathrm{Q}}_{\kappa} are full-rank orthogonal matrices, the reparameterization is invertible and thus the update on the original parameter can be obtained by a projection back step as: \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t+1}-\eta_{t}\bm{\mathrm{P}}_{\kappa}\frac{\widetilde{\bm{\mathrm{G}}}_{t}}{\sqrt{\EMA_{\tau\in[t]}\left[\widetilde{\bm{\mathrm{G}}}_{\tau}^{2}+\epsilon\right]}}\bm{\mathrm{Q}}_{\kappa}^{\top}, (9) for t\in[\kappa T,(\kappa+1)T] . x y \bm{\mathrm{W}} \frac{\partial\mathcal{L}}{\partial x} \frac{\partial\mathcal{L}}{\partial y} x \widetilde{x} \bm{\mathrm{P}}_{\kappa} \frac{\partial\mathcal{L}}{\partial x} \frac{\partial\mathcal{L}}{\partial\widetilde{x}} \widetilde{y} \widetilde{\bm{\mathrm{W}}} \bm{\mathrm{P}}_{\kappa}^{\top}\bm{\mathrm{W}}\bm{\mathrm{Q}}_{\kappa} \frac{\partial\mathcal{L}}{\partial\widetilde{y}} y \bm{\mathrm{Q}}_{\kappa}^{\top} \frac{\partial\mathcal{L}}{\partial y} Figure 3 : Illustration of network reparameterization induced by full-rank gradient projection. 3.3 Final Algorithm and Related Works We provide the details of our proposal in Algorithm 1 , which encompasses both two-sided and one-sided rotation versions. We also employ an exponential moving average of the projected gradients \widetilde{\bm{\mathrm{G}}} to derive the first-order moment estimation \bm{\mathrm{M}}_{t} . This accumulation is performed before applying preconditioning. It should be noted that our implementation requires torch.linalg.svd ( \bm{\mathrm{G}}_{t} , full_matrices=True ) to extract the full projection matrices \bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t} in each period. Given the flexibility of our framework, we can adapt it for other adaptive optimizers. In Appendix A.1 , we provided variants of the algorithm tailored for Adafactor and Hfac, along with empirical results evaluating their performances. In connection with other existing algorithms, several prior works on optimization are relevant to our framework. George et al. 2018 and Liu et al. 2018 proposed utilizing the eigenbasis of the Fisher Information Matrix to construct diagonal preconditioning approximations within the natural gradient or online Laplace approximation families. Similarly, Anil et al. 2020 extends this idea by leveraging the eigendecomposition of Shampoo’s preconditioners as a basis for the diagonal transformations. Our method, in contrast, focuses on diagonalizing the preconditioner matrix within the generalized family of adaptive moment-based optimization algorithms, which includes Adam, Adafactor as specific cases. While primarily inspired by the critical idea of gradient projection in GaLore, we explore the full-rank projection case and thus move beyond GaLore’s main focus on memory efficiency. We also acknowledge the concurrent work by SOAP [ Vyas et al. 2024 ] , which obtains the projection matrices \bm{\mathrm{P}}_{t} and \bm{\mathrm{Q}}_{t} by performing eigendecomposition on the accumulators of \bm{\mathrm{G}}_{t}\bm{\mathrm{G}}_{t}^{\top} and \bm{\mathrm{G}}_{t}^{\top}\bm{\mathrm{G}}_{t} (referred to as Shampoo preconditioners), respectively. Essentially, the eigenvector matrix retrieved from the eigendecomposition of \bm{\mathrm{G}}_{t}\bm{\mathrm{G}}_{t}^{\top} (and \bm{\mathrm{G}}_{t}^{\top}\bm{\mathrm{G}}_{t} ) corresponds to the left (and right) singular matrix of \bm{\mathrm{G}}_{t} . Our proposal is therefore effectively equivalent to SOAP without accumulations, resulting in enhanced memory efficiency. From a practical standpoint, our algorithms substantially outperform Adam with only a manageable overhead. 3.4 Improving computational and memory efficiency Although our proposal can greatly enhance the performance, it comes with an inevitable trade-off in algorithmic complexity. While the total computational overhead induced by periodic SVD is negligible (less than 10\% ), the memory usage caused by the full-rank projection may limit the applicability of the algorithms. To address this challenge, we propose to apply the general framework to memory-efficiency optimization methods such as Adafactor [ Shazeer and Stern 2018 ] , Hfac [ Nguyen et al. 2024 ] . This optimizer employs a rank-1 parameterization to the moment estimates and thus offers a sublinear memory cost. In Table 3 , we provide an analysis of the complexity of these algorithms. Adafactor with momentum (w/ m.) and Hfac have demonstrated results comparable to Adam on various tasks [ Shazeer and Stern 2018 , Chen et al. 2024 , Nguyen et al. 2024 ] . Therefore, a simple integration with our method could potentially surpass Adam’s performance while maintaining a similar complexity. We conducted several experiments to validate this hypothesis, with the results presented in Appendix A.1 and A.2 . Figure 4 : Top-1 Accuracy of optimizers in pretraining ResNet50, ViT-B/32, and ViT-S/16 from scratch on the ImageNet1k. For better ViT’s visualization, we crop the learning curve up to epoch 80. 4 Convergence Analysis In comparison to optimizers such as AdaGrad, Adam, and variants, the algorithm 1 introduces additional projection matrices \{\bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t}\} , resulting in complex interactions between the model parameter \bm{\mathrm{W}}_{t} and optimization states \bm{\mathrm{S}}_{t}=\{\bm{\mathrm{M}}_{t},\bm{\mathrm{V}}_{t}\} . It is important to note that the second-order momentum \bm{\mathrm{V}}_{t} is the key factor in our framework. Without this quantity, the proposed algorithm would degenerate to the standard gradient descent with momentum, eliminating any potential improvements. This implies that the algorithms cannot be reduced to a simpler form for analyzing convergence guarantees. Moreover, applying SVD periodically to produce projection matrices also causes intricate behaviors in the dynamic subspace of optimization trajectory. It is unclear whether the momentum estimates accumulated across previous subspaces would be consistent with each other and advantageous for updates conducted in subsequent subspaces. As such, we need a general and robust theoretical framework to encompass a wide range of adaptive moment-based optimizers, including memory-efficient ones like Adafactor and Hfac. Inspired by the recent works on Online Subspace Descent [ Liang et al. 2024 ] and Hfac, we leverage the Hamiltonian descent framework to tackle these challenges. Essentially, this framework investigates continuous-time ODE forms of optimizers in the limit of infinitesimal step size. In this setting, the optimizers will minimize an associated Hamiltonian function \mathcal{H}(.) , which is an augmented version of the original objective \mathcal{L}(.) . For example, we can derive a continuous-time form for Adam optimizer as: \displaystyle(\text{Adam-ODE}):\hskip 5.78172pt\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\bm{\mathrm{M}}_{t}/(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon), \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}=\bm{\mathrm{G}}_{t}^{2}-\bm{\mathrm{V}}_{t}, which yields a Hamiltonian functions defined by: \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{V}})=\mathcal{L}(\bm{\mathrm{W}})+\dfrac{1}{2}\left\langle\bm{\mathrm{M}}/(\sqrt{\bm{\mathrm{V}}}+\epsilon),\bm{\mathrm{M}}\right\rangle . Proposition 1 . Using this general approach, we formulate continuous-time forms for AdaDiag and AdaDiag++: \displaystyle(\text{{\color[rgb]{0,0,1}AdaDiag}}):\hskip 5.78172pt\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}, \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t},\hskip 5.78172pt\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}=(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t})^{2}-\bm{\mathrm{V}}_{t} \displaystyle(\text{{\color[rgb]{0.75,0,0.25}AdaDiag++}}):\hskip 5.78172pt\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}\bm{\mathrm{Q}}_{t}^{\top}, \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}\bm{\mathrm{Q}}_{t}-\bm{\mathrm{M}}_{t},\hskip 5.78172pt\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}=(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}\bm{\mathrm{Q}}_{t})^{2}-\bm{\mathrm{V}}_{t} Both yield the same Hamiltonian function: \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{V}})=\mathcal{L}(\bm{\mathrm{W}})+\dfrac{1}{2}\left\langle\bm{\mathrm{M}}/(\sqrt{\bm{\mathrm{V}}}+\epsilon),\bm{\mathrm{M}}\right\rangle . Convergence to Local Optima . The key properties is that the function \mathcal{H}(.) is monotonically non-decreasing along its ODE trajectory, namely \dfrac{\mathrm{d}}{\mathrm{d}t}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})\leq 0,\forall t . By LaSalle’s Invariance principle, the set of accumulation points (\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}) must be contained in \mathcal{I} , where \mathcal{I}=\{\text{the union of complete trajectories satisfying } \dfrac{\mathrm{d}}{\mathrm{d}t}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})=0\} . The points in limit set \mathcal{I} should satisfy \bm{\mathrm{P}}_{t}^{\top}\nabla\mathcal{L}(\bm{\mathrm{W}}_{t})\equiv 0 for AdaDiag or \bm{\mathrm{P}}_{t}^{\top}\nabla\mathcal{L}(\bm{\mathrm{W}}_{t})\bm{\mathrm{Q}}_{t}\equiv 0 for AdaDiag++, respectively. Since \bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t} are full-rank orthogonal matrices, we must have \nabla\mathcal{L}(\bm{\mathrm{W}}_{t})\equiv 0 , which indicates that all trajectories will converge to local optimal points. Detailed analysis is provided in Appendix B . 5 Experiments In this section, we conduct several experiments on image classification and language modeling tasks to verify the efficiency of our algorithms. We will also demonstrate that our general framework can be effectively applied to enhance adaptive moment-based optimizers such as Adafactor and Hfac. 5.1 Image Classification We first evaluated the optimization algorithms, including AdamW, AdaDiag, and AdaDiag++, by pretraining the ImageNet1k dataset from scratch using ResNets and Vision Transformers (ViTs) architectures. The images underwent Inception-style cropping [ Szegedy et al. 2016 ] and random horizontal flipping during pre-processing. We trained ResNet50 for 90 epochs with a batch size of 1024, utilizing a cosine learning rate decay scheduler. For ViTs, we conducted training over 300 epochs with a batch size of 4096, using a learning rate schedule that included a 10,000-step warmup followed by linear decay. Additionally, we employed strong data augmentations, such as RandAugment (2,15) [ Cubuk et al. 2019 ] and mixup (0.5) [ Zhang et al. 2017 ] , to further improve the performance of the ViTs. For hyperparameters settings, such as learning rate ( lr ), weight decay ( \lambda ), and dropout rate ( dr ), we opted for recommended configurations from prior research and left them in Appendix C . Table 1 : Comparison of Adam and AdaDiag on pre-training ResNets and ViTs architectures with ImageNet1k dataset. Top-1 accuracy on the validation set is reported. Models ResNet50 ViT-S/16 ViT-B/32 AdamW 75.61 78.35 72.20 Shampoo 75.71 79.58 73.47 AdaDiag 75.85 79.18 73.39 AdaDiag++ 75.86 79.14 73.24 As shown in Figure 4 , AdaDiag and AdaDiag++ exhibit substantial improvements in convergence speed compared to the baseline AdamW. For the ViT-B/32 and ViT-S/16 models, we focus on the first third of the training phase so that we can observe notable accelerations across the three models. For the full performances, we refer to the results in Figure 11 in Appendix D . The final results at convergence are provided in Table 1 . By more accurate approximations of the preconditioner matrix, we expect that AdaDiag++ can navigate the complex curvature more efficiently and thus provide better convergence properties, even compared to AdaDiag. The results appear to support this argument. It’s important to mention that these two algorithms would perform similarly after converging at some point. We hypothesize that the optimization trajectory will eventually converge to a stable region where the gradients reside in a very low-dimensional subspace. The precondition approximations, at this stage, become less critical as the optimization process focuses on fine-tuning within this reduced space. Figure 5 : Training progression for pre-training LLaMA models on C4 dataset. Figure 6 : An ablation study on why the full-rank SVD matters. Figure 7 : Performances of AdaDiag on LLaMA-60M and LLaMA-130M with varying update frequencies T . Table 2 : Comparison of Adam and AdaDiag on pre-training LLaMA models with the C4 dataset. Validation perplexity is reported for models with 60/130/350 Million parameters trained for 1.1/2.2/6.4 Billion training tokens. Optimizer Validation Perplexity 60M / 1.1B 130M / 2.2B 350M / 6.4B Adam 31.12 24.55 18.79 Shampoo 29.91 23.40 17.52 AdaDiag 28.71 22.40 16.91 5.2 Language Modeling We apply the algorithms to pre-train LLaMA-based large language model, with RMSNorm and SwiGLU activations [ Zhang and Sennrich 2019 , Shazeer 2020 , Touvron et al. 2023 ] , on the C4 dataset [ Raffel et al. 2020 ] . We measured the perplexity of the models on the validation set throughout training to assess convergence properties and final model performance. Specifically, we trained LLaMA models of sizes 60M, 130M, and 350M for 10K, 20K, and 60K steps, respectively. The learning rate schedule included a warmup phase during the first 10% of the training steps, followed by cosine annealing that decayed the learning rate to 10% of its initial value. All models used a maximum sequence length of 256 and a batch size of 512. The results are provided in Figure 5 and Table 2 . Our optimizer AdaDiag consistently outperforms Adam on various sizes of LLaMA models. In particular, AdaDiag achieves 1.8x-2x speed-up compared to Adam, matching the same perplexity with half fewer steps. Due to resource constraints, we were unable to conduct experiments with billion-parameter models. However, we are confident that similar results can be reliably achieved with larger-scale models. 5.3 Ablation Study We present an ablation study in Figure 6 to demonstrate the role of full-rank SVD. Essentially, we can incrementally raise the rank of the truncated SVD employed in GaLore until we achieve the effective rank. While this can in principle improve the performance of the algorithm, it requires additional tuning effort as discussed in Section 3.1 . For update frequency T , we illustrate its impact on our algorithm in Figure 7 . We found that the values T=200,500 consistently yielded the best results across all our experiments. These period lengths are also practical in terms of computational cost, as they make the overhead induced by SVD negligible in our algorithm, as evidenced by the wall clock time measurements displayed in Figure 5 . In contrast, more frequent updates ( T=2,10 ) degrade the performance significantly. This might stem from the algorithm having to excessively adapt to the instability introduced by minibatch training. A reasonable frequency should strike a balance between memorization and adaptation throughout the training process. Notably, in cases where the projection matrix was fixed ( T=10k,20k ), we also observed improved results over Adam on language tasks. This finding suggests potential for future works to exploit the optimal subspace for applying moment estimates. Regarding the comparison with SOAP, we found no significant performance differences relative to our algorithms, probably due to the connection discussed in Section 3.3 . 6 Discussion In this work, we proposed an efficient approach to improve adaptive moment-based optimizers by introducing a preconditioner diagonalization strategy. By leveraging an invertible transformation, we were able to enhance the reliability of the diagonal approximation used for the preconditioner matrix, resulting in a more effective estimation of second-order statistics. Our empirical evaluations demonstrated significant improvements in both convergence speed and final model performance across several standard tasks. Furthermore, our work also underscores the significance of employing structural preconditioning techniques to improve existing adaptive learning rate optimizers. Devising new preconditioners or exploring network reparameterization present promising approaches to this problem. In addition, it is vital to establish theoretically sound frameworks to better understand adaptive moment-based optimizers in dynamic subspaces. This would enable us to identify the optimal subspace where the moment estimates can be applied most effectively. Improving Adaptive Moment Optimization via Preconditioner Diagonalization (Supplementary Material) Appendix A Memory-efficient optimizers with factorized moment estimates A.1 Adafactor optimizer Algorithm 2 AdafacDiag for matrix parameter \bm{\mathrm{W}} of size m\times n , m\leq n . When omitting the SVD step and setting the projection matrix \bm{\mathrm{P}} to the identity, we recover the Adafactor optimizer. Inputs: moment decay coefficients \beta_{1},\beta_{2} , smoothing term \epsilon=10^{-30} , regularization constant \lambda Initialization: weight parameters \bm{\mathrm{W}}_{1}\in\mathbb{R}^{m\times n} , initial moments \bm{\mathrm{M}}_{0},\bm{\mathrm{r}}_{0},\bm{\mathrm{s}}_{0}\leftarrow 0 repeat t\leftarrow t+1 \bm{\mathrm{G}}_{t}=\nabla\mathcal{L}(\bm{\mathrm{W}}_{t};\mathcal{B}_{t}) if t\text{ mod }T=0 then \bm{\mathrm{P}}_{t},\ \_,\ \bm{\mathrm{Q}}_{t}^{\top} = torch.linalg.svd ( \bm{\mathrm{G}}_{t} , full_matrices=True ) else \bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t}^{\top}\leftarrow\bm{\mathrm{P}}_{t-1},\bm{\mathrm{Q}}_{t-1}^{\top} end if \widetilde{\bm{\mathrm{G}}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t} \bm{\mathrm{r}}_{t}=\hat{\beta}_{2t}\bm{\mathrm{r}}_{t-1}+(1-\hat{\beta}_{2t})\left[(\widetilde{\bm{\mathrm{G}}}_{t})^{2}+\epsilon\right]\bm{\mathrm{1}}_{n} \bm{\mathrm{s}}_{t}=\hat{\beta}_{2t}\bm{\mathrm{s}}_{t-1}+(1-\hat{\beta}_{2t})\left[(\widetilde{\bm{\mathrm{G}}}_{t}^{\top})^{2}+\epsilon\right]\bm{\mathrm{1}}_{m} \bm{\mathrm{V}}_{t}=\bm{\mathrm{r}}_{t}\bm{\mathrm{s}}_{t}^{\top}/(\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}_{t}) \bm{\mathrm{M}}_{t}=\hat{\beta}_{1t}\bm{\mathrm{M}}_{t-1}+(1-\hat{\beta}_{1t})\mathrm{clip}\left(\widetilde{\bm{\mathrm{G}}}_{t}/\left(\sqrt{\bm{\mathrm{V}}_{t}}\right)\right) \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}-\eta_{t}\left(\bm{\mathrm{P}}_{t}\bm{\mathrm{M}}_{t}+\lambda\bm{\mathrm{W}}_{t}\right) until stopping criterion is met return optimized parameter \bm{\mathrm{W}}_{t} Adafactor [ Shazeer and Stern 2018 ] proposed an efficient rank-1 parameterization for the second moment \bm{\mathrm{V}} , which is widely adopted in adaptive optimization methods like RMSprop, Adam, and its variants. The factorization was derived by minimizing the total elementwise I-divergence subject to componentwise non-negative constraints: \underset{\bm{\mathrm{r}}\in\mathbb{R}^{m},\bm{\mathrm{s}}\in\mathbb{R}^{n}}{\text{minimize}}\sum_{i=1}^{m}\sum_{j=1}^{n}d(V_{ij},r_{i}s_{j}) in which r_{i}\geq 0,s_{j}\geq 0 and d(p,q)=p\log\frac{p}{q}-p+q . Solving this problem results in a closed-form solution denoted by \bm{\mathrm{r}}=\bm{\mathrm{V}}\bm{\mathrm{1}}_{n},\bm{\mathrm{s}}=\bm{\mathrm{V}}^{\top}\bm{\mathrm{1}}_{m}/\bm{\mathrm{r}}^{\top}\bm{\mathrm{1}}_{n} . Intuitively, Adafactor tracks the moving averages of the row and column sums of squared gradients throughout iterations, yielding factored second-moment estimators \bm{\mathrm{r}}_{t} and \bm{\mathrm{s}}_{t} . It then reconstructs a low-rank parameterization of the second-order momentum using a normalized outer product \bm{\mathrm{r}}_{t}\bm{\mathrm{s}}_{t}^{\top}/(\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}_{t}) . This method is computationally efficient and scalable, as it directly offers analytical formulations without requiring further approximations. Incorporating Adafactor into our framework offers significant computational and memory efficiency benefits. This can be evident in Table 3 , from which AdafacDiag demonstrates lower complexity in optimization states when compared to Adam. To further assess the effectiveness of this integration, we carried out experiments similar to those described in the main text. As shown in Figure 8 (top row), AdafacDiag (on ResNet50) and AdafacDiag with momentum (on ViTs) can outperform Adam by noticeable margins. The experiments on LLaMA-based models using the C4 dataset also delivered consistent results, presented in Figure 10 and Table 5 . These advantages highlight the potential of utilizing these algorithms in a wide range of real-world tasks, particularly in large-scale applications. A.2 Hfac optimizer Algorithm 3 HfacDiag for matrix parameters \bm{\mathrm{W}} of size m\times n , m\leq n . When omitting the SVD step and setting the projection matrix \bm{\mathrm{P}} to the identity, we recover the Hfac optimizer. Inputs: moment decay coefficients \beta_{1},\beta_{2} , smoothing term \epsilon , and regularization constant \lambda Initialization: weight parameters \bm{\mathrm{W}}_{1}\in\mathbb{R}^{m\times n} , initial factored moments \bm{\mathrm{u}}_{0},\bm{\mathrm{v}}_{0},\bm{\mathrm{r}}_{0},\bm{\mathrm{s}}_{0}\leftarrow 0 repeat \bm{\mathrm{G}}_{t}=\nabla\mathcal{L}(\bm{\mathrm{W}}_{t};\mathcal{B}_{t}) if t\text{ mod }T=0 then \bm{\mathrm{P}}_{t},\ \_,\ \bm{\mathrm{Q}}_{t}^{\top} = torch.linalg.svd ( \bm{\mathrm{G}}_{t} , full_matrices=True ) else \bm{\mathrm{P}}_{t},\bm{\mathrm{Q}}_{t}^{\top}\leftarrow\bm{\mathrm{P}}_{t-1},\bm{\mathrm{Q}}_{t-1}^{\top} end if \widetilde{\bm{\mathrm{G}}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t} \bm{\mathrm{u}}_{t}=\hat{\beta}_{1t}\bm{\mathrm{u}}_{t-1}+(1-\hat{\beta}_{1t})\widetilde{\bm{\mathrm{G}}}_{t}\bm{\mathrm{1}}_{n}/n \bm{\mathrm{v}}_{t}=\hat{\beta}_{1t}\bm{\mathrm{v}}_{t-1}+(1-\hat{\beta}_{1t})\widetilde{\bm{\mathrm{G}}}_{t}^{\top}\bm{\mathrm{1}}_{m}/m \bm{\mathrm{r}}_{t}=\hat{\beta}_{2t}\bm{\mathrm{r}}_{t-1}+(1-\hat{\beta}_{2t})\big[(\widetilde{\bm{\mathrm{G}}}_{t})^{2}+\epsilon\big]\bm{\mathrm{1}}_{n} \bm{\mathrm{s}}_{t}=\hat{\beta}_{2t}\bm{\mathrm{s}}_{t-1}+(1-\hat{\beta}_{2t})\big[(\widetilde{\bm{\mathrm{G}}}_{t}^{\top})^{2}+\epsilon\big]\bm{\mathrm{1}}_{m} \widehat{\bm{\mathrm{V}}}_{t}=\bm{\mathrm{r}}_{t}\bm{\mathrm{s}}_{t}^{\top}/(\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}_{t}) \phi_{term}=\hat{\beta}_{1t}\big(\bm{\mathrm{u}}_{t}\bm{\mathrm{1}}_{n}^{\top}-\widetilde{\bm{\mathrm{G}}}_{t}\bm{\mathrm{1}}_{n}\bm{\mathrm{1}}_{n}^{\top}/n\big)/\sqrt{\bm{\mathrm{r}}_{t}\bm{\mathrm{1}}_{n}^{\top}/n} \psi_{term}=\hat{\beta}_{1t}\big(\bm{\mathrm{1}}_{m}\bm{\mathrm{v}}_{t}^{\top}-\bm{\mathrm{1}}_{m}\bm{\mathrm{1}}_{m}^{\top}\widetilde{\bm{\mathrm{G}}}_{t}/m\big)/\sqrt{\bm{\mathrm{1}}_{m}\bm{\mathrm{s}}_{t}^{\top}/m} \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}-\eta_{t}\left[\bm{\mathrm{P}}_{t}\left(0.5(\phi_{term}+\psi_{term})+\mathrm{clip}\Big(\widetilde{\bm{\mathrm{G}}}_{t}/\sqrt{\widehat{\bm{\mathrm{V}}}_{t}}\Big)\right)+\lambda\bm{\mathrm{W}}_{t}\right] until stopping criterion is met Table 3 : Memory requirements for different optimizers, with weight parameter of size m\times n,m\leq n . To estimate practical memory costs, we calculate the memory usage of optimization states, specifically the moment estimates, for each optimizer applied to various LLaMA-based models, using the BF16 format. Optimizers Weights Gradient Optim. States 60M 130M 350M 1.3B Adam mn mn 2mn 0.23G 0.52G 1.44G 5.23G AdaDiag mn mn m^{2}+2mn 0.26G 0.62G 1.78G 6.61G AdaDiag++ mn mn m^{2}+n^{2}+2mn 0.36G 0.97G 3.03G 11.59G Adafactor w/ momentum mn mn mn+n 0.18G 0.36G 0.85G 2.87G Adafactor w/o momentum mn mn mn 0.06G 0.10G 0.13G 0.26G AdafacDiag w/ momentum mn mn m^{2}+m+n 0.21G 0.45G 1.19G 4.25G AdafacDiag w/o momentum mn mn m^{2}+m+n 0.09G 0.19G 0.47G 1.63G Hfac mn mn 2(m+n) 0.13G 0.19G 0.26G 0.52G HfacDiag mn mn m^{2}+2(m+n) 0.16G 0.29G 0.60G 1.89G GaLore rank-r=m/4 mn mn mr+2nr 0.13G 0.28G 0.54G 1.78G Figure 8 : Top-1 Accuracy of memory-efficient optimizers in pre-training ResNet50, ViT-B/32, and ViT-S/16 from scratch on the ImageNet1k. Table 4 : Comparison of Adam, Adafactor & AdafacDiag, Hfac & HfacDiag on pre-training ResNets and ViTs architectures with ImageNet1k dataset. Top-1 accuracy on the validation set is reported. The bold values indicate noticeble improvements over the corresponding Adam results. Models ResNet50 ViT-S/16 ViT-B/32 AdamW 75.61 78.35 72.20 Adafactor 75.37 77.14 71.42 AdafacDiag 75.68 78.45 72.54 AdafacDiag++ 75.60 78.56 72.78 Adafactor w/ momentum - 78.44 72.31 AdafacDiag w/ momentum - 78.90 73.24 AdafacDiag++ w/ momentum - 78.66 73.28 Hfac 75.90 77.20 71.87 HfacDiag 75.78 78.20 72.76 Hfac [ Nguyen et al. 2024 ] advances the memory-efficient optimizers by further decomposing the first moment into a rank-1 parameterization. This procedure involves projecting the full gradient onto rank-one spaces defined by column means and row means, then exponentially accumulating these statistics throughout the training process. Hfac can reduce the memory cost to a sublinear level, comparable to that of vanilla SGD without momentum, and still delivers favorable and competitive results across various architectures and datasets. Specific updates are outlined in Algorithm 3 . Intuitively, Adafactor can utilize a full moment \bm{\mathrm{M}} , whereas Hfac decomposes \bm{\mathrm{M}} into vectors \bm{\mathrm{u}} and \bm{\mathrm{v}} , leading to different normalizing mechanisms. While Adafactor normalizes the first-moment \bm{\mathrm{M}} using the second-moment approximation \bm{\mathrm{r}}\bm{\mathrm{s}}^{\top}/\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}} , Hfac scales the factored components of the first moment, \bm{\mathrm{u}}\bm{\mathrm{1}}_{n}^{\top} and \bm{\mathrm{1}}_{m}\bm{\mathrm{v}}^{\top} , by their respective factored second-moment estimators, namely \bm{\mathrm{r}}_{t}\bm{\mathrm{1}}_{n}^{\top}/n and 1_{m}\bm{\mathrm{s}}_{t}^{\top}/m . Table 5 : Comparison of Adam and AdafacDiag on pre-training LLaMA models with the C4 dataset. Validation perplexity is reported for models with 60/130 Million parameters trained for 1.1/2.2 Billion training tokens. The bold values indicate improvements over the corresponding Adam results. Optimizer Validation Perplexity 60M / 1.1B 130M / 2.2B 350M / 6.4B Adam [ Kingma and Ba 2014 ] 31.12 24.55 18.79 AdafacDiag (ours) 31.43 22.82 18.15 AdafacDiag w/ momentum (ours) 28.91 22.54 17.21 Hfac [ Nguyen et al. 2024 ] 31.41 24.59 19.34 HfacDiag (ours) 30.30 22.27 17.50 Although Hfac employs the same derivation for second-moment factorization as in Adafactor, their parameter update schemes are fundamentally different. Adafactor, similar to Adam, updates parameters using the signal-to-noise ratio \bm{\mathrm{M}}/\sqrt{\bm{\mathrm{V}}} . On the other hand, Hfac adopts a momentum RMSprop-like approach, where parameter updates act as accumulators of normalized gradients. Both the momentum and the current gradient in Hfac are rescaled by their corresponding cumulative second-moment information. Figure 9 : Training progression of Adam and AdafacDiag for pre-training LLaMA models on C4 dataset. Figure 10 : Training progression of Adam, Hfac, and HfacDiag for pre-training LLaMA models on C4 dataset. Building on the competitive results of Hfac reported in Nguyen et al. 2024 , we can expect that a naive combination with our preconditioning technique can further boost its performance. We refer to this integrated method as HfacDiag. To validate this hypothesis, we have evaluated HfacDiag and presented the results in Figure 8 (bottom row) and Figure 10 . On the image classification task, HfacDiag performs on par with Adam and even significantly surpasses Adam on ResNet50. For the language modeling task, HfacDiag consistently outperforms Adam across all tested models, showcasing its robustness and reliability. Notably, HfacDiag maintains a reasonable computational cost and memory footprint, as demonstrated in Table 3 and Figure 10 . Specifically with memory usage, HfacDiag achieves the same efficiency as the low-rank GaLore while delivering substantial improvements in practical performance. Appendix B Hamiltonian function analyses We first formalize a unified view of adaptive moment-based optimizers in the update scheme as: \bm{\mathrm{W}}_{t+1}=\bm{\mathrm{W}}_{t}+\phi_{t}(\bm{\mathrm{S}}_{t})\hskip 56.9055pt\bm{\mathrm{S}}_{t}=\psi_{t}(\bm{\mathrm{S}}_{t-1},\nabla\mathcal{L}(\bm{\mathrm{W}}_{t})) (10) where \bm{\mathrm{S}}_{t} is the optimization state, and \phi_{t},\psi_{t} are some mapping functions. One powerful approach to studying the dynamic behavior of these optimizers is to examine their continuous-time ODE forms in the limit of infinitesimal step size [ Maddison et al. 2018 , Gao et al. 2022 , Chen et al. 2023 ] . It provides insights into the asymptotic convergence of the algorithms, abstracting away the choices of step size, discretization, and accumulation errors. We observe that the update 10 can be discretized from the following continuous-time form: \begin{split}\frac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}&=\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})-\Phi(\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}))\\ \frac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{S}}_{t}&=-\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})-\Psi(\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}))\end{split} (11) where \mathcal{H}(.) is a Hamiltonian function that satisfies: \min_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{S}})=\mathcal{L}(\bm{\mathrm{W}})\quad\forall\bm{\mathrm{W}}, meaning that minimizing \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{S}}) will reduce to minimizing the original objective \mathcal{L}(\bm{\mathrm{W}}) . Additionally, \Phi,\Psi are two monotonic mapping satisfying: \|\bm{\mathrm{A}}\|_{\Phi}^{2}=\langle\bm{\mathrm{A}},\Phi(\bm{\mathrm{A}})\rangle\geq 0,\hskip 56.9055pt\|\bm{\mathrm{A}}\|_{\Psi}^{2}=\langle\bm{\mathrm{A}},\Psi(\bm{\mathrm{A}})\rangle\geq 0,\quad\forall\bm{\mathrm{A}} The key properties is that \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{S}}) is monotonically non-decreasing along the trajectory 11 : \displaystyle\frac{\mathrm{d}}{\mathrm{d}t}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}) \displaystyle=\left\langle\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}),\frac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}\right\rangle+\left\langle\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}),\frac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{S}}_{t}\right\rangle \displaystyle=-\left\langle\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}),\Phi(\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}))\right\rangle-\left\langle\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}),\Psi(\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}))\right\rangle \displaystyle=-\|\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})\|_{\Phi}^{2}-\|\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})\|_{\Psi}^{2}\leq 0, where we cancel out the cross terms \left\langle\partial_{\bm{\mathrm{W}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t}),\partial_{\bm{\mathrm{S}}}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{S}}_{t})\right\rangle to get the second equation. This powerful framework covers a wide range of optimizers, including moment-based algorithms as follows: Momentum SGD : \dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\bm{\mathrm{M}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\alpha(\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t}),\quad\bm{\mathrm{G}}_{t}=\nabla\mathcal{L}(\bm{\mathrm{W}}_{t}) with the Hamiltonian function is defined by : \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}})=\mathcal{L}(\bm{\mathrm{W}})+\dfrac{1}{2\alpha}\left\langle\bm{\mathrm{M}},\bm{\mathrm{M}}\right\rangle. Adam [ Kingma and Ba 2014 ] : \dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}=\bm{\mathrm{G}}_{t}^{2}-\bm{\mathrm{V}}_{t},\quad\bm{\mathrm{G}}_{t}=\nabla\mathcal{L}(\bm{\mathrm{W}}_{t}) with the Hamiltonian function is defined by : \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{V}})=\mathcal{L}(\bm{\mathrm{W}})+\dfrac{1}{2}\left\langle\dfrac{\bm{\mathrm{M}}}{\sqrt{\bm{\mathrm{V}}}+\epsilon},\bm{\mathrm{M}}\right\rangle. Adafactor : Shazeer and Stern 2018 \dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\frac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{r}}_{t}\bm{\mathrm{s}}_{t}^{\top}/\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}_{t}}},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{G}}_{t}-\alpha\bm{\mathrm{M}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{r}}_{t}=(\bm{\mathrm{G}}_{t})^{2}\bm{\mathrm{1}}_{n}-\alpha\bm{\mathrm{r}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{s}}_{t}=(\bm{\mathrm{G}}_{t}^{\top})^{2}\bm{\mathrm{1}}_{m}-\alpha\bm{\mathrm{s}}_{t} with the Hamiltonian function is defined by : \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{r}},\bm{\mathrm{s}})=f(\bm{\mathrm{W}})+\dfrac{1}{2}\left\langle\dfrac{\bm{\mathrm{M}}}{\sqrt{\bm{\mathrm{r}}\bm{\mathrm{s}}^{\top}/\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}}},\bm{\mathrm{M}}\right\rangle. Hfac [ Nguyen et al. 2024 ] : \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t} \displaystyle=-\frac{\bm{\mathrm{G}}_{t}}{\sqrt{\bm{\mathrm{r}}_{t}\bm{\mathrm{s}}_{t}^{\top}/\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{r}}_{t}}}-\frac{1}{2}\left[\frac{\bm{\mathrm{u}}_{t}\bm{\mathrm{1}}_{n}^{\top}-\bm{\mathrm{G}}_{t}\bm{\mathrm{1}}_{n}\bm{\mathrm{1}}_{n}^{\top}/n}{\sqrt{\bm{\mathrm{r}}_{t}\bm{\mathrm{1}}_{n}^{\top}}}+\frac{\bm{\mathrm{1}}_{m}\bm{\mathrm{v}}_{t}^{\top}-\bm{\mathrm{1}}_{m}\bm{\mathrm{1}}_{m}^{\top}\bm{\mathrm{G}}_{t}/m}{\sqrt{\bm{\mathrm{1}}_{m}\bm{\mathrm{s}}_{t}^{\top}}}\right] \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{u}}_{t} \displaystyle=\bm{\mathrm{G}}_{t}\bm{\mathrm{1}}_{n}/n-\alpha\bm{\mathrm{u}}_{t},\quad\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{v}}_{t}=\bm{\mathrm{G}}_{t}^{\top}\bm{\mathrm{1}}_{m}/m-\alpha\bm{\mathrm{v}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{r}}_{t}=(\bm{\mathrm{G}}_{t})^{2}\bm{\mathrm{1}}_{n}-\alpha\bm{\mathrm{r}}_{t},\quad\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{s}}_{t}=(\bm{\mathrm{G}}_{t}^{\top})^{2}\bm{\mathrm{1}}_{m}-\alpha\bm{\mathrm{s}}_{t} with the Hamiltonian function is defined by : \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{r}},\bm{\mathrm{s}})=f(\bm{\mathrm{W}})+=\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{u}}\bm{\mathrm{1}}_{n}^{\top}}{\sqrt{\bm{\mathrm{r}}\bm{\mathrm{1}}_{n}^{\top}}},\bm{\mathrm{u}}\bm{\mathrm{1}}_{n}^{\top}\right\rangle+\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{1}}_{m}\bm{\mathrm{v}}^{\top}}{\sqrt{\bm{\mathrm{1}}_{m}\bm{\mathrm{s}}^{\top}}},\bm{\mathrm{1}}_{m}\bm{\mathrm{v}}^{\top}\right\rangle. Proof : Let’s take Adam optimizer as a specific example, we have the derivative: \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t} \displaystyle\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{M}}_{t},\bm{\mathrm{V}}_{t}) \displaystyle=\left\langle\bm{\mathrm{G}}_{t},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}\right\rangle+\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}\right\rangle \displaystyle=\left\langle\bm{\mathrm{G}}_{t},-\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}\right\rangle+\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\bm{\mathrm{G}}_{t}^{2}-\bm{\mathrm{V}}_{t}\right\rangle \displaystyle=-\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{M}}_{t}\right\rangle+\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\sqrt{\bm{\mathrm{V}}_{t}}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\bm{\mathrm{G}}_{t}^{2}\right\rangle \displaystyle=-\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{M}}_{t}\right\rangle+\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}\odot\dfrac{\sqrt{\bm{\mathrm{V}}_{t}}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{M}}_{t}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\bm{\mathrm{G}}_{t}^{2}\right\rangle \displaystyle\leq-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\bm{\mathrm{G}}_{t}^{2}\right\rangle\leq 0. A similar analysis can be applied to the AdaDiag and AdaDiag++. In AdaDiag’s case, we have the continuous form: \dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}=-\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}=\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t},\quad\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}=(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t})^{2}-\bm{\mathrm{V}}_{t}, (12) yielding the Hamiltonian function \mathcal{H}(\bm{\mathrm{W}},\bm{\mathrm{M}},\bm{\mathrm{V}})=\mathcal{L}(\bm{\mathrm{W}})+\dfrac{1}{2}\left\langle\dfrac{\bm{\mathrm{M}}}{\sqrt{\bm{\mathrm{V}}}+\epsilon},\bm{\mathrm{M}}\right\rangle , for which: \displaystyle\dfrac{\mathrm{d}}{\mathrm{d}t} \displaystyle\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{M}}_{t},\bm{\mathrm{V}}_{t}) \displaystyle=\left\langle\bm{\mathrm{G}}_{t},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{W}}_{t}\right\rangle+\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{M}}_{t}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\dfrac{\mathrm{d}}{\mathrm{d}t}\bm{\mathrm{V}}_{t}\right\rangle \displaystyle=\left\langle\bm{\mathrm{G}}_{t},-\bm{\mathrm{P}}_{t}\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon}\right\rangle+\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}-\bm{\mathrm{M}}_{t}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t})^{2}-\bm{\mathrm{V}}_{t}\right\rangle \displaystyle=-\left\langle\dfrac{\bm{\mathrm{M}}_{t}}{\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon},\bm{\mathrm{M}}_{t}\right\rangle+\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},\sqrt{\bm{\mathrm{V}}_{t}}\right\rangle-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t})^{2}\right\rangle \displaystyle\leq-\dfrac{1}{4}\left\langle\dfrac{\bm{\mathrm{M}}_{t}^{2}}{\sqrt{\bm{\mathrm{V}}_{t}}\odot\left(\sqrt{\bm{\mathrm{V}}_{t}}+\epsilon\right)^{2}},(\bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t})^{2}\right\rangle\leq 0. This result implies that the points in the limit set: \mathcal{I}=\{\text{the union of complete trajectories satisfying }\dfrac{\mathrm{d}}{\mathrm{d}t}\mathcal{H}(\bm{\mathrm{W}}_{t},\bm{\mathrm{M}}_{t},\bm{\mathrm{V}}_{t})=0\} must satisfy \bm{\mathrm{P}}_{t}^{\top}\bm{\mathrm{G}}_{t}\equiv 0 . Since \bm{\mathrm{P}}_{t} is a full-rank orthogonal matrix, we have \bm{\mathrm{G}}_{t}\equiv 0 , indicating that the optimization algorithm converges to a local optimum. For AdafacDiag and HfacDiag, the proofs can be derived in a similar manner by incorporating the analyses of Adafactor and Hfac provided in Nguyen et al. 2024 . It is worth mentioning that our algorithms can also be regarded as a special case of Online Subspace Descent with Generalized Linear Projection [ Liang et al. 2024 ] . In their work, however, to provide the convergence guarantee for arbitrary update rules of the projection matrix \bm{\mathrm{P}}_{t} , the authors need a mild condition to avoid the degenerate case of \bm{\mathrm{P}}_{t}\bm{\mathrm{G}}_{t}=0 while \bm{\mathrm{G}}_{t}=0 in the invariant set of the system. In our analysis, this assumption is not required when \bm{\mathrm{P}}_{t} is a full-rank orthogonal matrix. Appendix C Hyperparameter Settings For all optimizers, we used decay moment coefficients (\beta_{1},\beta_{2})=(0.9,0.999) along with the bias-correction steps, the smoothing constant \epsilon=10^{-8} . Specifically with AdaDiag, AdaDiag++, we use the SVD frequency T=500,200 for image and language tasks, respectively. For image classification, we used (lr,\lambda)=(0.001,0.1) and (0.0003,0.1) for all ResNets and ViTs experiments, respectively. For language modeling, we tuned the learning rate over the set {0.003, 0.001, 0.0003, 0.0001} and selected the optimal value based on validation perplexity. The specific settings are summarized in the Table 6 . Table 6 : Training configuration for LLaMA models. LLaMA models Tokens Training Steps Warmup Steps Learning Rate 60M 1.3B 10K 1K 0.003 130M 2.6B 20K 2K 0.001 350M 7.8B 60K 6K 0.001 Appendix D Additional Figures Figure 11 : Top-1 Accuracy of optimizers in pre-training (to the end) ResNet50, ViT-B/32, and ViT-S/16 from scratch on the ImageNet1k. Figure 12 : Histograms of off-diagonal elements \mathcal{C}(\bm{\mathrm{G}}_{\tau}) (original) and \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) ( one-sided projection, AdaDiag), corresponding to the two first layers of ResNet50 trained on ImageNet1k. In this experiment, we set the frequency T=500 and plot histograms at iterations with and without SVD applied. Figure 13 : Histograms of off-diagonal elements \mathcal{C}(\bm{\mathrm{G}}_{\tau}) (original) and \mathcal{C}(\widetilde{\bm{\mathrm{G}}}_{\tau}) ( GaLore ), corresponding to the two first layers of ResNet50 trained on ImageNet1k. Compared to the full-rank case, the low-rank GaLore projection (r=\min\{m,n\}/2) does not exhibit a discernible sparsity structure in the off-diagonal elements. GaLore even creates off-diagonal elements with larger magnitudes. Note it was truncated for better visualization.