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

稀疏MeZO:在零阶LLM微调中更少的参数带来更好的性能

Sparse MeZO: Less Parameters for Better Performance in Zeroth-Order LLM Fine-Tuning

National University of Singapore(新加坡国立大学);Pennsylvania State University(宾夕法尼亚州立大学);University of California, Los Angeles(加州大学洛杉矶分校)

Yong Liu, Zirui Zhu, Chaoyu Gong, Minhao Cheng, Cho-Jui Hsieh, Yang You

AI总结:

稀疏MeZO通过仅对部分参数应用零阶优化,提升LLM微调的性能和收敛速度。

摘要:

尽管微调大型语言模型(LLMs)以完成特定任务通常能产生令人印象深刻的结果,但这种做法因基于梯度的训练中反向传播而带来内存效率低下的问题。最近提出的内存高效的零阶(MeZO)优化器旨在解决这一问题,仅在训练过程中需要前向传递,使其更具有内存效率。然而,与精确梯度相比,基于零阶的梯度通常会引入估计误差,这可能显著影响优化过程,导致收敛速度变慢和次优解。此外,我们发现当将估计误差加到大权重而不是小权重时,其影响会更严重。基于这一观察,本文介绍了一种新的内存高效的零阶优化方法,即稀疏MeZO,该方法仅对精心选择的参数子集应用零阶梯度。我们提出了一种简单而有效的参数选择方案,通过稀疏MeZO实现了显著的性能提升。此外,我们还开发了一种内存优化的稀疏掩码实现,确保算法仅需要推理级别的内存消耗,使稀疏MeZO能够在单块A100 GPU上微调LLaMA-30b。实验结果表明,稀疏MeZO在性能和收敛速度上均优于MeZO,且无额外开销。例如,在RTE任务上,它实现了9%的绝对准确率提升和3.5倍的加速。代码可在https://github.com/NUS-HPC-AI-Lab/SparseMeZO上获得。

英文摘要:

While fine-tuning large language models (LLMs) for specific tasks often yields impressive results, it comes at the cost of memory inefficiency due to back-propagation in gradient-based training. Memory-efficient Zeroth-order (MeZO) optimizers, recently proposed to address this issue, only require forward passes during training, making them more memory-friendly. However, compared with exact gradients, ZO-based gradients usually exhibit an estimation error, which can significantly hurt the optimization process, leading to slower convergence and suboptimal solutions. In addition, we find that the estimation error will hurt more when adding to large weights instead of small weights. Based on this observation, this paper introduces Sparse MeZO, a novel memory-efficient zeroth-order optimization approach that applies ZO only to a carefully chosen subset of parameters. We propose a simple yet effective parameter selection scheme that yields significant performance gains with Sparse-MeZO. Additionally, we develop a memory-optimized implementation for sparse masking, ensuring the algorithm requires only inference-level memory consumption, allowing Sparse-MeZO to fine-tune LLaMA-30b on a single A100 GPU. Experimental results illustrate that Sparse-MeZO consistently improves both performance and convergence speed over MeZO without any overhead. For example, it achieves a 9\% absolute accuracy improvement and 3.5x speedup over MeZO on the RTE task. Code is available at https://github.com/NUS-HPC-AI-Lab/SparseMeZO.

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

↑