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

📄 arXiv: 2402.15751v2 📥 PDF

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

分类: cs.LG, cs.AI, cs.CL

发布日期: 2024-02-24 (更新: 2026-02-16)

备注: Accepted by NeurIPS 2025

🔗 代码/项目: GITHUB


💡 一句话要点

提出Sparse MeZO以提高零阶优化的性能和效率

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 零阶优化 大型语言模型 内存效率 参数选择 优化算法

📋 核心要点

  1. 现有的零阶优化方法在处理大权重时,估计误差会显著影响优化效果,导致收敛速度慢和次优解。
  2. Sparse MeZO通过仅对选定的参数子集应用零阶优化,减少了估计误差的影响,从而提高了优化效率。
  3. 实验结果显示,Sparse MeZO在RTE任务上相较于MeZO实现了9%的绝对准确率提升和3.5倍的速度提升。

📝 摘要(中文)

在针对特定任务微调大型语言模型(LLMs)时,传统的基于梯度的训练方法存在显著的内存效率问题。为了解决这一问题,最近提出的内存高效零阶(MeZO)优化器仅需前向传播,降低了内存消耗。然而,与精确梯度相比,零阶梯度通常存在估计误差,这会显著影响优化过程。本文提出Sparse MeZO,一种新颖的内存高效零阶优化方法,仅对精心选择的参数子集应用零阶优化。通过简单有效的参数选择方案,Sparse MeZO在性能上取得了显著提升,并且开发了内存优化的稀疏掩码实现,使得Sparse MeZO能够在单个A100 GPU上微调LLaMA-30b。实验结果表明,Sparse MeZO在性能和收敛速度上均优于MeZO,且没有额外开销。

🔬 方法详解

问题定义:本论文旨在解决在微调大型语言模型时,传统方法因梯度反向传播导致的内存效率低下问题。现有的零阶优化方法在处理大权重时,估计误差会显著影响优化效果,导致收敛速度慢和次优解。

核心思路:论文提出Sparse MeZO,通过仅对精心选择的参数子集应用零阶优化,来减少估计误差的影响。这种方法旨在提高优化效率,同时保持模型性能。

技术框架:Sparse MeZO的整体架构包括参数选择模块和内存优化实现。首先,通过简单有效的参数选择方案确定需要应用零阶优化的参数子集;然后,实施内存优化的稀疏掩码,确保算法仅需推理级别的内存消耗。

关键创新:Sparse MeZO的主要创新在于其选择性地应用零阶优化,仅对特定参数进行优化,从而显著降低了估计误差对优化过程的影响。这与传统的全参数优化方法形成了鲜明对比。

关键设计:在设计中,Sparse MeZO采用了简单的参数选择策略,确保在优化过程中仅关注对性能影响最大的参数。此外,内存优化的稀疏掩码设计使得算法在单个GPU上运行时,内存使用保持在推理级别,极大地提高了效率。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

Sparse MeZO在RTE任务上相较于MeZO实现了9%的绝对准确率提升和3.5倍的速度提升,展示了其在性能和收敛速度上的显著优势。实验结果表明,Sparse MeZO在不增加额外开销的情况下,能够有效提高优化效果。

🎯 应用场景

Sparse MeZO的研究成果在大型语言模型的微调中具有广泛的应用潜力,尤其是在资源受限的环境中。其内存高效的特性使得在单个GPU上处理更大规模的模型成为可能,推动了自然语言处理和其他AI应用的发展。未来,该方法还可以扩展到其他类型的深度学习模型和任务中,进一步提升模型训练的效率和效果。

📄 摘要(原文)

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.