Zeroth-Order Fine-Tuning of LLMs with Extreme Sparsity
Wentao Guo, Jikai Long, Yimeng Zeng, Zirui Liu, Xinyu Yang, Yide Ran, Jacob R. Gardner, Osbert Bastani, Christopher De Sa, Xiaodong Yu, Beidi Chen, Zhaozhuo Xu
TL;DR
This work tackles memory constraints in fine-tuning large language models by marrying zeroth-order optimization with extreme sparsity and quantization. It uncovers a Fisher-informed, transferably sparse pattern wherein updating only ~0.1% of parameters suffices to match or exceed full ZO fine-tuning performance, while quantizing the rest to 4-bit enables on-device training within 8 GiB GPUs. The authors provide theoretical convergence guarantees for sparse ZO-SGD and demonstrate strong empirical results across multiple 7B-scale models and diverse tasks, achieving notable wall-clock speedups and practical on-device personalization capabilities. The approach offers a scalable path to personalized LLMs on edge devices without sacrificing performance, with broad implications for privacy-preserving deployment and responsive user experiences.
Abstract
Zeroth-order optimization (ZO) is a memory-efficient strategy for fine-tuning Large Language Models using only forward passes. However, the application of ZO fine-tuning in memory-constrained settings such as mobile phones and laptops is still challenging since full precision forward passes are infeasible. In this study, we address this limitation by integrating sparsity and quantization into ZO fine-tuning of LLMs. Specifically, we investigate the feasibility of fine-tuning an extremely small subset of LLM parameters using ZO. This approach allows the majority of un-tuned parameters to be quantized to accommodate the constraint of limited device memory. Our findings reveal that the pre-training process can identify a set of "sensitive parameters" that can guide the ZO fine-tuning of LLMs on downstream tasks. Our results demonstrate that fine-tuning 0.1% sensitive parameters in the LLM with ZO can outperform the full ZO fine-tuning performance, while offering wall-clock time speedup. Additionally, we show that ZO fine-tuning targeting these 0.1% sensitive parameters, combined with 4 bit quantization, enables efficient ZO fine-tuning of an Llama2-7B model on a GPU device with less than 8 GiB of memory and notably reduced latency.
