提出DiZO方法,让零阶微调更快更准且省显存。
Harmony in Divergence: Towards Fast, Accurate, and Memory-efficient Zeroth-order LLM Fine-tuning
- 通过分层差异分析,动态调整各层更新幅度。
- 在多个模型上将训练耗时减少48%,精度超主流零阶方法。
- 适合资源受限场景,可媲美高消耗的一阶微调。
大语言模型虽性能优异,但标准一阶微调需大量显存,限制实际部署。零阶优化避免反向传播,仅靠前向计算估计梯度,更适用于资源受限环境,但收敛速度和精度远落后于一阶方法。本文通过分层差异分析揭示一阶与零阶优化的更新模式差异,提出基于差异驱动的零阶优化(DiZO)。DiZO通过投影机制将零阶更新映射到各层所需尺度,生成差异化幅度的更新。实验表明,DiZO显著减少收敛迭代次数,不牺牲吞吐量,最大节省48%训练GPU小时。在RoBERTa-large、OPT系列和Llama系列模型上,对下游任务的微调表现持续优于代表性零阶基线,部分场景甚至超越内存密集型一阶微调。代码已开源:https://github.com/Skilteee/DiZO。
原文摘要 · Abstract (English)
Large language models (LLMs) excel across various tasks, but standard first-order (FO) fine-tuning demands considerable memory, significantly limiting real-world deployment. Recently, zeroth-order (ZO) optimization stood out as a promising memory-efficient training paradigm, avoiding backward passes and relying solely on forward passes for gradient estimation, making it attractive for resource-constrained scenarios. However, ZO method lags far behind FO method in both convergence speed and accuracy. To bridge the gap, we introduce a novel layer-wise divergence analysis that uncovers the distinct update pattern of FO and ZO optimization. Aiming to resemble the learning capacity of FO method from the findings, we propose Divergence-driven Zeroth-Order (DiZO) optimization. DiZO conducts divergence-driven layer adaptation by incorporating projections to ZO updates, generating diverse-magnitude updates precisely scaled to layer-wise individual optimization needs. Our results demonstrate that DiZO significantly reduces the needed iterations for convergence without sacrificing throughput, cutting training GPU hours by up to 48\% on various datasets. Moreover, DiZO consistently outperforms the representative ZO baselines in fine-tuning RoBERTa-large, OPT-series, and Llama-series on downstream tasks and, in some cases, even surpasses memory-intensive FO fine-tuning. Our code is released at https://github.com/Skilteee/DiZO.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。