TL;DR
Training large language models (LLMs) is notoriously memory-intensive, often requiring significantly more GPU memory than inference due to optimizer states. This paper introduces MoFaSGD, a novel optimizer that maintains a low-rank factorization of the momentum term, drastically reducing memory usage while achieving competitive convergence and performance compared to state-of-the-art methods.
What Problem Does This Paper Address?
The rapid scaling of LLMs has led to impressive performance gains, but it also presents a significant challenge: memory efficiency during training. State-of-the-art optimizers like AdamW store substantial amounts of information (optimizer states, particularly momentum terms) that can consume several times more GPU memory than inference. While techniques like Parameter-Efficient Fine-Tuning (PEFT) and optimizer state compression exist, they often involve trade-offs. PEFT methods like LoRA restrict updates to low-rank adapters, limiting expressivity. Optimizer state compression methods might struggle with fixed subspaces or computationally expensive operations. This paper aims to bridge this gap by developing a memory-efficient optimizer that can handle full-parameter updates while drastically reducing memory overhead.
Methods
The core innovation of MoFaSGD lies in its approach to managing the first-order momentum. Instead of storing the full-rank momentum matrix, MoFaSGD maintains a dynamically updated low-rank Singular Value Decomposition (SVD) factorization of the momentum. This low-rank representation is updated efficiently using tangent space projections, avoiding costly offline resampling. Crucially, MoFaSGD leverages these low-rank momentum factors to perform spectrally normalized updates, which are known to improve optimization dynamics. This approach allows MoFaSGD to achieve memory savings comparable to LoRA while still enabling full-parameter updates, positioning it as a memory-efficient, low-rank variant of methods like Muon. The paper also provides theoretical convergence guarantees for MoFaSGD, showing it achieves an optimal rate for non-convex stochastic optimization.
Datasets
The paper evaluates MoFaSGD on the following datasets:
- FineWeb: Used for pre-training experiments with the Modded NanoGPT benchmark.
- GLUE Benchmark: A collection of seven diverse NLU tasks (MNLI, QQP, SST-2, MRPC, COLA, QNLI, and RTE) used for fine-tuning a RoBERTa-Base model.
- Tulu3 Dataset: A large instruction-tuning dataset used for evaluating performance on complex alignment tasks.
Key Insights and Ideas
- Low-rank structure in momentum: The paper hypothesizes and empirically supports that the exponential moving average (EMA) of gradients (i.e., the first-order momentum) exhibits a low-rank structure, which can be effectively captured by a low-rank factorization.
- Tangent space projection for subspace adaptation: MoFaSGD uses tangent space projections to adapt its optimization subspace, which is theoretically shown to minimize projection residual error and offers a more stable and efficient online adaptation compared to methods that rely on offline subspace resampling.
- Spectrally normalized updates from low-rank factors: By directly using the low-rank momentum factors for spectrally normalized updates, MoFaSGD bypasses potential pitfalls of subspace moment accumulation, leading to more stable and efficient optimization.
- Memory efficiency without sacrificing full-parameter updates: MoFaSGD achieves significant memory reduction comparable to LoRA while still allowing for full-parameter updates, offering a compelling trade-off.
Key Results
- Pre-training (NanoGPT): MoFaSGD consistently outperformed GaLore across various ranks, achieving lower final validation loss and smoother convergence curves, especially at lower ranks. It demonstrated a favorable trade-off between expressivity and computational efficiency.
- NLU Fine-tuning (GLUE): MoFaSGD achieved performance comparable to, and on average slightly better than, LoRA and GaLore, while using slightly less estimated memory.
- Instruction Tuning (Tulu3): MoFaSGD consistently achieved lower validation loss and converged faster in terms of wall-clock time compared to GaLore and LoRA, indicating superior sample and practical efficiency. It also achieved competitive average scores across challenging benchmarks.
- Memory Usage: MoFaSGD achieved a total memory usage of 29.4 GB on LLaMA3.1-8B, competitive with fused GaLore and LoRA, significantly reducing memory pressure compared to AdamW.
Limitations and Future Work
- Underperformance on complex tasks: As a low-rank subspace optimizer, MoFaSGD may underperform full-rank methods on extremely complex tasks.
- Fixed rank: The current study uses fixed ranks. Future work could explore adaptive or dynamic rank selection strategies to further optimize performance and memory usage.
- Theoretical assumptions: The theoretical convergence guarantees rely on assumptions like nuclear-norm smoothness, which might not always hold in deep learning setups. Further investigation into the practical relevance of these assumptions is needed.
Summary updated