Jiawei Zhao $^{1}$
California Institute of Technology
Zhenyu Zhang $^{3}$
University of Texas at Austin
Beidi Chen $^{2}$ $^{4}$
Meta AI
Carnegie Mellon University
Zhangyang Wang $^{3}$
University of Texas at Austin
Anima Anandkumar $^{*}$ $^{1}$
California Institute of Technology
Yuandong Tian $^{*}$ $^{2}$
Meta AI
$^{*}$ Equal advising
$^{1}$ California Institute of Technology
$^{2}$ Meta AI
$^{3}$ University of Texas at Austin
$^{4}$ Carnegie Mellon University
Correspondence to: Jiawei Zhao [email protected], Yuandong Tian [email protected].
Training Large Language Models (LLMs) presents significant memory challenges, predominantly due to the growing size of weights and optimizer states. Common memory-reduction approaches, such as low-rank adaptation (LoRA), add a trainable low-rank matrix to the frozen pre-trained weight in each layer. However, such approaches typically underperform training with full-rank weights in both pre-training and fine-tuning stages since they limit the parameter search to a low-rank subspace and alter the training dynamics, and further, may require full-rank warm start. In this work, we propose Gradient Low-Rank Projection (GaLore), a training strategy that allows full-parameter learning but is more memory-efficient than common low-rank adaptation methods such as LoRA. Our approach reduces memory usage by up to 65.5% in optimizer states while maintaining both efficiency and performance for pre-training on LLaMA 1B and 7B architectures with C4 dataset with up to 19.7B tokens, and on fine-tuning RoBERTa on GLUE tasks. Our 8-bit GaLore further reduces optimizer memory by up to 82.5% and total training memory by 63.3%, compared to a BF16 baseline. Notably, we demonstrate, for the first time, the feasibility of pre-training a 7B model on consumer GPUs with 24GB memory (e.g., NVIDIA RTX 4090) without model parallel, checkpointing, or offloading strategies. Code is provided in the link.
Executive Summary: GaLore is a new training strategy that projects gradients into compact low-rank subspaces so that full-parameter updates to large language models can be performed with far less memory than standard optimizers or existing low-rank adaptation methods. The work addresses a practical barrier: pre-training or fine-tuning models such as LLaMA-7B normally demands tens of gigabytes just for optimizer states, making the task impossible on a single consumer GPU.
The objective was to demonstrate that full-rank performance can be retained while cutting optimizer memory by roughly two-thirds, without freezing weights, inserting permanent low-rank adapters, or requiring a full-rank warm-up phase. The approach rests on a theoretical result that gradients of typical transformer layers rapidly become low-rank. In practice, every 200 steps the current gradient is decomposed by SVD; the resulting projection matrices map the gradient into a small subspace where Adam (or another optimizer) maintains its momentum and variance statistics. The update is then projected back and added to the full-rank weight matrix. Occasional recomputation of the subspace keeps the method aligned with the evolving gradient direction yet adds negligible amortized cost.
Across LLaMA models from 60 M to 7 B parameters trained on up to 19.7 B C4 tokens, GaLore matched or slightly exceeded the validation perplexity of full-rank BF16 Adam while using 30–65 % less optimizer memory. The 8-bit variant reduced total training memory by 63 % relative to the BF16 baseline and enabled a complete 7 B pre-training run on a single 24 GB RTX 4090 without checkpointing or offloading. On GLUE fine-tuning of RoBERTa-Base the method also outperformed LoRA at identical rank, and it integrated cleanly with existing 8-bit and layer-wise optimizers.
These results matter because they remove the need for model parallelism or specialized clusters for mid-scale pre-training and fine-tuning, lowering both hardware cost and energy consumption. The method converges under the same assumptions that guarantee progress for projected gradient methods on reversible networks, and its only new hyperparameters (rank and subspace-update interval) show stable behavior over a wide range.
For practitioners facing memory limits, the immediate recommendation is to replace the optimizer step with GaLore (two lines of code) and pair it with 8-bit Adam; for production runs, a modest amount of additional data-parallelism across consumer GPUs becomes feasible. Further gains are possible by quantizing the projection matrices themselves and by extending the approach to vision transformers and diffusion models. The main limitations are a modest throughput overhead from SVD and the need to choose rank and update frequency; both are well-characterized in the reported ablations and do not appear to threaten final model quality within the tested regimes.
Section Summary: Large language models demand enormous memory during training not just for their billions of parameters but also for gradients and optimizer states, which often prevents them from running on ordinary GPUs. Existing low-rank methods such as LoRA reduce memory by freezing most weights and training small additive matrices, yet they fall short of full-parameter performance, especially when pre-training from scratch. GaLore instead projects the gradients themselves into a compact low-rank form before the optimizer step, cutting optimizer memory dramatically while still updating every parameter, allowing a 7-billion-parameter model to be trained on a single 24 GB consumer GPU.
Large Language Models (LLMs) have shown impressive performance across multiple disciplines, including conversational AI and language translation. However, pre-training and fine-tuning LLMs require not only a huge amount of computation but is also memory intensive. The memory requirements include not only billions of trainable parameters, but also their gradients and optimizer states (e.g., gradient momentum and variance in Adam) that can be larger than parameter storage themselves ([1, 2, 3]). For example, pre-training a LLaMA 7B model from scratch with a single batch size requires at least 58 GB memory (14GB for trainable parameters, 42GB for Adam optimizer states and weight gradients, and 2GB for activationsprotect$^{*}$). This makes the training not feasible on consumer-level GPUs such as NVIDIA RTX 4090 with 24GB memory.

SetAlFnt SetAlCapFnt
for weight in model.parameters():
grad = weight.grad
# original space -> compact space
lor\_grad = **project**(grad)
# update by Adam, Adafactor, etc.
lor\_update = **update**(lor\_grad)
# compact space -> original space
update = **project\_back**(lor\_update)
weight.data += update
In addition to engineering and system efforts, such as gradient checkpointing [4], memory offloading [5], etc., to achieve faster and more efficient distributed training, researchers also seek to develop various optimization techniques to reduce the memory usage during pre-training and fine-tuning.
Parameter-efficient fine-tuning (PEFT) techniques allow for the efficient adaptation of pre-trained language models (PLMs) to different downstream applications without the need to fine-tune all of the model's parameters ([6]). Among them, the popular Low-Rank Adaptation (LoRA [7]) reparameterizes weight matrix $W\in {\textnormal{r}}^{m\times n}$ into $W = W_0 + BA$, where $W_0$ is a frozen full-rank matrix and $B\in {\textnormal{r}}^{m\times r}$, $A\in {\textnormal{r}}^{r\times n}$ are additive low-rank adaptors to be learned. Since the rank $r \ll \min(m, n)$, $A$ and $B$ contain fewer number of trainable parameters and thus smaller optimizer states. LoRA has been used extensively to reduce memory usage for fine-tuning in which $W_0$ is the frozen pre-trained weight. Its variant ReLoRA is also used in pre-training, by periodically updating $W_0$ using previously learned low-rank adaptors ([8]).
However, many recent works demonstrate the limitation of such a low-rank reparameterization. For fine-tuning, LoRA is not shown to reach a comparable performance as full-rank fine-tuning [9]. For pre-training from scratch, it is shown to require a full-rank model training as a warmup ([8]), before optimizing in the low-rank subspace. There are two possible reasons: (1) the optimal weight matrices may not be low-rank, and (2) the reparameterization changes the gradient training dynamics.
Our approach: To address the above challenge, we propose Gradient Low-Rank Projection (GaLore), a training strategy that allows full-parameter learning but is more memory-efficient than common low-rank adaptation methods, such as LoRA. Our key idea is to leverage the slow-changing low-rank structure of the gradient $G\in {\textnormal{r}}^{m\times n}$ of the weight matrix $W$, rather than trying to approximate the weight matrix itself as low rank.
We first show theoretically that the gradient matrix $G$ becomes low-rank during training. Then, we propose GaLore that computes two projection matrices $P\in {\textnormal{r}}^{m\times r}$ and $Q\in {\textnormal{r}}^{n\times r}$ to project the gradient matrix $G$ into a low-rank form $P^\top G Q$. In this case, the memory cost of optimizer states, which rely on component-wise gradient statistics, can be substantially reduced. Occasional updates of $P$ and $Q$ (e.g., every 200 iterations) incur minimal amortized additional computational cost. GaLore is more memory-efficient than LoRA as shown in Table 1. In practice, this yields up to 30% memory reduction compared to LoRA during pre-training.
We demonstrate that GaLore works well in both LLM pre-training and fine-tuning. When pre-training LLaMA 7B on C4 dataset, 8-bit GaLore, combined with 8-bit optimizers and layer-wise weight updates techniques, achieves comparable performance to its full-rank counterpart, with less than 10% memory cost of optimizer states.
Notably, for pre-training, GaLore keeps low memory throughout the entire training, without requiring full-rank training warmup like ReLoRA. Thanks to GaLore's memory efficiency, it is possible to train LLaMA 7B from scratch on a single GPU with 24GB memory (e.g., on NVIDIA RTX 4090), without any costly memory offloading techniques (Figure 1).
GaLore is also used to fine-tune pre-trained LLMs on GLUE benchmarks with comparable or better results than existing low-rank methods. When fine-tuning RoBERTa-Base on GLUE tasks with a rank of 4, GaLore achieves an average score of 85.89, outperforming LoRA, which achieves a score of 85.61.
As a gradient projection method, GaLore is independent of the choice of optimizers and can be easily plugged into existing ones with only two lines of code, as shown in Algorithm 1. Our experiment (Figure 3) shows that it works for popular optimizers such as AdamW, 8-bit Adam, and Adafactor. In addition, its performance is insensitive to very few hyper-parameters it introduces. We also provide theoretical justification on the low-rankness of gradient update, as well as the convergence analysis of GaLore.
Section Summary: Related work on efficient neural network training includes low-rank adaptation methods such as LoRA, which fine-tune models by updating only small low-rank matrices added to existing weights, along with variants aimed at further cutting memory use or enabling pre-training from scratch. Researchers have also explored subspace learning, where models are optimized within naturally occurring low-dimensional spaces, and noted that gradients during training tend to be low-rank, inspiring techniques to compress them for lower communication and memory costs. GaLore builds on ideas from projected gradient descent but focuses specifically on the structured matrices arising in deep network training, distinguishing it from more general mathematical treatments of the topic.
Low-rank adaptation.
[7] proposed Low-Rank Adaptation (LoRA) to fine-tune pre-trained models with low-rank adaptors. This method reduces the memory footprint by maintaining a low-rank weight adaptor for each layer. There are a few variants of LoRA proposed to enhance its performance ([10, 11, 12, 9]), supporting multi-task learning ([13]), and further reducing the memory footprint ([14]). [8] proposed ReLoRA, a variant of LoRA designed for pre-training, but requires a full-rank training warmup to achieve comparable performance as the standard baseline. Inspired by LoRA, [15] also suggested that gradients can be compressed in a low-rank subspace, and they proposed to use random projections to compress the gradients. There have also been approaches that propose training networks with low-rank factorized weights from scratch ([16, 17, 18]).
Subspace learning.
Recent studies have demonstrated that the learning primarily occurs within a significantly low-dimensional parameter subspace ([19, 20]). These findings promote a special type of learning called subspace learning, where the model weights are optimized within a low-rank subspace. This notion has been widely used in different domains of machine learning, including meta-learning and continual learning ([21, 22]).
Projected gradient descent.
GaLore is closely related to the traditional topic of projected gradient descent (PGD) ([23, 24]). A key difference is that, GaLore considers the specific gradient form that naturally appears in training multi-layer neural networks (e.g., it is a matrix with specific structures), proving many of its properties (e.g., Lemma 2, Theorem 1, and Theorem 5). In contrast, traditional PGD mostly treats the objective as a general blackbox nonlinear function, and study the gradients in the vector space only.
Low-rank gradient.
Gradient is naturally low-rank during training of neural networks, and this property have been studied in both theory and practice ([25, 26, 27]). It has been applied to reduce communication cost ([28, 29]), and memory footprint during training ([30, 31, 32]).
Memory-efficient optimization.
There have been some works trying to reduce the memory cost of gradient statistics for adaptive optimization algorithms ([33, 34, 35]). Quantization is widely used to reduce the memory cost of optimizer states ([35, 36]). Recent works have also proposed to reduce weight gradient memory by fusing the backward operation with the optimizer update ([37, 38]).
Section Summary: The section contrasts standard full-rank training, which maintains large optimizer states such as the moment matrices in Adam and therefore incurs high memory cost, with low-rank update schemes such as LoRA that only adapt a small factorized matrix while leaving the base weights fixed. It then shows theoretically that, although the weights themselves need not be low-rank, the gradients that arise in reversible networks under common losses naturally acquire a low-rank structure: after a few steps the gradient matrix is driven toward the minimal-eigenvalue subspace of a fixed positive-semidefinite operator, so its stable rank drops exponentially. This observation supplies the justification for projecting gradients onto a compact subspace at each step, thereby obtaining memory-efficient yet still expressive updates.
Regular full-rank training. At time step $t$, $G_t = -\nabla_W \varphi_t(W_t) \in {\textnormal{r}}^{m \times n}$ is the backpropagated (negative) gradient matrix. Then the regular pre-training weight update can be written down as follows ($\eta$ is the learning rate):
$ W_T = W_0 + \eta \sum_{t=0}^{T-1} \tilde{G}{t} = W_0 + \eta\sum{t=0}^{T-1} \rho_t(G_t)\tag{1} $
where $\tilde{G}t$ is the final processed gradient to be added to the weight matrix and $\rho_t$ is an entry-wise stateful gradient regularizer (e.g., Adam). The state of $\rho_t$ can be memory-intensive. For example, for Adam, we need $M, V \in {\textnormal{r}}^{m\times n}$ to regularize the gradient $G_t$ into $\tilde{G}{t}$:
$ \begin{aligned} M_t &=& \beta_1 M_{t-1} + (1-\beta_1) G_t \ V_t &=& \beta_2 V_{t-1} + (1-\beta_2) G^2_t \ \tilde{G}_t &=& M_t / \sqrt{V_t + \epsilon} \end{aligned} $
Here $G_t^2$ and $M_t / \sqrt{V_t + \epsilon}$ means element-wise multiplication and division. $\eta$ is the learning rate. Together with $W\in {\textnormal{r}}^{m\times n}$, this takes $3mn$ memory.
Low-rank updates. For a linear layer $W \in \mathbb{R}^{m \times n}$, LoRA and its variants utilize the low-rank structure of the update matrix by introducing a low-rank adaptor $AB$:
$ W_T = W_0 + B_{T}A_{T},\tag{2} $
where $B \in \mathbb{R}^{m \times r}$ and $A \in \mathbb{R}^{r \times n}$, and $r \ll \min(m, n)$. $A$ and $B$ are the learnable low-rank adaptors and $W_0$ is a fixed weight matrix (e.g., pre-trained weight).
Property of Weight Gradient
While low-rank updates are proposed to reduce memory usage, it remains an open question whether the weight matrix should be parameterized as low-rank. In many situations, this may not be true. For example, in linear regression ${\bm{y}} = W {\bm{x}}$, if the optimal $W^*$ is high-rank, then imposing a low-rank assumption on $W$ never leads to the optimal solution, regardless of what optimizers are used.
Surprisingly, while the weight matrices are not necessarily low-rank, the gradient indeed becomes low-rank during the training for certain gradient forms and associated network architectures.
Reversible networks. Obviously, for a general loss function, its gradient can be arbitrary and is not necessarily low rank. Here we study the gradient structure for a general family of nonlinear networks known as "reversible networks" [39], which includes not only simple linear networks but also deep ReLU/polynomial networks:
########## {caption="Definition: Reversiblity [39]"}
A network $\mathcal{N}$ that maps input ${\bm{x}}$ to output ${\bm{y}} = \mathcal{N}({\bm{x}})$ is reversible, if there exists $L({\bm{x}}; W)$ so that ${\bm{y}}= L({\bm{x}}; W){\bm{x}}$, and the backpropagated gradient ${\bm{g}}{\bm{x}}$ satisfies ${\bm{g}}{\bm{x}} = L^\top({\bm{x}}; W) {\bm{g}}{\bm{y}}$, where ${\bm{g}}{\bm{y}}$ is the backpropagated gradient at the output ${\bm{y}}$. Here $L({\bm{x}};W)$ depends on the input ${\bm{x}}$ and weight $W$ in the network $\mathcal{N}$.
Please check Appendix B.1 for its properties. For reversible networks, the gradient takes a specific form.
########## {caption="Theorem 1: Gradient Form of reversible models"}
Consider a chained reversible neural network $\mathcal{N}({\bm{x}}) := \mathcal{N}L(\mathcal{N}{L-1}(\ldots \mathcal{N}_1({\bm{x}})))$ and define $J_l := \mathrm{Jacobian}(\mathcal{N}L) \ldots \mathrm{Jacobian}(\mathcal{N}{l+1})$ and ${\bm{f}}_l := \mathcal{N}_l(\ldots \mathcal{N}_1({\bm{x}}))$. Then the weight matrix $W_l$ at layer $l$ has gradient $G_l$ in the following form for batch size 1:
(a) For $\ell_2$-objective $\varphi := \frac12| {\bm{y}} - {\bm{f}}_L|_2^2$:
$ G_l = \left(J_l^\top {\bm{y}} - J^\top_l J_l W_l {\bm{f}}{l-1}\right){\bm{f}}{l-1}^\top\tag{3} $
(b) Left $P^\perp_{\bm{1}} := I - \frac{1}{K}{\bm{1}} {\bm{1}}^\top$ be the zero-mean PSD projection matrix. For $K$-way logsoftmax loss $\varphi({\bm{y}}; {\bm{f}}_L) := -\log \left(\frac{\exp({\bm{y}}^\top {\bm{f}}_L)}{{\bm{1}}^\top \exp({\bm{f}}L)}\right)$ with small logits $|P^\perp{\bm{1}}{\bm{f}}L|\infty \ll \sqrt{K}$:
$ G_l = \left(J_lP^\perp_{\bm{1}} {\bm{y}} - \gamma K^{-1}J_l^\top P^\perp_{\bm{1}} J_l W_l {\bm{f}}{l-1}\right){\bm{f}}{l-1}^\top\tag{4} $
where $\gamma \approx 1$ and ${\bm{y}}$ is a data label with ${\bm{y}}^\top {\bm{1}} = 1$.
From the theoretical analysis above, we can see that for batch size $N$, the gradient $G$ has certain structures: $G = \frac{1}{N}\sum_{i=1}^N (A_i - B_i W C_i)$ for input-dependent matrix $A_i$, Positive Semi-definite (PSD) matrices $B_i$ and $C_i$. In the following, we prove that such a gradient will become low-rank during training in certain conditions:
########## {caption="Lemma 2: Gradient becomes low-rank during training"}
Suppose the gradient follows the parametric form:
$ G_t=\frac{1}{N}\sum_{i=1}^N (A_i-B_i W_t C_i)\tag{5} $
with constant $A_i$, PSD matrices $B_i$ and $C_i$ after $t \ge t_0$. We study vanilla SGD weight update: $W_t=W_{t-1}+\eta G_{t-1}$. Let $S := \frac{1}{N}\sum_{i=1}^N C_i \otimes B_i$ and $\lambda_1 < \lambda_2$ its two smallest distinct eigenvalues. Then the stable rank $\mathrm{sr}(G_t)$ satisfies:
$ \mathrm{sr}(G_t) \le \mathrm{sr}(G_{t_0}^\parallel)!+!\left(\frac{1!-!\eta \lambda_2}{1!-!\eta \lambda_1}\right)^{2(t-t_0)} \frac{|G_0!-! G_{t_0}^\parallel|F^2}{| G{t_0}^\parallel|_2^2}\tag{6} $
where $G_{t_0}^\parallel$ is the projection of $G_{t_0}$ onto the minimal eigenspace $\mathcal{V}_1$ of $S$ corresponding to $\lambda_1$.
In practice, the constant assumption can approximately hold for some time, in which the second term in Equation 6 goes to zero exponentially and the stable rank of $G_t$ goes down, yielding low-rank gradient $G_t$. The final stable rank is determined by $\mathrm{sr}(G_{t_0}^\parallel)$, which is estimated to be low-rank by the following:
########## {caption="Corollary 3: Low-rank $G_t$ "}
If the gradient takes the parametric form $G_t = \frac{1}{N}\sum_{i=1}^N ({\bm{a}}_i - B_i W_t {\bm{f}}_i){\bm{f}}_i^\top$ with all $B_i$ full-rank, and $N' := \mathrm{rank}({{\bm{f}}i}) < n$, then $\mathrm{sr}(G{t_0}^\parallel) \le n - N'$ and thus $\mathrm{sr}(G_t) \le n/2$ for large $t$.
Remarks. The gradient form is justified by Theorem 1. Intuitively, when $N'$ is small, $G_t$ is a summation of $N'$ rank-1 update and is naturally low rank; on the other hand, when $N'$ becomes larger and closer to $n$, then the training dynamics has smaller null space $\mathcal{V}_1$, which also makes $G_t$ low-rank. The full-rank assumption of ${B_i}$ is reasonable, e.g., in LLMs, the output dimensions of the networks (i.e., the vocabulary size) is often huge compared to matrix dimensions.
In general if the batch size $N$ is large, then it becomes a bit tricky to characterize the minimal eigenspace $\mathcal{V}_1$ of $S$. On the other hand, if $\mathcal{V}_1$ has nice structure, then $\mathrm{sr}(G_t)$ can be bounded even further:
########## {caption="Corollary: Low-rank $G_t$ with special structure of $\mathcal{V}_1$ "}
If $\mathcal{V}1(S)$ is 1-dimensional with decomposable eigenvector ${\bm{v}} = {\bm{y}} \otimes {\bm{z}}$, then $\mathrm{sr}(G{t_0}^\parallel) = 1$ and thus $G_t$ becomes rank-1.
One rare failure case of Lemma 2 is when $G_{t_0}^\parallel$ is precisely zero, in which $\mathrm{sr}(G_{t_0}^\parallel)$ becomes undefined. This happens to be true if $t_0 = 0$, i.e., $A_i$, $B_i$ and $C_i$ are constant throughout the entire training process. Fortunately, for practical training, this does not happen.
Transformers. For Transformers, we can also separately prove that the weight gradient of the lower layer (i.e., project-up) weight of feed forward network (FFN) becomes low rank over time, using the JoMA framework [40]. Please check Appendix (Appendix B.3) for details.
Since the gradient $G$ may have a low-rank structure, if we can keep the gradient statistics of a small "core" of gradient $G$ in optimizer states, rather than $G$ itself, then the memory consumption can be reduced substantially. This leads to our proposed GaLore strategy:
########## {caption="Definition 4: Gradient Low-rank Projection (GaLore)"}
Gradient low-rank projection (GaLore) denotes the following gradient update rules ($\eta$ is the learning rate):
$ W_T = W_0 + \eta\sum_{t=0}^{T-1} \tilde{G}_{t}, \quad \tilde{G}_t = P_t \rho_t(P_t^\top G_t Q_t) Q^\top_t\tag{7} $
where $P_t \in \mathbb{R}^{m \times r}$ and $Q_t \in \mathbb{R}^{n\times r}$ are projection matrices.
Different from LoRA, GaLore explicitly utilizes the low-rank updates instead of introducing additional low-rank adaptors and hence does not alter the training dynamics.
In the following, we show that GaLore converges under a similar (but more general) form of gradient update rule Equation (5). This form corresponds to 3 but with a larger batch size.
########## {caption="Definition: $L$-continuity"}
A function ${\bm{h}}(W)$ has (Lipschitz) $L$-continuity, if for any $W_1$ and $W_2$, $| {\bm{h}}(W_1) - {\bm{h}}(W_2)|_F \le L|W_1-W_2|_F$.
########## {caption="Theorem 5: Convergence of GaLore with fixed projections"}
Suppose the gradient has the form of Equation 5 and $A_i$, $B_i$ and $C_i$ have $L_A$, $L_B$ and $L_C$ continuity with respect to $W$ and $|W_t|\le D$. Let $R_t := P_t^\top G_t Q_t$, $\hat{B}{it} := P_t^\top B{i}(W_t) P_t$, $\hat{C}{it} := Q_t^\top C_i(W_t) Q_t$ and $\kappa_t := \frac1N \sum_i \lambda{\min}(\hat{B}{it}) \lambda{\min}(\hat{C}_{it})$. If we choose constant $P_t = P$ and $Q_t=Q$, then GaLore with $\rho_t \equiv 1$ satisfies:
$ |R_t|F \le \left[1!-!\eta(\kappa{t-1}!-!L_A!-!L_B L_C D^2)\right]|R_{t-1}|_F\tag{8} $
As a result, if $\min_t \kappa_t > L_A + L_B L_C D^2$, $R_t \rightarrow 0$ and thus GaLore converges with fixed $P_t$ and $Q_t$.
Setting $P$ and $Q$. The theorem tells that $P$ and $Q$ should project into the subspaces corresponding to the first few largest eigenvectors of $\hat{B}{it}$ and $\hat{C}{it}$ for faster convergence (large $\kappa_t$). While all eigenvalues of the positive semidefinite (PSD) matrix $B$ and $C$ are non-negative, some of them can be very small and hinder convergence (i.e., it takes a long time for $G_t$ to become $0$). With the projection $P$ and $Q$, $P^\top B_{it} P$ and $Q^\top C_{it} Q$ only contain the largest eigen subspaces of $B$ and $C$, improving the convergence of $R_t$ and at the same time, reduces the memory usage.
While it is tricky to obtain the eigenstructure of $\hat{B}{it}$ and $\hat{C}{it}$ (they are parts of Jacobian), one way is to instead use the spectrum of $G_t$ via Singular Value Decomposition (SVD):
$ \begin{aligned} G_t &= U S V^{\top} \approx \sum_{i=1}^{r} s_{i} u_{i} v_{i}^{\top} \ P_t &= [u_1, u_2, ..., u_r], \quad Q_t = [v_1, v_2, ..., v_r] \end{aligned}\tag{9} $
Difference between GaLore and LoRA. While both GaLore and LoRA have "low-rank" in their names, they follow very different training trajectories. For example, when $r = \min(m, n)$, GaLore with $\rho_t \equiv 1$ follows the exact training trajectory of the original model, as $\tilde{G}_t = P_t P_t^{\top} G_t Q_t Q_t^\top = G_t$. On the other hand, when $BA$ reaches full rank (i.e., $B \in \mathbb{R}^{m \times m}$ and $A \in \mathbb{R}^{m \times n}$), optimizing $B$ and $A$ simultaneously follows a very different training trajectory compared to the original model.
Section Summary: GaLore enables memory-efficient training of large models by projecting gradients into a series of low-rank subspaces that are periodically switched during optimization, allowing the weights to accumulate full-rank updates without ever storing the complete gradient trajectory. By recomputing the projection matrices via SVD at intervals and tracking optimizer statistics such as momentum only in the reduced space, the approach cuts memory usage for methods like Adam well below standard or even LoRA-based training. It remains compatible with further savings from 8-bit optimizers and per-layer updates, while keeping the cost of subspace changes modest.
For a complex optimization problem such as LLM pre-training, it may be difficult to capture the entire gradient trajectory with a single low-rank subspace. One reason is that the principal subspaces of $B_t$ and $C_t$ (and thus $G_t$) may change over time. In fact, if we keep the same projection $P$ and $Q$, then the learned weights will only grow along these subspaces, which is not longer full-parameter training. Fortunately, for this, GaLore can switch subspaces during training and learn full-rank weights without increasing the memory footprint.
![**Figure 2:** Learning through low-rank subspaces $\Delta W_{T_1}$ and $\Delta W_{T_2}$ using GaLore. For $t_1 \in [0, T_1 - 1]$, $W$ are updated by projected gradients $\tilde{G}_{t_1}$ in a subspace determined by fixed $P_{t_1}$ and $Q_{t_1}$. After $T_1$ steps, the subspace is changed by recomputing $P_{t_2}$ and $Q_{t_2}$ for $t_2 \in [T_1, T_2 - 1]$, and the process repeats until convergence.](https://ittowtnkqtyixxjxrhou.supabase.co/storage/v1/object/public/public-images/hygvr5xh/subspace_learning.png)
We allow GaLore to switch across low-rank subspaces:
$ W_t = W_0 + \Delta W_{T_1} + \Delta W_{T_2} + \ldots + \Delta W_{T_n},\tag{10} $
where $t \in \left[\sum_{i=1}^{n-1} T_i, \sum_{i=1}^{n} T_i\right]$ and $\Delta W_{T_i} = \eta\sum_{t=0}^{T_i-1} \tilde{G_t}$ is the summation of all $T_i$ updates within the $i$-th subspace. When switching to $i$-th subspace at step $t=T_i$, we re-initialize the projector $P_t$ and $Q_t$ by performing SVD on the current gradient $G_t$ by Equation 9. We illustrate how the trajectory of $\tilde{G_t}$ traverses through multiple low-rank subspaces in Figure 2. In the experiment section, we show that allowing multiple low-rank subspaces is the key to achieving the successful pre-training of LLMs.
Following the above procedure, the switching frequency $T$ becomes a hyperparameter. The ablation study (Figure 5) shows a sweet spot exists. A very frequent subspace change increases the overhead (since new $P_t$ and $Q_t$ need to be computed) and breaks the condition of constant projection in Theorem 5. In practice, it may also impact the fidelity of the optimizer states, which accumulate over multiple training steps. On the other hand, a less frequent change may make the algorithm stuck into a region that is no longer important to optimize (convergence proof in Theorem 5 only means good progress in the designated subspace, but does not mean good overall performance). While optimal $T$ depends on the total training iterations and task complexity, we find that a value between $T=50$ to $T=1000$ makes no much difference. Thus, the total computational overhead induced by SVD is negligible (
lt; 10%$) compared to other memory-efficient training techniques such as memory offloading ([5]).**Input:** A layer weight matrix W ∈ R(m) × n} with m ≤ n. Step size η, scale factor α, decay rates beta₁, beta₂, rank r, subspace change frequency T.
Initialize first-order moment M₀ ∈ R(n) × r} ← 0
Initialize second-order moment V₀ ∈ R(n) × r} ← 0
Initialize step t ← 0
**repeat**
G(t) ∈ R(m) × n} ← - nabla(W) varphi(t)(W(t))
**if** t bmod T = 0 **then**
U, S, V ← SVD(G(t))
P(t) ← U[:, :r] // Initialize left projector as m ≤ n
**else**
P(t) ← P(t-1) // Reuse the previous projector
**end if**
R(t) ← P(t)^{→p} G(t) // Project gradient into compact space
**UPDATE(R(t)) by Adam**
setlengthitemindentmyindent
addtolengthalgorithmicindentmyindent
M(t) ← beta₁ · M(t-1) + (1 - beta₁) · R(t)
V(t) ← beta₂ · V(t-1) + (1 - beta₂) · R(t)(2)
M(t) ← M(t) / (1 - beta₁^t)
V(t) ← V(t) / (1 - beta₂^t)
N(t) ← M(t) / (sqrtV(t) + epsilon)
G̃_t ← α · P N(t) // Project back to original space
W(t) ← W(t-1) + η · G̃_t
t ← t + 1
**until** convergence criteria met
**return** W(t)
Reducing memory footprint of gradient statistics. GaLore significantly reduces the memory cost of optimizer that heavily rely on component-wise gradient statistics, such as Adam ([41]). When $\rho_t \equiv \mathrm{Adam}$, by projecting $G_t$ into its low-rank form $R_t$, Adam's gradient regularizer $\rho_t(R_t)$ only needs to track low-rank gradient statistics. where $M_t$ and $V_t$ are the first-order and second-order momentum, respectively. GaLore computes the low-rank normalized gradient $N_t$ as follows:
$ N_t = \rho_t(R_t) = M_t / (\sqrt{V_t} + \epsilon).\tag{11} $
GaLore can also apply to other optimizers (e.g., Adafactor) that have similar update rules and require a large amount of memory to store gradient statistics.
Reducing memory usage of projection matrices.
To achieve the best memory-performance trade-off, we only use one project matrix $P$ or $Q$, projecting the gradient $G$ into $P^\top G$ if $m \leq n$ and $G Q$ otherwise. We present the algorithm applying GaLore to Adam in Algorithm 2.
With this setting, GaLore requires less memory than LoRA during training. As GaLore can always merge $\Delta W_t$ to $W_0$ during weight updates, it does not need to store a separate low-rank factorization $BA$. In total, GaLore requires $(mn + mr + 2nr)$ memory, while LoRA requires $(mn + 3mr + 3nr)$ memory. A comparison between GaLore and LoRA is shown in Table 1.
As Theorem 5 does not require the projection matrix to be carefully calibrated, we can further reduce the memory cost of projection matrices by quantization and efficient parameterization, which we leave for future work.
GaLore is compatible with existing memory-efficient optimization techniques. In our work, we mainly consider applying GaLore with 8-bit optimizers and per-layer weight updates.
8-bit optimizers.
[35] proposed 8-bit Adam optimizer that maintains 32-bit optimizer performance at a fraction of the memory footprint. We apply GaLore directly to the existing implementation of 8-bit Adam.
Per-layer weight updates.
In practice, the optimizer typically performs a single weight update for all layers after backpropagation. This is done by storing the entire weight gradients in memory. To further reduce the memory footprint during training, we adopt per-layer weight updates to GaLore, which performs the weight updates during backpropagation. This is the same technique proposed in recent works to reduce memory requirement ([37, 38]).
In addition to Adam's original hyperparameters, GaLore only introduces very few additional hyperparameters: the rank $r$ which is also present in LoRA, the subspace change frequency $T$ (see Section 4.1), and the scale factor $\alpha$.
Scale factor $\alpha$ controls the strength of the low-rank update, which is similar to the scale factor $\alpha/r$ appended to the low-rank adaptor in [7]. We note that the $\alpha$ does not depend on the rank $r$ in our case. This is because, when $r$ is small during pre-training, $\alpha/r$ significantly affects the convergence rate, unlike fine-tuning.
\begin{tabular}{lcc}
\toprule
& GaLore & LoRA \\
\midrule
Weights & $mn$ & $mn+mr+nr$ \\
Optim States & $mr + 2nr$ & $2mr + 2nr$ \\
\midrule
Multi-Subspace & \ding{51} & \ding{55} \\
Pre-Training & \ding{51} & \ding{55} \\
Fine-Tuning & \ding{51} & \ding{51} \\
\bottomrule
\end{tabular}
Section Summary: The experiments section evaluates GaLore by pre-training LLaMA language models ranging from 60 million to 7 billion parameters on the large C4 web-text dataset, as well as fine-tuning on standard GLUE benchmarks, with all runs performed on A100 GPUs. Across model sizes, GaLore delivers validation perplexity nearly matching full-rank Adam training while using far less memory for weights and optimizer states, and it substantially outperforms prior low-rank approaches such as LoRA and ReLoRA. The method also combines readily with memory-efficient optimizers like 8-bit Adam, further lowering the hardware footprint without sacrificing final model quality.
\begin{tabular}{lcccc}
\toprule
& \textbf{60M} & \textbf{130M} & \textbf{350M} & \textbf{1B} \\
\midrule
Full-Rank & 34.06 (0.36G) & 25.08 (0.76G) & 18.80 (2.06G) & 15.56 (7.80G) \\
\midrule
\textbf{GaLore} & \textbf{34.88} (0.24G) & \textbf{25.36} (0.52G) & \textbf{18.95} (1.22G) & \textbf{15.64} (4.38G) \\
Low-Rank & 78.18 (0.26G) & 45.51 (0.54G) & 37.41 (1.08G) & 142.53 (3.57G) \\
LoRA & 34.99 (0.36G) & 33.92 (0.80G) & 25.58 (1.76G) & 19.21 (6.17G) \\
ReLoRA & 37.04 (0.36G) & 29.37 (0.80G) & 29.08 (1.76G) & 18.33 (6.17G) \\
\bottomrule
$r / d_{model}$ & 128 / 256 & 256 / 768 & 256 / 1024 & 512 / 2048 \\
Training Tokens & 1.1B & 2.2B & 6.4B & 13.1B \\
\bottomrule
\end{tabular}
We evaluate GaLore on both pre-training and fine-tuning of LLMs. All experiments run on NVIDIA A100 GPUs.
\begin{tabular}{l|c|cccc}
\toprule
& \textbf{Mem} & \textbf{40K} & \textbf{80K} & \textbf{120K} & \textbf{150K} \\
\midrule
\textbf{8-bit GaLore} & 18G & 17.94 & 15.39 & 14.95 & 14.65 \\
8-bit Adam & 26G & 18.09 & 15.47 & 14.83 & 14.61 \\
\midrule
Tokens (B) & & 5.2 & 10.5 & 15.7 & 19.7 \\
\bottomrule
\end{tabular}

Pre-training on C4.
To evaluate its performance, we apply GaLore to train LLaMA-based large language models on the C4 dataset. C4 dataset is a colossal, cleaned version of Common Crawl's web crawl corpus, which is mainly intended to pre-train language models and word representations ([1]). To best simulate the practical pre-training scenario, we train without data repetition over a sufficiently large amount of data, across a range of model sizes up to 7 Billion parameters.
Architecture and hyperparameters.
We follow the experiment setup from [8], which adopts a LLaMA-basedfootnote[3]LLaMA materials in our paper are subject to LLaMA community license. architecture with RMSNorm and SwiGLU activations ([42, 43, 2]). For each model size, we use the same set of hyperparameters across methods, except the learning rate. We run all experiments with BF16 format to reduce memory usage, and we tune the learning rate for each method under the same amount of computational budget and report the best performance. The details of our task setups and hyperparameters are provided in the appendix.
Fine-tuning on GLUE tasks.
GLUE is a benchmark for evaluating the performance of NLP models on a variety of tasks, including sentiment analysis, question answering, and textual entailment ([44]). We use GLUE tasks to benchmark GaLore against LoRA for memory-efficient fine-tuning.
We first compare GaLore with existing low-rank methods using Adam optimizer across a range of model sizes.
Full-Rank
Our baseline method that applies Adam optimizer with full-rank weights and optimizer states.
Low-Rank
We also evaluate a traditional low-rank approach that represents the weights by learnable low-rank factorization: $W = BA$ ([16]).
LoRA
[7] proposed LoRA to fine-tune pre-trained models with low-rank adaptors: $W = W_0 + BA$, where $W_0$ is fixed initial weights and $BA$ is a learnable low-rank adaptor. In the case of pre-training, $W_0$ is the full-rank initialization matrix. We set LoRA alpha to 32 and LoRA dropout to 0.05 as their default settings.
ReLoRA
[8] proposed ReLoRA, a variant of LoRA designed for pre-training, which periodically merges $BA$ into $W$, and initializes new $BA$ with a reset on optimizer states and learning rate. ReLoRA requires careful tuning of merging frequency, learning rate reset, and optimizer states reset. We evaluate ReLoRA without a full-rank training warmup for a fair comparison.
For GaLore, we set subspace frequency $T$ to 200 and scale factor $\alpha$ to 0.25 across all model sizes in Table 2. For each model size, we pick the same rank $r$ for all low-rank methods, and we apply them to all multi-head attention layers and feed-forward layers in the models. We train all models using Adam optimizer with the default hyperparameters (e.g., $\beta_1=0.9$, $\beta_2=0.999$, $\epsilon=10^{-8}$). We also estimate the memory usage based on BF16 format, including the memory for weight parameters and optimizer states. As shown in Table 2, GaLore outperforms other low-rank methods and achieves comparable performance to full-rank training. We note that for 1B model size, GaLore even outperforms full-rank baseline when $r=1024$ instead of $r=512$. Compared to LoRA and ReLoRA, GaLore requires less memory for storing model parameters and optimizer states. A detailed training setting of each model and memory estimation for each method are in the appendix.
We demonstrate that GaLore can be applied to various learning algorithms, especially memory-efficient optimizers, to further reduce the memory footprint. We apply GaLore to AdamW, 8-bit Adam, and Adafactor optimizers ([33, 45, 35]). We consider Adafactor with first-order statistics to avoid performance degradation.
We evaluate them on LLaMA 1B architecture with 10K training steps, and we tune the learning rate for each setting and report the best performance. As shown in Figure 3, applying GaLore does not significantly affect their convergence. By using GaLore with a rank of 512, the memory footprint is reduced by up to 62.5%, on top of the memory savings from using 8-bit Adam or Adafactor optimizer. Since 8-bit Adam requires less memory than others, we denote 8-bit GaLore as GaLore with 8-bit Adam, and use it as the default method for the following experiments on 7B model pre-training and memory measurement.
Scaling ability to 7B models is a key factor for demonstrating if GaLore is effective for practical LLM pre-training scenarios. We evaluate GaLore on an LLaMA 7B architecture with an embedding size of 4096 and total layers of 32. We train the model for 150K steps with 19.7B tokens, using 8-node training in parallel with a total of 64 A100 GPUs. Due to computational constraints, we compare 8-bit GaLore ($r=1024$) with 8-bit Adam with a single trial without tuning the hyperparameters. As shown in Table 3, after 150K steps, 8-bit GaLore achieves a perplexity of 14.65, comparable to 8-bit Adam with a perplexity of 14.61.

GaLore not only achieves memory-efficient pre-training but also can be used for memory-efficient fine-tuning. We fine-tune pre-trained RoBERTa models on GLUE tasks using GaLore and compare its performance with a full fine-tuning baseline and LoRA. We use hyperparameters from [7] for LoRA and tune the learning rate and scale factor for GaLore. As shown in Table 4, GaLore achieves better performance than LoRA on most tasks with less memory footprint. This demonstrates that GaLore can serve as a full-stack memory-efficient training strategy for both LLM pre-training and fine-tuning.
\begin{tabular}{l|c|cccccccc|c}
\toprule
& \textbf{Memory} & \textbf{CoLA} & \textbf{STS-B} & \textbf{MRPC} & \textbf{RTE} & \textbf{SST2} & \textbf{MNLI} & \textbf{QNLI} & \textbf{QQP} & \textbf{Avg} \\
\midrule
Full Fine-Tuning & 747M & 62.24 & 90.92 & 91.30 & 79.42 & 94.57 & 87.18 & 92.33 & 92.28 & 86.28 \\
\midrule
\textbf{GaLore (rank=4)} & 253M & 60.35 & \textbf{90.73} & \textbf{92.25} & \textbf{79.42} & \textbf{94.04} & \textbf{87.00} & \textbf{92.24} & 91.06 & \textbf{85.89} \\
LoRA (rank=4) & 257M & \textbf{61.38} & 90.57 & 91.07 & 78.70 & 92.89 & 86.82 & 92.18 & \textbf{91.29} & 85.61 \\
\midrule
\textbf{GaLore (rank=8)} & 257M & 60.06 & \textbf{90.82} & \textbf{92.01} & \textbf{79.78} & \textbf{94.38} & \textbf{87.17} & 92.20 & 91.11 & \textbf{85.94} \\
LoRA (rank=8) & 264M & \textbf{61.83} & 90.80 & 91.90 & 79.06 & 93.46 & 86.94 & \textbf{92.25} & \textbf{91.22} & 85.93 \\
\bottomrule
\end{tabular}
While Table 2 gives the theoretical benefit of GaLore compared to other methods in terms of memory usage, we also measure the actual memory footprint of training LLaMA models by various methods, with a token batch size of 256. The training is conducted on a single device setup without activation checkpointing, memory offloading, and optimizer states partitioning ([5]).
Training 7B models on consumer GPUs with 24G memory. As shown in Figure 4, 8-bit GaLore requires significantly less memory than BF16 baseline and 8-bit Adam, and only requires 22.0G memory to pre-train LLaMA 7B with a small per-GPU token batch size (up to 500 tokens). This memory footprint is within 24GB VRAM capacity of a single GPU such as NVIDIA RTX 4090. In addition, when activation checkpointing is enabled, per-GPU token batch size can be increased up to 4096. While the batch size is small per GPU, it can be scaled up with data parallelism, which requires much lower bandwidth for inter-GPU communication, compared to model parallelism. Therefore, it is possible that GaLore can be used for elastic training [46] 7B models on consumer GPUs such as RTX 4090s.
Specifically, we present the memory breakdown in Figure 1. It shows that 8-bit GaLore reduces 37.92G (63.3%) and 24.5G (52.3%) total memory compared to BF16 Adam baseline and 8-bit Adam, respectively. Compared to 8-bit Adam, 8-bit GaLore mainly reduces the memory in two parts: (1) low-rank gradient projection reduces 9.6G (65.5%) memory of storing optimizer states, and (2) using per-layer weight updates reduces 13.5G memory of storing weight gradients.
Throughput overhead of GaLore. We also measure the throughput of the pre-training LLaMA 1B model with 8-bit GaLore and other methods, where the results can be found in the appendix. Particularly, the current implementation of 8-bit GaLore achieves 1019.63 tokens/second, which induces 17% overhead compared to 8-bit Adam implementation. Disabling per-layer weight updates for GaLore achieves 1109.38 tokens/second, improving the throughput by 8.8%. We note that our results do not require offloading strategies or checkpointing, which can significantly impact training throughput. We leave optimizing the efficiency of GaLore implementation for future work.
Section Summary: The ablation study examines how often to switch between low-dimensional subspaces during training and how the choice of subspace rank influences convergence. Experiments show that switching either too often or too infrequently slows progress, while lowering the rank within a reasonable range produces only a modest, roughly linear slowdown that can be offset by running additional training steps. This trade-off lets practitioners reduce memory use by selecting a smaller rank and then compensate with longer training to reach comparable performance.
How many subspaces are needed during pre-training?
We observe that both too frequent and too slow changes of subspaces hurt the convergence, as shown in Figure 5 (left). The reason has been discussed in Section 4.1. In general, for small $r$, the subspace switching should happen more to avoid wasting optimization steps in the wrong subspace, while for large $r$ the gradient updates cover more subspaces, providing more cushion.

How does the rank of subspace affect the convergence?
Within a certain range of rank values, decreasing the rank only slightly affects the convergence rate, causing a slowdown with a nearly linear trend. As shown in Figure 5 (right), training with a rank of 128 using 80K steps achieves a lower loss than training with a rank of 512 using 20K steps. This shows that GaLore can be used to trade-off between memory and computational cost. In a memory-constrained scenario, reducing the rank allows us to stay within the memory budget while training for more steps to preserve the performance.
Section Summary: GaLore is a new method for training and fine-tuning large language models that cuts memory use in key parts of the process by as much as 65 percent while keeping performance and speed intact. The authors also outline several directions for future work, including testing the approach on other model types and making it even more efficient for everyday hardware. They hope the technique will open up advanced model training to more researchers using standard consumer equipment.
We propose GaLore, a memory-efficient pre-training and fine-tuning strategy for large language models. GaLore significantly reduces memory usage by up to 65.5% in optimizer states while maintaining both efficiency and performance for large-scale LLM pre-training and fine-tuning.
We identify several open problems for GaLore, which include (1) applying GaLore on training of various models such as vision transformers ([47]) and diffusion models ([48]), (2) further enhancing memory efficiency by employing low-memory projection matrices, and (3) exploring the feasibility of elastic data distributed training on low-bandwidth consumer-grade hardware.
We hope that our work will inspire future research on memory-efficient training from the perspective of gradient low-rank projection. We believe that GaLore will be a valuable tool for the community, enabling the training of large-scale models on consumer-grade hardware with limited resources.
Section Summary: The paper focuses on making the training of large AI language models more efficient in terms of computer memory use. This change would let researchers work with bigger models even on less powerful machines, which in turn lowers electricity needs and cuts carbon emissions tied to model development. The overall aim is to reduce the environmental costs of building and refining these AI systems.
This paper aims to improve the memory efficiency of training LLMs in order to reduce the environmental impact of LLM pre-training and fine-tuning. By enabling the training of larger models on hardware with lower memory, our approach helps to minimize energy consumption and carbon footprint associated with training LLMs.
Section Summary: The authors thank Meta AI for providing computing resources and several individual researchers for helpful discussions and comments on their work. They also recognize financial support for specific team members from Moffett AI, multiple grants from the National Science Foundation, and programs funded by the Bren Foundation and Schmidt Sciences.
We thank Meta AI for computational support. We appreciate the helpful feedback and discussion from Florian Schäfer, Jeremy Bernstein, and Vladislav Lialin. B. Chen greatly appreciates the support by Moffett AI. Z. Wang is in part supported by NSF Awards 2145346 (CAREER), 02133861 (DMS), 2113904 (CCSS), and the NSF AI Institute for Foundations of Machine Learning (IFML). A. Anandkumar is supported by the Bren Foundation and the Schmidt Sciences through AI 2050 senior fellow program.
Section Summary: The appendix first reviews related memory-saving optimizers such as Adafactor, LOMO, and AdaLOMO, noting how GaLore’s low-rank gradient approach complements them and could extend to stable large-scale pre-training. It then supplies formal proofs establishing that many common layers are reversible, derives the resulting gradient structure for chained reversible networks, and presents a parallel lemma on the gradient of softmax loss under small-logit conditions. These results support the reversibility claims used in the main paper.
Adafactor ([33]) achieves sub-linear memory cost by factorizing the second-order statistics by a row-column outer product. GaLore shares similarities with Adafactor in terms of utilizing low-rank factorization to reduce memory cost, but GaLore focuses on the low-rank structure of the gradients, while Adafactor focuses on the low-rank structure of the second-order statistics.
GaLore can reduce the memory cost for both first-order and second-order statistics, and can be combined with Adafactor to achieve further memory reduction. In contrast to the previous memory-efficient optimization methods, GaLore operates independently as the optimizers directly receive the low-rank gradients without knowing their full-rank counterparts.
The fused backward operation proposed by LOMO ([38]) mitigates the memory cost of storing weight gradients during training. Integrated with the standard SGD optimizer, LOMO achieves zero optimizer and gradient memory cost during training. AdaLOMO ([37]) enhances this approach by combining the fused backward operation with adaptive learning rate for each parameter, similarly achieving minimal optimizer memory cost.
While LOMO and AdaLOMO represent significant advancements in memory-efficient optimization for fine-tuning or continual pre-training, they might not be directly applicable to pre-training from scratch at larger scales. For example, the vanilla Adafactor, adopted by AdaLOMO, has been demonstrated to lead to increased training instabilities at larger scales ([49, 3, 50, 51]). We believe integrating GaLore with the fused backward operation may offer a promising avenue for achieving memory-efficient large-scale pre-training from scratch.
########## {caption="Definition: Reversiblity [39]"}
A network $\mathcal{N}$ that maps input ${\bm{x}}$ to output ${\bm{y}} = \mathcal{N}({\bm{x}})$ is reversible, if there exists $L({\bm{x}}; W)$ so that ${\bm{y}}= L({\bm{x}}; W){\bm{x}}$, and the backpropagated gradient ${\bm{g}}{\bm{x}}$ satisfies ${\bm{g}}{\bm{x}} = L^\top({\bm{x}}; W) {\bm{g}}{\bm{y}}$, where ${\bm{g}}{\bm{y}}$ is the backpropagated gradient at the output ${\bm{y}}$. Here $L({\bm{x}};W)$ depends on the input ${\bm{x}}$ and weight $W$ in the network $\mathcal{N}$.
Note that many layers are reversible, including linear layer (without bias), reversible activations (e.g., ReLU, leaky ReLU, polynomials, etc). Furthermore, they can be combined to construct more complicated architectures:
########## {caption="Property"}
If $\mathcal{N}_1$ and $\mathcal{N}_2$ are reversible networks, then (Parallel) ${\bm{y}} = \alpha_1 \mathcal{N}_1({\bm{x}}) + \alpha_2 \mathcal{N}_2({\bm{x}})$ is reversible for constants $\alpha_1$ and $\alpha_2$, and (Composition) ${\bm{y}} = \mathcal{N}_2(\mathcal{N}_1({\bm{x}}))$ is reversible.
From this property, it is clear that ResNet architecture ${\bm{x}} + \mathcal{N}({\bm{x}})$ is reversible, if $\mathcal{N}$ contains bias-free linear layers and reversible activations, which is often the case in practice. For a detailed analysis, please check Appendix A in [39]. For architectures like self-attention, one possibility is to leverage JoMA [40] to analyze, and we leave for future work.
The gradient of chained reversible networks has the following structure:
Proof: Note that for layered reversible network, we have
$ \mathcal{N}({\bm{x}}) = \mathcal{N}L(\mathcal{N}{L-1}(... \mathcal{N}1({\bm{x}}))) = K_L({\bm{x}})K{L-1}({\bm{x}})\ldots K_1({\bm{x}}){\bm{x}}\tag{12} $
Let ${\bm{f}}l := \mathcal{N}l(\mathcal{N}{l-1}(\ldots \mathcal{N}1({\bm{x}})))$ and $J_l := K_L({\bm{x}})\ldots K{l+1}({\bm{x}})$, and for linear layer $l$, we can write $\mathcal{N}({\bm{x}}) = J_lW_l {\bm{f}}{l-1}$. Therefore, for the linear layer $l$ with weight matrix $W_l$, we have:
$ \begin{aligned} \mathrm{d} \varphi &=& ({\bm{y}} - \mathcal{N}({\bm{x}}))^\top \mathrm{d} \mathcal{N}({\bm{x}}) \ &=& ({\bm{y}} - \mathcal{N}({\bm{x}}))^\top K_L({\bm{x}})\ldots K_{l+1}({\bm{x}}) \mathrm{d} W_l {\bm{f}}{l-1} \ \ +\ \ \mathrm{terms\ not\ related\ to\ }\mathrm{d} W_l \ &=& ({\bm{y}} - J_lW_l {\bm{f}}{l-1})^\top J_l \mathrm{d} W_l {\bm{f}}{l-1} \ &=& \mathrm{tr}(\mathrm{d} W_l^\top J_l^\top ({\bm{y}}-J_lW_l {\bm{f}}{l-1}){\bm{f}}^\top_{l-1}) \end{aligned} $
This gives the gradient of $W_l$:
$ G_l = J_l^\top {\bm{y}} {\bm{f}}^\top_{l-1} - J_l^\top J_l W_l {\bm{f}}{l-1}{\bm{f}}^\top{l-1}\tag{13} $
Softmax Case. Note that for softmax objective with small logits, we can also prove a similar structure of backpropagated gradient, and thus Theorem 1 can also apply.
########## {caption="Lemma 6: Gradient structure of softmax loss"}
For $K$-way logsoftmax loss $\varphi({\bm{y}}; {\bm{f}}) := -\log \left(\frac{\exp({\bm{y}}^\top {\bm{f}})}{{\bm{1}}^\top \exp({\bm{f}})}\right)$, let $\hat {\bm{f}} = P^\perp_{\bm{1}} {\bm{f}}$ be the zero-mean version of network output ${\bm{f}}$, where $P^\perp_{\bm{1}} := I - \frac{1}{K}{\bm{1}} {\bm{1}}^\top$, then we have:
$ -\mathrm{d} \varphi = {\bm{y}}^\top \mathrm{d}\hat {\bm{f}} - \gamma \hat {\bm{f}}^\top \mathrm{d}\hat {\bm{f}}/K + O(\hat {\bm{f}}^2/K)\mathrm{d}\hat {\bm{f}}\tag{14} $
where $\gamma({\bm{y}}, {\bm{f}}) \approx 1$ and ${\bm{y}}$ is a data label with ${\bm{y}}^\top {\bm{1}} = 1$.
Proof: Let $\hat {\bm{f}} := P^\perp_{\bm{1}} {\bm{f}}$ be the zero-mean version of network output ${\bm{f}}$. Then we have ${\bm{1}}^\top\hat {\bm{f}} = 0$ and ${\bm{f}} = \hat {\bm{f}} + c {\bm{1}}$. Therefore, we have:
$ -\varphi = \log \left(\frac{\exp(c)\exp({\bm{y}}^\top \hat {\bm{f}})}{\exp(c){\bm{1}}^\top \exp(\hat {\bm{f}})}\right) = {\bm{y}}^\top\hat {\bm{f}} - \log({\bm{1}}^\top \exp(\hat {\bm{f}}))\tag{15} $
Using the Taylor expansion $\exp(x) = 1 + x + \frac{x^2}{2} + o(x^2)$, we have:
$ {\bm{1}}^\top \exp(\hat {\bm{f}}) = {\bm{1}}^\top({\bm{1}} + \hat {\bm{f}} + \frac12\hat {\bm{f}}^2) + o(\hat {\bm{f}}^2) = K (1 + \hat {\bm{f}}^\top\hat {\bm{f}}/2K + o(\hat {\bm{f}}^2/K))\tag{16} $
So
$ -\varphi = {\bm{y}}^\top\hat {\bm{f}} - \log(1 + \hat {\bm{f}}^\top\hat {\bm{f}}/2K + o(\hat {\bm{f}}^2/K)) - \log K\tag{17} $
Therefore
$ -\mathrm{d} \varphi = {\bm{y}}^\top \mathrm{d} \hat {\bm{f}} - \frac{\gamma}{K} \hat {\bm{f}}^\top \mathrm{d}\hat {\bm{f}} + O\left(\frac{\hat {\bm{f}}^2}{K}\right)\mathrm{d}\hat {\bm{f}}\tag{18} $
where $\gamma := (1 + \hat {\bm{f}}^\top\hat {\bm{f}}/2K + o(\hat {\bm{f}}^2/K))^{-1} \approx 1$.
Remarks. With this lemma, it is clear that for a reversible network ${\bm{f}} := \mathcal{N}({\bm{x}}) = J_l({\bm{x}}) W_l {\bm{f}}_{l-1}({\bm{x}})$, the gradient $G_l$ of $W_l$ has the following form:
$ G_l = \underbrace{J_lP^\perp_{\bm{1}} {\bm{y}} {\bm{f}}{l-1}}A - \underbrace{\gamma J_l^\top P^\perp{\bm{1}} J_l}B W_l \underbrace{{\bm{f}}{l-1}{\bm{f}}{l-1}^\top / K}_C\tag{19} $
Proof: We have
$ G_t = \frac{1}{N}\sum_{i=1}^N (A_i - B_i W_t C_i) = \frac{1}{N}\sum_{i=1}^N A_i - B_i(W_{t-1} + \eta G_{t-1})C_i = G_{t-1} - \frac{\eta}{N}\sum_{i=1}^N B_i G_{t-1} C_i\tag{20} $
Let $S := \frac{1}{N}\sum_{i=1}^N C_i\otimes B_i$, and $g_t := \mathrm{vec}(G_t) \in {\textnormal{r}}^{mn}$ be a vectorized version of the gradient $G_t\in {\textnormal{r}}^{m\times n}$. Using $\mathrm{vec}(BWC) = (C^\top \otimes B) \mathrm{vec}(W)$, we have:
$ g_t = (I - \eta S) g_{t-1}\tag{21} $
Now let's bound the stable rank of $G_t$:
$ \text{stable-rank}(G_t) := \frac{|G_t|_F^2}{|G_t|^2_2}\tag{22} $
Now $\lambda_1 < \lambda_2$ are the smallest two distinct eigenvectors of $S$. The smallest eigenvalue $\lambda_1$ has multiplicity $\kappa_1$. We can decompose $g_0$ into two components, $g_0 = g^{\parallel}_0 + g^\perp_0$, in which $g^{\parallel}_0$ lies in the $\kappa_1$-dimensional eigenspace $\mathcal{V}_1$ that corresponds to the minimal eigenvalue $\lambda_1$, and $g^\perp_0$ is its residue. Then $\mathcal{V}_1 \subset {\textnormal{r}}^{mn}$ and its orthogonal complements are invariant subspaces under $S$ and thus:
$ \begin{aligned} |G_t|F^2 &=& |g_t|2^2 = |(I - \eta S)^t g{0}|^2_2 = |(I - \eta S)^t g^{\parallel}{0}|^2_2 + |(I - \eta S)^t g^{\perp}_{0}|^2_2 \ &\le& (1 - \eta \lambda_2)^{2t} |g^\perp_0|_2^2 + (1 - \eta \lambda_1)^{2t} |g^\parallel_0|_2^2 \end{aligned} $
On the other hand, by our assumption, $G^\parallel_0$ is rank $L$ and thus has SVD decomposition:
$ G^\parallel_0 = \sum_{l=1}^L c_l {\bm{z}}_l {\bm{y}}_l^\top\tag{23} $
with orthonormal unit vectors ${{\bm{z}}l}{l=1}^L$ and ${{\bm{y}}l}{l=1}^L$ and singular values ${c_l}_{l=1}^L1$. This means that
$ g^\parallel_0 = \mathrm{vec}(G^\parallel_0) = \sum_{l=1}^L c_l ({\bm{y}}_l \otimes {\bm{z}}l) =: \sum{l=1}^L c_l {\bm{v}}_l\tag{24} $
with unit vector ${\bm{v}}_l := {\bm{y}}_l \otimes {\bm{z}}_l \in \mathcal{V}_1$. It is clear that
$ {\bm{v}}^\top_l {\bm{v}}{l'} = ({\bm{y}}^\top_l \otimes {\bm{z}}^\top_l)({\bm{y}}{l'} \otimes {\bm{z}}{l'}) = ({\bm{y}}^\top_l {\bm{y}}{l'})({\bm{z}}^\top_l {\bm{z}}_{l'}) = \mathbb{I}(l=l')\tag{25} $
Therefore, by the definition of spectral norm (or matrix 2-norm), we know it corresponds to the largest singular value, which means:
$ \begin{aligned} |G_t|2 &=& \max{| {\bm{y}}'|_2=1, | {\bm{z}}'|_2=1} {\bm{z}}^{'\top} G_t {\bm{y}}' \ &\ge& \max_l {\bm{z}}_l^\top G_t {\bm{y}}_l = \max_l ({\bm{y}}_l\otimes {\bm{z}}_l)^\top g_t \ &=& \max_l {\bm{v}}_l^\top (1 - \eta S)^t g_0 = (1 - \eta \lambda_1)^t \max_l {\bm{v}}_l^\top g_0 \end{aligned} $
Note that the last equation is because any ${\bm{v}}\in \mathcal{V}_1$ is an eigenvector of $S$ with eigenvalue of $\lambda_1$.
Since ${\bm{v}}_l^\top g_0 = {\bm{v}}_l^\top (g^\perp_0 + g^\parallel_0) = c_l$, $\max_l c_l = |G^\parallel_0|_2$ and $|g^\parallel_0|_2^2 = |G^\parallel_0|_F^2$, we have:
$ \text{stable-rank}(G_t) := \frac{|G_t|_F^2}{|G_t|^2_2} \le \text{stable-rank}(G^\parallel_0) + \left(\frac{1-\eta \lambda_2}{1-\eta \lambda_1}\right)^{2t} \frac{|G^\perp_0|_F^2}{|G_0^\parallel|_2^2}\tag{26} $
Proof: Let $C_i = {\bm{f}}_i {\bm{f}}_i^\top \in {\textnormal{r}}^{n\times n}$. Since $N' := \mathrm{rank}({{\bm{f}}i}{i=1}^N) < n$ and $f_i \in {\textnormal{r}}^n$, the collections of vectors ${{\bm{f}}i}{i=1}^N$ cannot span the entire space ${\textnormal{r}}^n$. Let ${{\bm{u}}j}{j=1}^{n-N'}$ be the orthonormal bases for the null space of ${{\bm{f}}i}{i=1}^N$, and ${{\bm{e}}k}{k=1}^m$ be any orthonormal bases for ${\textnormal{r}}^m$. Then the product bases ${{\bm{u}}_j\otimes {\bm{e}}_k}$ form a set of bases for the minimal eigenspace $\mathcal{V}_1$ of $S$ with the minimal eigenvalue of $0$. Since $B_i$ are full-rank, no extra dimensions exist for $\mathcal{V}_1$.
Therefore, when we project $G_{t_0}$ onto $\mathcal{V}_1$, we have:
$ G_{t_0}^\parallel = \sum_{j=1}^{n-N'}\sum_{k=1}^m c_{jk} {\bm{u}}j {\bm{e}}^\top_k = \sum{j=1}^{n-N'} {\bm{u}}j \left(\sum{k=1}^m c_{jk} {\bm{e}}_k\right)^\top\tag{27} $
and thus $\mathrm{sr}(G_{t_0}^\parallel) \le \mathrm{rank}(G_{t_0}^\parallel) \le n - N'$, since stable rank is a lower-bound of the rank.
On the other hand, $G_t$ can be written as a summation of $N'$ rank-1 matrices, by representing each ${\bm{f}}i = \sum{j=1}^{N'} b_{ij} {\bm{f}}'_j$ as a linear combination of ${{\bm{f}}'j}{j=1}^{N'}$:
$ G_t = \frac1N \sum_{i=1}^N ({\bm{a}}i - B_i W_t {\bm{f}}i)\left(\sum{j=1}^{N'} b{ij} {\bm{f}}'j\right)^\top = \frac1N \sum{j=1}^{N'} \left[\sum_{i=1}^N b_{ij} ({\bm{a}}_i - B_i W_t {\bm{f}}_i)\right] {\bm{f}}^{'\top}_j\tag{28} $
and thus has rank at most $N'$. Therefore, when $t$ is sufficiently large so that the second term in Equation 26 is negligible, by Lemma 2, we have (notice that $N' < n$):
$ \mathrm{sr}(G_t) \le \min(n - N', N') \le n / 2\tag{29} $
Proof: In this case, we have $g^\parallel_0 = {\bm{v}} {\bm{v}}^\top g_0 \propto {\bm{v}}$. Since ${\bm{v}} = {\bm{y}} \otimes {\bm{z}}$, the resulting $G^\parallel_0$ is a rank-1 matrix and thus $\mathrm{sr}(G_{t_0}^\parallel) = 1$.
Note that Transformers do not belong to the family of reversible networks. However, we can still show that the gradient of the lower layer (i.e., project-up) weight $W \in {\textnormal{r}}^{m\times n}$ of feed forward network (FFN) becomes low rank over time, using the JoMA framework [40]. Here $m$ is the embedding dimension, and $n$ is the number of hidden nodes in FFNs.
########## {caption="Lemma 7: Gradient of Project-up in Transformer FFNs"}
Suppose the embedding matrix $U \in {\textnormal{r}}^{m \times M}$ is fixed and column-orthonormal ($M$ is vocabulary size), the activation functions are linear and the backpropagated gradient are stationary [40], then the training dynamics of transformed project-up matrix $V := U^\top W \in {\textnormal{r}}^{M\times n}$ satisfies the following:
$ \dot{V} = \frac{1}{A} \operatorname{diag}\left(\exp\left(\frac{V \circ V}{2}\right){\bm{1}} \right)\Delta\tag{30} $
where $A$ is the normalization factor of softmax, $\circ$ is the Hadamard (element-wise) product and $\Delta$ is defined in the proof. As a result, the gradient of $V$ is "exponentially more low-rank" than $V$ itself.
Proof: Let $\Delta := [\boldsymbol{\Delta}_1, \ldots, \boldsymbol{\Delta}_n] \in {\textnormal{r}}^{M \times n}$, where $\boldsymbol{\Delta}j := \mathbb{E}{q}[g_j {\bm{x}}] \in {\textnormal{r}}^{M}$. Here $g_j$ is the backpropagated gradient of hidden node $j$ in FFN layer, $\mathbb{E}_q[\cdot]$ is the conditional expectation given the query is token $q$, and ${\bm{x}}$ is the representation of token distribution in the previous layer of Transformer. Specifically, for intermediate layer, ${\bm{x}}$ represents the activation output of the previous project-up layer; for the first layer, ${\bm{x}}$ represents the frequency count of the input tokens. Then following the derivation of Theorem 2 [40], we have for each hidden node $j$ and its weight ${\bm{w}}_j$, the transformed weight ${\bm{v}}_j := U^\top {\bm{w}}_j$ satisfies the following dynamics:
$ \dot {\bm{v}}_j = \frac{1}{A} \boldsymbol{\Delta}_j \circ \exp({\bm{v}}_j ^2 / 2)\tag{31} $
where ${\bm{v}}^2_j := {\bm{v}}_j \circ {\bm{v}}_j$ is the element-wise square of a vector and $\circ$ is the Hadamard (element-wise) product. Since $V := [{\bm{v}}_1, \ldots, {\bm{v}}_n]$, Equation 30 follows.
Note that the dynamics of ${\bm{v}}_j$ shows that the direction of ${\bm{v}}_j$ will change over time (because of $\exp({\bm{v}}_j^2/2)$), and it is not clear how such dynamics leads to low-rank $V$ and even more low-rank $\dot{V}$. For this, we per-row decompose the matrix $V$:
$ V := \left[\begin{array}{c} {\bm{u}}_1^\top \ {\bm{u}}_2^\top \ \ldots \ {\bm{u}}_M^\top \end{array}\right]\tag{32} $
where ${\bm{u}}_l \in {\textnormal{r}}^n$. We can also do the same for $\Delta$:
$
\Delta := \left[\begin{array}{c}
{\bm{\mu}}_1^\top \
{\bm{\mu}}_2^\top \
\ldots \
{\bm{\mu}}_M^\top
\end{array}
\right]\tag{33}
$
where ${\bm{\mu}}_l \in {\textnormal{r}}^n$. Then Equation 30 can be decomposed along each row:
$ \dot {\bm{u}}_l = \frac{1}{A} (e^{{\bm{u}}^2_l} \cdot {\bm{1}}){\bm{\mu}}_l\tag{34} $
Then it is clear that ${\bm{u}}_l$ is always along the direction of ${\bm{\mu}}_l$, which is a fixed quality since the backpropagated gradient $g_j$ and input ${\bm{x}}$ are assumed to be stationary (and thus $\boldsymbol{\Delta}_j := \mathbb{E}_q[g_j {\bm{x}}]$ is a constant).
Therefore, let ${\bm{u}}_l(t) = \alpha_l(t) {\bm{\mu}}_l$ with initial condition of the magnitude $\alpha_l(0) = 0$, and we have:
$ \dot{\alpha}l = \frac{1}{A} e^{\alpha_l^2 {\bm{\mu}}l^2}\cdot {\bm{1}} = \frac{1}{A} \sum{j=1}^n e^{\alpha_l^2 \mu^2{lj}}\tag{35} $
where $1\le l\le M$ is the token index. In the following we will show that for different $l$, the growth of $\alpha_l$ can be very different. This leads to very different row norms of $V$ and $\dot{V}$ over time, leading to their low-rank structures. Note that Equation 35 does not have a close form solution, instead we could estimate its growth:
$ \frac{1}{A} e^{\alpha_l^2 \bar\mu^2_l} \le \dot{\alpha}_l \le \frac{n}{A} e^{\alpha_l^2 \bar\mu^2_l}\tag{36} $
where $\bar\mu^2_l := \max_j \mu^2_{lj}$.
Note that both sides have analytic solutions using Gaussian error functions $\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\mathrm{d} t \in [-1, 1]$. Specifically, for dynamic system like $\dot{x} = C e^{\beta^2 x^2}$, we have
$ e^{-\beta^2 x^2} \mathrm{d} x = C \mathrm{d} t\tag{37} $
which gives:
$ \frac{\sqrt{\pi}}{2\beta} \mathrm{erf}\left(\beta x(t)\right) = \int_0^{x(t)} e^{-\beta^2 y^2} \mathrm{d} y = C t\tag{38} $
or
$ x(t) = \frac{1}{\beta} \mathrm{erf}^{-1}\left(\frac{2\beta C}{\sqrt{\pi}}t\right)\tag{39} $
For inequality like $\dot{x} \ge C e^{\beta^2 x^2}$ or $\dot{x} \le C e^{\beta^2 x^2}$, similar equation can be derived. Plug that in, we have:
$ \frac{1}{\bar\mu_l} \mathrm{erf}^{-1}\left(\frac{2\bar\mu_l}{A\sqrt{\pi}}t \right) \le \alpha_l(t) \le \frac{1}{\bar\mu_l} \mathrm{erf}^{-1}\left(\frac{2n\bar\mu_l}{A\sqrt{\pi}}t \right)\tag{40} $
Let
$ h(t;a) := \frac{1}{a}\mathrm{erf}^{-1}\left(\frac{2}{\sqrt{\pi}}\frac{a}{A}t\right)\tag{41} $
then $\lim_{t\rightarrow A \sqrt{\pi} / 2a } h(t;a) = +\infty$, and $h(t;\bar\mu_l) \le \alpha_l(t) \le n h(t; n \bar\mu_l)$.
Let $l^* = \arg\max_l \bar\mu_l^*$ be the row with the largest entry of $\mu$, then if $\bar\mu_l^* > n\bar\mu_l$ for all $l\neq l^*$, then when $t \rightarrow t^* := \frac{A\sqrt{\pi}}{2\bar\mu_l^*}$, the magnitude $\alpha_{l^*}(t) \ge h(t;\bar\mu_{l^*}) \rightarrow +\infty$, while $\alpha_l(t) \le n h (t; n\bar\mu_l)$ still stay finite, since its critical time $t' := \frac{A\sqrt{\pi}}{2n\bar\mu_l} > t^*$. Since $\alpha_l(t)$ controls the magnitude of each row of $V$, This means that $V$ eventually becomes rank-1 and so does $W$.
Finally, $\dot{V}$ is even more low rank than $V$, since $\dot{\alpha}_l$ has $\alpha_l$ in its exponents.
Proof: Using $\mathrm{vec}(AXB) = (B^\top \otimes A)\mathrm{vec}(X)$ where $\otimes$ is the Kronecker product, the gradient assumption can be written as the following:
$ g_t = a_t - S_t w_t\tag{42} $
where $g_t := \mathrm{vec}(G_t) \in {\textnormal{r}}^{mn}$, $w_t := \mathrm{vec}(W_t) \in {\textnormal{r}}^{mn}$ be the vectorized versions of $G_t$ and $W_t$, $a_t := \frac1N\sum_i \mathrm{vec}(A_{it})$ and $S_t = \frac1N\sum_i C_{it} \otimes B_{it}$ are $mn$-by- $mn$ PSD matrix.
Using the same notation, it is clear to show that:
$ \begin{aligned} (Q\otimes P)^\top g_t &=& (Q^\top \otimes P^\top) \mathrm{vec}(G_t) = \mathrm{vec}(P^\top G_t Q) = \mathrm{vec}(R_t) =: r_t \ \tilde{g}_t := \mathrm{vec}(\tilde{G}t) &=& \mathrm{vec}(PP^\top G_t QQ^\top) = (Q\otimes P)\mathrm{vec}(R_t) = (Q\otimes P)r{t} \end{aligned} $
Then we derive the recursive update rule for $g_t$:
$ \begin{aligned} g_t &=& a_t - S_t w_t \ &=& (a_t - a_{t-1}) + (S_{t-1} - S_t) w_t + a_{t-1} - S_{t-1}w_t \ &=& e_t + a_{t-1} - S_{t-1}(w_{t-1} + \eta \tilde{g}{t-1}) \ &=& e_t + g{t-1} - \eta S_{t-1} \tilde{g}_{t-1} \end{aligned} $
where $e_t := (a_t - a_{t-1}) + (S_{t-1} - S_t) w_t$. Left multiplying by $(Q\otimes P)^\top$, we have:
$ r_t = (Q\otimes P)^\top e_t + r_{t-1} - \eta (Q\otimes P)^\top S_{t-1} (Q\otimes P)r_{t-1} $
Let
$ \hat{S}t := (Q\otimes P)^\top S_t (Q\otimes P) = \frac1N \sum_i (Q\otimes P)^\top (C{it} \otimes B_{it}) (Q\otimes P) = \frac1N \sum_i (Q^\top C_{it}Q) \otimes (P^\top B_{it} P)\tag{43} $
Then we have:
$ r_t = (I - \eta \hat{S}{t-1})r{t-1} + (Q\otimes P)^\top e_t\tag{44} $
Now we bound the norm. Note that since $P$ and $Q$ are projection matrices with $P^\top P = I$ and $Q^\top Q = I$, we have:
$ |(Q\otimes P)^\top e_t|_2 = | \mathrm{vec}(P^\top E_t Q)|_2 = |P^\top E_t Q|_F \le |E_t|_F\tag{45} $
where $E_t := \frac1N\sum_i (A_{it} - A_{i, t-1}) + \frac1N\sum_i (B_{i, t-1} W_t C_{i, t-1} - B_{it} W_t C_{it})$. So we only need to bound $|E_t|_F$. Note that:
$ \begin{aligned} |A_t - A_{t-1}|F &\le& L_A |W_t - W{t-1}|F = \eta L_A |\tilde{G}{t-1}|F \le \eta L_A |R{t-1}|F \ |(B_t - B{t-1})W_t C_{t-1}|F &\le& L_B |W_t - W{t-1}|_F |W_t|F |C{t-1}|F = \eta L_B L_C D^2 |R{t-1}|F \ |B_t W_t (C{t-1} - C_t)|_F &\le& L_C |B_t|_F |W_t|F|W{t-1} - W_t|F = \eta L_B L_C D^2 |R{t-1}|_F \end{aligned} $
Now we estimate the minimal eigenvalue of $\hat{S}{t-1}$. Let $\underline{\lambda}{it} := \lambda_{\min}(P^\top B_{it} P)$ and $\underline{\nu}{it} := \lambda{\min}(Q^\top C_{it} Q)$, then $\lambda_{\min}((P^\top B_{it} P) \otimes (Q^\top C_{it} Q)) = \underline{\lambda}{it}\underline{\nu}{it}$ and for any unit vector ${\bm{v}}$:
$ {\bm{v}}^\top \hat{S}t {\bm{v}} = \frac1N \sum_i {\bm{v}}^\top \left[(P^\top B{it} P) \otimes (Q^\top C_{it} Q)\right]{\bm{v}} \ge \frac1N \sum_i \underline{\lambda}{it}\underline{\nu}{it}\tag{46} $
And thus $\lambda_{\min}(\hat{S}t) \ge \frac1N \sum_i \underline{\lambda}{it}\underline{\nu}{it}$. Therefore, $\lambda{\max}(I - \eta \hat{S}{t-1}) \le 1 - \frac{\eta}{N} \sum_i \underline{\lambda}{i, t-1}\underline{\nu}{i, t-1}$. Therefore, let $\kappa_t := \frac1N \sum_i \underline{\lambda}{it}\underline{\nu}_{it}$ and using the fact that $|r_t|_2 = |R_t|_F$, we have:
$ |R_t|F\le \left[1 - \eta (\kappa{t-1} - L_A - 2L_BL_C D^2)\right] |R_{t-1}|_F\tag{47} $
and the conclusion follows.
We introduce details of the LLaMA architecture and hyperparameters used for pre-training. Table 5 shows the most hyperparameters of LLaMA models across model sizes. We use a max sequence length of 256 for all models, with a batch size of 131K tokens. For all experiments, we adopt learning rate warmup for the first 10% of the training steps, and use cosine annealing for the learning rate schedule, decaying to 10% of the initial learning rate.
\begin{tabular}{cccccccc}
\toprule
Params & Hidden & Intermediate & Heads & Layers & Steps & Data amount \\
\midrule
60M & 512 & 1376 & 8 & 8 & 10K & $1.3 \mathrm{~B}$ \\
130M & 768 & 2048 & 12 & 12 & 20K & $2.6 \mathrm{~B}$ \\
350M & 1024 & 2736 & 16 & 24 & 60K & $7.8 \mathrm{~B}$ \\
$1 \mathrm{~B}$ & 2048 & 5461 & 24 & 32 & 100K & $13.1 \mathrm{~B}$ \\
$7 \mathrm{~B}$ & 4096 & 11008 & 32 & 32 & 150K & $19.7 \mathrm{~B}$ \\
\bottomrule
\end{tabular}
For all methods on each size of models (from 60M to 1B), we tune their favorite learning rate from a set of ${0.01, 0.005, 0.001, 0.0005, 0.0001}$, and the best learning rate is chosen based on the validation perplexity. We find GaLore is insensitive to hyperparameters and tends to be stable with the same learning rate across different model sizes. For all models, GaLore use the same hyperparameters, including the learning rate of $0.01$, scale factor $\alpha$ of $0.25$, and the subspace change frequency of $T$ of $200$. We note that since $\alpha$ can be viewed as a fractional learning rate, most of the modules (e.g., multi-head attention and feed-forward layers) in LLaMA models have the actual learning rate of $0.0025$. This is, still, a relatively large stable learning rate compared to the full-rank baseline, which usually uses a learning rate $\leq 0.001$ to avoid spikes in the training loss.
As the GPU memory usage for a specific component is hard to measure directly, we estimate the memory usage of the weight parameters and optimizer states for each method on different model sizes. The estimation is based on the number of original parameters and the number of low-rank parameters, trained by BF16 format. For example, for a 60M model, LoRA ($r=128$) requires $42.7$ M parameters on low-rank adaptors and $60M$ parameters on the original weights, resulting in a memory cost of $0.20$ G for weight parameters and $0.17$ G for optimizer states. Table 6 shows the memory estimates for weight parameters and optimizer states for different methods on different model sizes, as a compliment to the total memory reported in the main text.
::: caption="Table 6: Memory estimates for weight parameters and optimizer states."

:::
We show the training progression of 130M, 350M, 1B and 7B models in Figure 6. Compared to LoRA, GaLore closely matches the training trajectory of the full-rank baseline, and it even converges slightly faster at the beginning of the training.

We fine-tune the pre-trained RoBERTa-Base model on the GLUE benchmark using the model provided by the Hugging Face^1. We trained the model for 30 epochs with a batch size of 16 for all tasks except for CoLA, which uses a batch size of 32. We tune the learning rate and scale factor for GaLore. Table 7 shows the hyperparameters used for fine-tuning RoBERTa-Base for GaLore.
::: caption="Table 7: Hyperparameters of fine-tuning RoBERTa base for GaLore."

:::
We evaluate GaLore on the SQuAD dataset ([52]) using the pre-trained BERT-Base model. We use rank $16$ for both GaLore and LoRA. GaLore outperforms LoRA in both Exact Match and F1 scores.
\begin{tabular}{ccc}
\toprule
& \textbf{Exact Match} & \textbf{F1} \\
\midrule
Baseline & 80.83 & 88.41 \\
\midrule
\textbf{GaLore} & \textbf{80.52} & \textbf{88.29} \\
LoRA & 77.99 & 86.11 \\
\bottomrule
\end{tabular}
We apply GaLore on fine-tuning experiments on the OpenAssistant Conversations dataset ([53]), using the pre-trained models, including Gemma-2b, Phi-2, and LLaMA-7B ([2, 54]). We use rank of 128 for both GaLore and LoRA. The results are shown in Table 9.
\begin{tabular}{cccc}
\toprule
& \textbf{Gemma-2b} & \textbf{Phi-2} & \textbf{LLaMA-7B} \\
\midrule
Baseline & 4.53 & 3.81 & 2.98 \\
\midrule
\textbf{GaLore} & \textbf{4.51} & \textbf{3.83} & 2.95 \\
LoRA & 4.56 & 4.24 & \textbf{2.94} \\
\bottomrule
\end{tabular}
We also apply GaLore on fine-tuning experiments on the Belle-1M dataset ([55]), using the pre-trained models, including Gemma-2b, Phi-2, and LLaMA-7B. We use rank of 128 for both GaLore and LoRA. The results are shown in Table 10.
\begin{tabular}{cccc}
\toprule
& \textbf{Gemma-2b} & \textbf{Phi-2} & \textbf{LLaMA-7B} \\
\midrule
Baseline & 5.44 & 2.66 & 2.27 \\
\midrule
\textbf{GaLore} & \textbf{5.35} & \textbf{2.62} & \textbf{2.28} \\
LoRA & 5.37 & 2.75 & 2.30 \\
\bottomrule
\end{tabular}
We empirically measure the memory usage of different methods for pre-training LLaMA 1B model on C4 dataset with a token batch size of 256, as shown in Table 11.
\begin{tabular}{c|c|c|c|c|cc} \toprule
\multirow{2}{*}{Model Size} & \multirow{2}{*}{Layer Wise} & \multirow{2}{*}{Methods} & \multirow{2}{*}{Token Batch Size} & \multirow{2}{*}{Memory Cost} & \multicolumn{2}{c}{Throughput} \\
& & & & & #Tokens / s & #Samples / s \\ \hline
\multirow{4}{*}{1B} & \multirow{4}{*}{\ding{56}} & AdamW & 256 & 13.60 & 1256.98 & 6.33 \\
& & Adafactor & 256 & 13.15 & 581.02 & 2.92 \\
& & Adam8bit & 256 & 9.54 & 1569.89 & 7.90 \\
& & 8-bit GaLore & 256 & 7.95 & 1109.38 & 5.59 \\ \midrule
\multirow{5}{*}{1B} & \multirow{5}{*}{\ding{52}} & AdamW & 256 & 9.63 & 1354.37 & 6.81 \\
& & Adafactor & 256 & 10.32 & 613.90 & 3.09 \\
& & Adam8bit & 256 & 6.93 & 1205.31 & 6.07 \\
& & 8-bit GaLore & 256 & 5.63 & 1019.63 & 5.13 \\
\bottomrule
\end{tabular}
Section Summary: This section compiles a numbered bibliography of over thirty academic papers and preprints, mostly from machine-learning venues. The works focus on large language models, memory-saving training techniques, and especially parameter-efficient fine-tuning methods such as low-rank adaptation (LoRA) and its many variants. Earlier references also cover foundational studies of gradient subspaces and optimization in neural networks.
[1] Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P. J. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 2020.
[2] Touvron, H., Martin, L., Stone, K., Albert, P., Almahairi, A., Babaei, Y., Bashlykov, N., Batra, S., Bhargava, P., Bhosale, S., et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
[3] Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research, 2023.
[4] Chen, T., Xu, B., Zhang, C., and Guestrin, C. Training Deep Nets with Sublinear Memory Cost. ArXiv preprint arXiv:1604.06174, 2016.
[5] Rajbhandari, S., Rasley, J., Ruwase, O., and He, Y. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, 2020.
[6] Ding, N., Qin, Y., Yang, G., Wei, F., Yang, Z., Su, Y., Hu, S., Chen, Y., Chan, C.-M., Chen, W., Yi, J., Zhao, W., Wang, X., Liu, Z., Zheng, H.-T., Chen, J., Liu, Y., Tang, J., Li, J., and Sun, M. Delta Tuning: A Comprehensive Study of Parameter Efficient Methods for Pre-trained Language Models. ArXiv preprint arXiv:2203.06904, 2022.
[7] Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., and Chen, W. Lora: Low-rank adaptation of large language models. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
[8] Lialin, V., Muckatira, S., Shivagunde, N., and Rumshisky, A. ReloRA: High-rank training through low-rank updates. In The Twelfth International Conference on Learning Representations, 2024.
[9] Xia, W., Qin, C., and Hazan, E. Chain of LoRA: Efficient Fine-tuning of Language Models via Residual Learning. ArXiv preprint arXiv:2401.04151, 2024.
[10] Renduchintala, A., Konuk, T., and Kuchaiev, O. Tied-Lora: Enhacing parameter efficiency of LoRA with weight tying. ArXiv preprint arXiv:2311.09578, 2023.
[11] Sheng, Y., Cao, S., Li, D., Hooper, C., Lee, N., Yang, S., Chou, C., Zhu, B., Zheng, L., Keutzer, K., Gonzalez, J. E., and Stoica, I. S-LoRA: Serving Thousands of Concurrent LoRA Adapters. ArXiv preprint arXiv:2311.03285, 2023.
[12] Zhang, L., Zhang, L., Shi, S., Chu, X., and Li, B. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. arXiv preprint arXiv:2308.03303, 2023.
[13] Wang, Y., Lin, Y., Zeng, X., and Zhang, G. MultiLoRA: Democratizing LoRA for Better Multi-Task Learning. ArXiv preprint arXiv:2311.11501, 2023b.
[14] Dettmers, T., Pagnoni, A., Holtzman, A., and Zettlemoyer, L. Qlora: Efficient finetuning of quantized llms. Advances in Neural Information Processing Systems, 2024.
[15] Hao, Y., Cao, Y., and Mou, L. Flora: Low-Rank Adapters Are Secretly Gradient Compressors. ArXiv preprint arXiv:2402.03293, 2024.
[16] Kamalakara, S. R., Locatelli, A., Venkitesh, B., Ba, J., Gal, Y., and Gomez, A. N. Exploring Low Rank Training of Deep Neural Networks. ArXiv preprint arXiv:2209.13569, 2022.
[17] Wang, H., Agarwal, S., Tanaka, Y., Xing, E., Papailiopoulos, D., et al. Cuttlefish: Low-rank model training without all the tuning. Proceedings of Machine Learning and Systems, 2023a.
[18] Zhao, J., Zhang, Y., Chen, B., Schäfer, F., and Anandkumar, A. Inrank: Incremental low-rank learning. arXiv preprint arXiv:2306.11250, 2023.
[19] Gur-Ari, G., Roberts, D. A., and Dyer, E. Gradient Descent Happens in a Tiny Subspace. ArXiv preprint arXiv:1812.04754, 2018.
[20] Larsen, B. W., Fort, S., Becker, N., and Ganguli, S. How many degrees of freedom do we need to train deep networks: a loss landscape perspective. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
[21] Lee, Y. and Choi, S. Gradient-based meta-learning with learned layerwise metric and subspace. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018. PMLR, 2018.
[22] Chaudhry, A., Khan, N., Dokania, P., and Torr, P. Continual learning in low-rank orthogonal subspaces. Advances in Neural Information Processing Systems, 2020.
[23] Chen, Y. and Wainwright, M. J. Fast low-rank estimation by projected gradient descent: General statistical and algorithmic guarantees. ArXiv preprint arXiv:1509.03025, 2015.
[24] Chen, H., Raskutti, G., and Yuan, M. Non-Convex Projected Gradient Descent for Generalized Low-Rank Tensor Regression. Journal of Machine Learning Research, 2019.
[25] Zhao, J., Schaefer, F. T., and Anandkumar, A. Zero initialization: Initializing neural networks with only zeros and ones. Transactions on Machine Learning Research, 2022.
[26] Cosson, R., Jadbabaie, A., Makur, A., Reisizadeh, A., and Shah, D. Low-Rank Gradient Descent. IEEE Open Journal of Control Systems, 2023.
[27] Yang, G., Simon, J. B., and Bernstein, J. A spectral condition for feature learning. arXiv preprint arXiv:2310.17813, 2023.
[28] Wang, H., Sievert, S., Liu, S., Charles, Z., Papailiopoulos, D., and Wright, S. Atomo: Communication-efficient learning via atomic sparsification. Advances in neural information processing systems, 31, 2018.
[29] Vogels, T., Karimireddy, S. P., and Jaggi, M. Practical low-rank communication compression in decentralized deep learning. Advances in Neural Information Processing Systems, 2020.
[30] Gooneratne, M., Sim, K. C., Zadrazil, P., Kabel, A., Beaufays, F., and Motta, G. Low-rank gradient approximation for memory-efficient on-device training of deep neural network. In 2020 IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2020, Barcelona, Spain, May 4-8, 2020. IEEE, 2020.
[31] Huang, S., Hoskins, B. D., Daniels, M. W., Stiles, M. D., and Adam, G. C. Low-Rank Gradient Descent for Memory-Efficient Training of Deep In-Memory Arrays. ACM Journal on Emerging Technologies in Computing Systems, 2023.
[32] Modoranu, I.-V., Kalinov, A., Kurtic, E., Frantar, E., and Alistarh, D. Error Feedback Can Accurately Compress Preconditioners. ArXiv preprint arXiv:2306.06098, 2023.
[33] Shazeer, N. and Stern, M. Adafactor: Adaptive learning rates with sublinear memory cost. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018. PMLR, 2018.
[34] Anil, R., Gupta, V., Koren, T., and Singer, Y. Memory efficient adaptive optimization. Advances in Neural Information Processing Systems, 2019.
[35] Dettmers, T., Lewis, M., Shleifer, S., and Zettlemoyer, L. 8-bit optimizers via block-wise quantization. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
[36] Li, B., Chen, J., and Zhu, J. Memory efficient optimizers with 4-bit states. Advances in Neural Information Processing Systems, 2024.
[37] Lv, K., Yan, H., Guo, Q., Lv, H., and Qiu, X. AdaLomo: Low-memory Optimization with Adaptive Learning Rate. ArXiv preprint arXiv:2310.10195, 2023a.
[38] Lv, K., Yang, Y., Liu, T., Gao, Q., Guo, Q., and Qiu, X. Full Parameter Fine-tuning for Large Language Models with Limited Resources. ArXiv preprint arXiv:2306.09782, 2023b.
[39] Tian, Y., Yu, L., Chen, X., and Ganguli, S. Understanding self-supervised learning with dual deep networks. ArXiv preprint arXiv:2010.00578, 2020.
[40] Tian, Y., Wang, Y., Zhang, Z., Chen, B., and Du, S. S. JoMA: Demystifying multilayer transformers via joint dynamics of MLP and attention. In The Twelfth International Conference on Learning Representations, 2024.
[41] Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
[42] Zhang, B. and Sennrich, R. Root mean square layer normalization. Advances in Neural Information Processing Systems, 32, 2019.
[43] Shazeer, N. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
[44] Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
[45] Loshchilov, I. and Hutter, F. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
[46] Lin, H., Zhang, H., Ma, Y., He, T., Zhang, Z., Zha, S., and Li, M. Dynamic mini-batch sgd for elastic distributed training: Learning in the limbo of resources. arXiv preprint arXiv:1904.12043, 2019.
[47] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
[48] Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in neural information processing systems, 2020.
[49] Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., Aslanides, J., Henderson, S., Ring, R., Young, S., et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021.
[50] Wortsman, M., Dettmers, T., Zettlemoyer, L., Morcos, A., Farhadi, A., and Schmidt, L. Stable and low-precision training for large-scale vision-language models. Advances in Neural Information Processing Systems, 2023.
[51] Zhai, X., Kolesnikov, A., Houlsby, N., and Beyer, L. Scaling Vision Transformers. In 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). IEEE, 2022.
[52] Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. SQuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2016.
[53] Köpf, A., Kilcher, Y., von Rütte, D., Anagnostidis, S., Tam, Z. R., Stevens, K., Barhoum, A., Nguyen, D., Stanley, O., Nagyfi, R., et al. Openassistant conversations-democratizing large language model alignment. Advances in Neural Information Processing Systems, 2024.
[54] Team, G., Mesnard, T., Hardin, C., Dadashi, R., Bhupatiraju, S., Pathak, S., Sifre, L., Rivière, M., Kale, M. S., Love, J., et al. Gemma: Open models based on gemini research and technology. arXiv preprint arXiv:2403.08295, 2024.
[55] BELLEGroup. Belle: Be everyone's large language model engine. https://github.com/LianjiaTech/BELLE, 2023.