arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.08989cs.LGcs.AI
收藏

在随机子空间中对大语言模型进行零阶微调

Zeroth-Order Fine-Tuning of LLMs in Random Subspaces

Beijing Normal University(北京师范大学);Singapore Management University(新加坡国立大学);TAL Education Group(TAL教育集团);Engineering Research Center of Intelligent Technology and Educational Application (MOE)(智能技术与教育应用工程研究中心(教育部))

Ziming Yu, Pan Zhou, Sike Wang, Jia Li, Mi Tian, Hua Huang

AI总结:

针对零阶优化梯度方差随参数维度增长的问题,本文提出 SubZero,利用面向 LLM 的低秩随机子空间扰动降低内存与方差,并证明其逼近反向传播梯度且可收敛。

摘要:

微调大语言模型(LLM)已被证明对多种下游任务有效。然而,随着 LLM 规模增大,反向传播的内存需求变得越来越难以承受。零阶(ZO)优化方法通过利用前向传播估计梯度,提供了一种内存高效的替代方案,但其梯度估计的方差通常随模型参数维度线性增长——这对 LLM 来说是一个严重问题。本文提出随机子空间零阶(SubZero)优化方法,以应对 LLM 高维度带来的挑战。我们引入了一种为 LLM 定制的低秩扰动,可显著降低内存消耗并提升训练性能。此外,我们证明该梯度估计能紧密逼近反向传播梯度,方差低于传统 ZO 方法,并且与 SGD 结合时可保证收敛。实验结果表明,在多种语言建模任务中,与 MeZO 等标准 ZO 方法相比,SubZero 提升了微调性能并实现更快收敛。代码位于 https://github.com/zimingyy/SubZero。

英文摘要:

Fine-tuning Large Language Models (LLMs) has proven effective for a variety of downstream tasks. However, as LLMs grow in size, the memory demands for backpropagation become increasingly prohibitive. Zeroth-order (ZO) optimization methods offer a memory-efficient alternative by using forward passes to estimate gradients, but the variance of gradient estimates typically scales linearly with the model's parameter dimension$\unicode{x2013}$a significant issue for LLMs. In this paper, we propose the random Subspace Zeroth-order (SubZero) optimization to address the challenges posed by LLMs' high dimensionality. We introduce a low-rank perturbation tailored for LLMs that significantly reduces memory consumption while improving training performance. Additionally, we prove that our gradient estimation closely approximates the backpropagation gradient, exhibits lower variance than traditional ZO methods, and ensures convergence when combined with SGD. Experimental results show that SubZero enhances fine-tuning performance and achieves faster convergence compared to standard ZO approaches like MeZO across various language modeling tasks. Code is available at https://github.com/zimingyy/SubZero.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑