Abstract
Fine-tuning Large Language Models (LLMs) is constrained by the high memory requirements of backpropagation. Zeroth-order (ZO) methods like MeZO offer a memory-efficient alternative by using only forward passes, but they suffer from high variance and poor convergence. We introduce ZO-AdaMU (Zeroth-Order Adaptive Momentum and Uncertainty), which stabilizes fine-tuning by integrating momentum directly into the random perturbations used for gradient estimation. Our method achieves faster convergence and better generalization than existing ZO techniques while maintaining significant memory efficiency.
Introduction
The memory footprint of standard first-order optimization (e.g., Adam) is a major bottleneck for fine-tuning LLMs. Storing activations for backpropagation typically requires 12 times the memory of a single forward pass. While zeroth-order optimization allows fine-tuning with inference-level memory, current methods like MeZO face three primary challenges: high variance in gradient estimates, a tendency to overfit small datasets, and an inability to effectively leverage momentum to improve convergence rates. ZO-AdaMU addresses these issues by rethinking the role of momentum in the zeroth-order framework.
Methodology
The core innovation of ZO-AdaMU is the relocation of momentum from the estimated gradient to the simulated perturbation.
Momentum-Centered Perturbation
Unlike standard ZO-SGD, which samples perturbations from a zero-centered distribution, ZO-AdaMU samples from a distribution centered around the historical momentum of successful perturbations. This biases the search toward directions that have previously led to loss reduction.
Adaptive Uncertainty and Annealing
The perturbation is a weighted combination of momentum-centered and purely random components. The weight, $\alpha$, represents "uncertainty" and is adjusted via a cosine-based simulated annealing schedule. This allows the optimizer to explore broadly in early stages and narrow its search as it approaches an optimum. Additionally, a second-order exponential moving average (EMA) of squared perturbations is maintained to adapt the learning rate per parameter, similar to the Adam optimizer.
Evaluation
We evaluated ZO-AdaMU across diverse NLP benchmarks, including SuperGLUE classification, multiple-choice reasoning (COPA, ReCoRD), and text generation (SQuAD, DROP), using models like OPT-13B and RoBERTa-large.
Hardware Efficiency
ZO-AdaMU maintains the memory efficiency of zeroth-order methods. It enables the fine-tuning of models up to 11 times larger than those possible with standard backpropagation on identical hardware. For instance, a 30B parameter model can be tuned on a single 80GB A100 GPU.
Convergence and Performance
Experimental trajectories on standard test functions, such as the Rosenbrock function, demonstrate that ZO-AdaMU reaches optimal points significantly faster and more reliably than MeZO.
On complex reasoning tasks like COPA and ReCoRD, ZO-AdaMU outperformed MeZO by 1.0% to 2.0%. It consistently provided better generalization across nearly all tested NLP tasks compared to MeZO and its parameter-efficient variants (LoRA, prefix-tuning).
Conclusion
ZO-AdaMU represents a significant step forward in making LLM fine-tuning more accessible. By guiding the zeroth-order search with adaptive momentum and uncertainty, it overcomes the stability issues of previous methods. While it introduces a slight memory overhead compared to MeZO and requires more iterations than first-order methods, its ability to scale to massive models on limited hardware makes it a powerful tool for the research community. Future work may further refine the adaptation of perturbation distributions by incorporating higher-order curvature information.
Summary updated