arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.08080cs.LGcs.AIcs.CLmath.OC
收藏

用于语言模型微调的方差缩减零阶方法

Variance-reduced Zeroth-Order Methods for Fine-Tuning Language Models

University of California, Berkeley(加州大学伯克利分校);Amazon AI Research & Education(亚马逊AI研究与教育部门);Amazon AI Labs(亚马逊AI实验室)

Tanmay Gautam, Youngsuk Park, Hao Zhou, Parameswaran Raman, Wooseok Ha

AI总结:

针对大语言模型微调中反向传播内存需求过高的问题,提出内存高效零阶随机方差缩减梯度方法MeZO-SVRG,无需任务特定提示,在GLUE基准上准确率、计算效率和内存占用均优于现有方法。

摘要:

微调语言模型(LM)已在众多下游任务中展现出成效。然而,随着语言模型规模扩大,反向传播的内存需求变得高得难以承受。零阶(ZO)优化方法可利用内存高效的前向传播来估计梯度。近期,作为ZO-SGD改进版本的MeZO(内存高效零阶优化)已被证明,在结合合适的任务提示时,其效果始终优于零样本学习和上下文学习。在本研究中,我们将零阶方法与方差缩减技术相结合,以提升基于推理的语言模型微调的稳定性与收敛性。我们提出了内存高效零阶随机方差缩减梯度(MeZO-SVRG)方法,并在多项语言模型微调任务中验证了其有效性,该方法无需依赖特定任务的提示。在基准GLUE任务上对一系列掩码语言模型和自回归语言模型进行评估后,MeZO-SVRG的表现优于MeZO,在全参数和部分参数微调设置下,测试准确率最高提升了20%。MeZO-SVRG还能缩短计算时间,它通常仅需MeZO一半的GPU小时数,就能达到MeZO的峰值测试准确率。与一阶SGD相比,MeZO-SVRG显著降低了内存占用,对于自回归模型而言内存占用减少了2倍。我们的实验表明,随着批量规模增大,MeZO-SVRG相较于SGD的内存节省优势会逐步提升。

英文摘要:

Fine-tuning language models (LMs) has demonstrated success in a wide array of downstream tasks. However, as LMs are scaled up, the memory requirements for backpropagation become prohibitively high. Zeroth-order (ZO) optimization methods can leverage memory-efficient forward passes to estimate gradients. More recently, MeZO, an adaptation of ZO-SGD, has been shown to consistently outperform zero-shot and in-context learning when combined with suitable task prompts. In this work, we couple ZO methods with variance reduction techniques to enhance stability and convergence for inference-based LM fine-tuning. We introduce Memory-Efficient Zeroth-Order Stochastic Variance-Reduced Gradient (MeZO-SVRG) and demonstrate its efficacy across multiple LM fine-tuning tasks, eliminating the reliance on task-specific prompts. Evaluated across a range of both masked and autoregressive LMs on benchmark GLUE tasks, MeZO-SVRG outperforms MeZO with up to 20% increase in test accuracies in both full- and partial-parameter fine-tuning settings. MeZO-SVRG benefits from reduced computation time as it often surpasses MeZO's peak test accuracy with a $2\times$ reduction in GPU-hours. MeZO-SVRG significantly reduces the required memory footprint compared to first-order SGD, i.e. by $2\times$ for autoregressive models. Our experiments highlight that MeZO-SVRG's memory savings progressively improve compared to SGD with larger batch sizes.

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

↑