Abstract
MicroAdam is a memory-efficient variant of the Adam optimizer designed to reduce the significant memory overhead associated with training large-scale neural networks. By combining top-k gradient sparsification with a novel quantized error feedback mechanism, MicroAdam achieves substantial memory savings—using less than half the memory of 8-bit Adam—while maintaining rigorous theoretical convergence guarantees. Empirical results on large language model (LLM) fine-tuning and vision tasks demonstrate that MicroAdam matches or exceeds the performance of standard Adam with significantly lower resource requirements.
Introduction
Training modern deep learning models, particularly Large Language Models (LLMs) with billions of parameters, is severely constrained by GPU memory. The Adam optimizer, while effective, is a primary contributor to this bottleneck because it stores two moving averages (momentum and variance) for every model parameter. This requirement effectively doubles or triples the memory footprint compared to basic Stochastic Gradient Descent (SGD).
Existing solutions like AdaFactor, 8-bit Adam, and GaLore attempt to mitigate this through quantization or factorization. However, these methods often rely on heuristics and lack the rigorous theoretical convergence guarantees found in standard optimizers. MicroAdam addresses this gap by providing a mathematically grounded, highly memory-efficient adaptive optimizer that is both fast in practice and provably convergent.
Methodology
MicroAdam achieves its memory efficiency by compressing gradient information before it is integrated into the optimizer state. The core algorithm relies on three primary components:
- Top-K Gradient Sparsification: Instead of dense historical gradients, MicroAdam applies a Top-K operator, typically retaining only the largest 1% of gradient values. A sliding window of these sparse gradients is used to compute Adam's statistics dynamically.
- Error Feedback (EF): To prevent the loss of information from sparsification, an error feedback mechanism accumulates discarded gradient components and reintroduces them in subsequent steps.
- Quantized Error Feedback: A key innovation of MicroAdam is the proof that the error feedback buffer can be aggressively quantized (e.g., to 4 bits) without compromising convergence. This prevents the EF buffer itself from becoming a memory bottleneck.
To ensure these theoretical gains translate to real-world performance, the authors developed custom CUDA kernels. These kernels perform block-wise Top-K operations and dynamic statistics computation in shared memory, avoiding the overhead typically associated with sparse operations in standard frameworks like PyTorch.
Theoretical Insights and Trajectory Analysis
A critical insight of this work is the role of error feedback in stabilizing optimization. Without it, aggressive gradient sparsification leads to highly unstable, "jagged" optimization trajectories that can fail to converge. As shown in the comparison below, the addition of error feedback allows the optimizer to recover the smooth, efficient path of standard Adam even when 99% of the gradient data is sparsified.
Mathematically, the authors prove that MicroAdam matches the asymptotic convergence rate of AMSGrad for smooth non-convex functions and functions satisfying the Polyak-Lojasiewicz (PL) condition. Furthermore, the use of sparse updates acts as an implicit regularizer, which has been shown to improve performance in domains like ImageNet pre-training where Adam variants typically struggle against SGD.
Experimental Results
MicroAdam was evaluated across a diverse set of benchmarks, including GLUE/MNLI for BERT and OPT models, and GSM-8k for full fine-tuning of LLaMA-2 (7B and 13B).
- Memory Efficiency: For a LLaMA-2 7B model, MicroAdam's optimizer state requires only 5.65 GB, compared to 12.55 GB for 8-bit AdamW and 50.21 GB for standard fp32 AdamW.
- Performance: On the GSM-8k math reasoning task, MicroAdam achieved 34.72% accuracy, outperforming 8-bit Adam (34.34%) and matching standard Adam (34.50%).
- Speed: MicroAdam is faster than standard implementations; fine-tuning LLaMA-2 7B took 68 minutes with MicroAdam versus 77 minutes with standard Adam.
Conclusion and Future Work
MicroAdam represents a significant step forward in memory-efficient optimization, offering a rare combination of low space overhead, high speed, and provable convergence. While it excels in fine-tuning and vision pre-training, current results suggest it may require further adaptation for LLM pre-training from scratch, where dense updates in attention layers appear more critical. Future work will focus on extending the efficient CUDA implementation to support low-rank projections alongside sparsification.
Summary updated