[Paper Review] Revisiting Zeroth-Order Optimization for Memory-Efficient LLM Fine-Tuning: A Benchmark
This paper benchmarks zeroth-order (BP-free) optimization methods for memory-efficient fine-tuning of large language models across multiple families, tasks, and fine-tuning schemes, and proposes enhancements.
In the evolving landscape of natural language processing (NLP), fine-tuning pre-trained Large Language Models (LLMs) with first-order (FO) optimizers like SGD and Adam has become standard. Yet, as LLMs grow {in size}, the substantial memory overhead from back-propagation (BP) for FO gradient computation presents a significant challenge. Addressing this issue is crucial, especially for applications like on-device training where memory efficiency is paramount. This paper proposes a shift towards BP-free, zeroth-order (ZO) optimization as a solution for reducing memory costs during LLM fine-tuning, building on the initial concept introduced by MeZO. Unlike traditional ZO-SGD methods, our work expands the exploration to a wider array of ZO optimization techniques, through a comprehensive, first-of-its-kind benchmarking study across five LLM families (Roberta, OPT, LLaMA, Vicuna, Mistral), three task complexities, and five fine-tuning schemes. Our study unveils previously overlooked optimization principles, highlighting the importance of task alignment, the role of the forward gradient method, and the balance between algorithm complexity and fine-tuning performance. We further introduce novel enhancements to ZO optimization, including block-wise descent, hybrid training, and gradient sparsity. Our study offers a promising direction for achieving further memory-efficient LLM fine-tuning. Codes to reproduce all our experiments are at https://github.com/ZO-Bench/ZO-LLM .
Motivation & Objective
- Assess memory efficiency and accuracy of BP-free zeroth-order optimization for LLM fine-tuning compared to first-order methods.
- Benchmark six ZO optimization approaches across five LLM families and three task complexities.
- Identify optimization principles and task alignment factors affecting ZO performance in LLM fine-tuning.
- Propose enhancements to ZO methods (block-wise, hybrid ZO/FO, sparsity) to improve memory efficiency and accuracy.
Proposed method
- Review and categorize zeroth-order optimization methods applicable to LLM fine-tuning (ZO-SGD, ZO-SGD-Sign, ZO-SGD-MMT, ZO-SGD-Cons, ZO-Adam, Forward-Grad).
- Use randomized gradient estimator (RGE) with directional derivative interpretation to approximate FO gradients.
- Investigate task alignment by comparing prompts that align fine-tuning tasks with pre-training objectives.
- Conduct large-scale benchmarks across 5 LLM families (Roberta-Large, OPT, LLaMA2, Vicuna, Mistral), 3 task complexities (SST2, COPA, WinoGrande) and 5 fine-tuning schemes (FT, LoRA, Prefix, Prompt, etc.).
- Evaluate memory, GPU usage, and runtime per iteration to compare BP-free vs FO methods.
- Explore enhancements: block-wise ZO, hybrid ZO/FO training, and sparsity-induced ZO gradient Estimation.

Experimental results
Research questions
- RQ1Can a comprehensive benchmark reveal the trade-offs in accuracy and memory efficiency for zeroth-order optimization in LLM fine-tuning?
- RQ2How do task alignment, forward gradient, and algorithmic complexity affect ZO-based fine-tuning performance across model scales?
- RQ3Do enhancements like block-wise optimization, hybrid ZO/FO, and gradient sparsity improve ZO fine-tuning while maintaining memory benefits?
- RQ4What are the relative performances of ZO methods versus Forward-Grad and FO optimizers across PEFT schemes and model families?
Key findings
- ZO optimization can achieve competitive results in some settings but shows high variance across models and tasks.
- Forward-Grad can outperform many ZO methods when the query budget is sufficient, but its memory efficiency advantage diminishes with larger models or when mixed-precision training is not compatible.
- ZO-SGD-Cons and ZO-SGD-MMT provide stable performance in several settings, while ZO-SGD-Sign often underperforms except on simple prompts.
- Prompt-based task alignment significantly impacts ZO performance; without alignment, ZO methods suffer notable accuracy drops.
- LoRA-based fine-tuning shows robustness across various ZO methods, suggesting compatibility with memory-efficient training strategies.
- On larger models and more complex tasks, FO methods generally outperform ZO methods by a noticeable margin, highlighting scalability limits of ZO approaches.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.