Revisiting Zeroth-Order Optimization for Memory-Efficient LLM Fine-Tuning: A Benchmark

Yihua Zhang, Pingzhi Li, Junyuan Hong, Jiaxiang Li, Yimeng Zhang, Wenqing Zheng, Pin-Yu Chen, Jason D. Lee, Wotao Yin, Mingyi Hong, Zhangyang Wang, Sijia Liu, Tianlong Chen

arXiv:2402.11592 · 2026-07-27 공개 · arXiv · PDF

memory-efficiency llm-fine-tuning zeroth-order-optimization zo-sgd benchmark-study block-wise-descent gradient-sparsity hybrid-training

Abstract

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 .

한국어 요약

한 줄 요약

LLM 미세조정에서 메모리 효율성을 위해 Zeroth-Order (ZO) 최적화를 대규모 벤치마킹한 연구.

핵심 기여도

핵심 아이디어

기존 LLM 미세조정에서 사용되는 1차 최적화 방법(SGD, Adam)은 back-propagation 과정에서 메모리 비용이 급증하는 문제를 야기한다. 특히 OPT-13B 모델의 경우, 미세조정 시 메모리 비용이 추론 시의 12배에 달한다. 이를 해결하기 위해 본 연구는 back-propagation이 필요 없는 Zeroth-Order (ZO) 최적화를 도입한다. ZO 최적화는 손실 함수의 변화량을 기반으로 기울기를 추정하는 방식으로, MeZO에서 사용된 ZO-SGD 외에도 ZO-Adam, ZO-SGD-Cons, Forward-Grad 등 다양한 알고리즘을 탐구한다. 특히 Forward-Grad는 기존 ZO 방법 대비 안정성이 높고, LoRA와 결합 시 뛰어난 성능을 보인다. 연구는 ZO 최적화의 알고리즘 복잡도와 미세조정 성능 간의 trade-off를 분석하며, 메모리 효율성과 정확도를 동시에 확보할 수 있는 방안을 제시한다.

기술적 접근법

주요 결과

의의 및 한계

본 연구는 LLM 미세조정에서 ZO 최적화의 잠재력을 체계적으로 평가한 최초의 연구로, 메모리 효율성과 정확도 간의 균형을 찾는 데 기여한다. 특히 ZO-Adam과 Forward-Grad의 안정성, LoRA와의 호환성 등 새로운 통찰을 제공하며, ZO 최적화의 확장 가능성을 제시한다. 그러나 ZO 최적화는 알고리즘 복잡도가 높을수록 메모리 소비가 증가하고, 대규모 모델과 복잡한 태스크에서는 성능 저하가 발생하는 한계가 있다. 또한, ZO-Adam은 메모리 소비가 FO-SGD 대비 높아, 메모리 효율성과 정확도 간의 trade-off가 필요하다.

실용적 활용

본 연구는 on-device 학습, 모바일 기기에서의 LLM 미세조정, 메모리 제약이 있는 환경에서 활용 가능하다. 특히 LoRA와 결합된 ZO 최적화는 메모리 효율성을 유지하면서도 높은 정확도를 달성할 수 있어, 산업 현장에서의 실시간 모델 업데이트나 개인화된 서비스 개발에 유용하게 활용될 수 있다.