BESA: Pruning Large Language Models with Blockwise Parameter-Efficient Sparsity Allocation
作者: Peng Xu, Wenqi Shao, Mengzhao Chen, Shitao Tang, Kaipeng Zhang, Peng Gao, Fengwei An, Yu Qiao, Ping Luo
分类: cs.LG, cs.AI, cs.CL
发布日期: 2024-02-18 (更新: 2024-04-19)
🔗 代码/项目: GITHUB
💡 一句话要点
提出BESA以解决大语言模型剪枝效率低的问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大语言模型 剪枝技术 稀疏性分配 块级重构 性能优化 自然语言处理 机器学习
📋 核心要点
- 现有的逐层剪枝方法导致模型输出扰动大,并需复杂的超参数调节,影响性能。
- 本文提出BESA,通过块级重构损失优化剪枝,针对每个变换块的整体误差,分配层特定稀疏性。
- 实验结果显示,BESA在剪枝效率和性能上均优于现有方法,能够快速处理大语言模型。
📝 摘要(中文)
大语言模型(LLMs)在文本摘要、问答等任务中表现出色,但由于参数数量庞大,其计算开销极高。现有的剪枝方法如SparseGPT和Wanda采用逐层剪枝,导致模型输出显著扰动,并需精细调节超参数,影响整体性能。为此,本文提出了一种新颖的剪枝技术,称为块级参数高效稀疏分配(BESA),通过块级重构损失来优化剪枝。与传统的逐层剪枝方法不同,BESA针对每个变换块的整体剪枝误差,并以可微分的方式分配层特定稀疏性,从而减少剪枝后的性能下降。实验表明,BESA在单个A100 GPU上仅需五小时即可高效剪枝LLaMA1和LLaMA2等大语言模型,达到最先进的性能。
🔬 方法详解
问题定义:本文旨在解决大语言模型剪枝过程中存在的性能下降和超参数调节复杂的问题。现有方法的逐层剪枝方式导致模型输出显著扰动,影响整体性能。
核心思路:BESA通过块级重构损失来优化剪枝,针对每个变换块的整体剪枝误差,并以可微分的方式分配层特定稀疏性,从而减少性能下降。
技术框架:BESA的整体架构包括数据输入、块级重构损失计算、稀疏性分配和模型更新等主要模块。通过这些模块的协同工作,实现高效的剪枝过程。
关键创新:BESA的核心创新在于其块级重构损失和可微分的稀疏性分配策略,这与传统的逐层剪枝方法形成了本质区别,显著降低了性能损失。
关键设计:在设计中,BESA采用了特定的损失函数来计算块级重构误差,并通过优化算法实现层特定稀疏性的动态分配,确保剪枝后的模型性能保持在较高水平。
📊 实验亮点
实验结果表明,BESA在剪枝LLaMA1和LLaMA2等大语言模型时,能够在单个A100 GPU上仅用五小时完成剪枝,且性能达到最先进水平,显著优于传统剪枝方法。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、机器翻译和对话系统等,能够有效降低大语言模型的计算资源需求,提高其在实际应用中的可用性和效率。未来,BESA可能推动更大规模模型的应用,促进AI技术的普及。
📄 摘要(原文)
Large language models (LLMs) have demonstrated outstanding performance in various tasks, such as text summarization, text question-answering, and etc. While their performance is impressive, the computational footprint due to their vast number of parameters can be prohibitive. Existing solutions such as SparseGPT and Wanda attempt to alleviate this issue through weight pruning. However, their layer-wise approach results in significant perturbation to the model's output and requires meticulous hyperparameter tuning, such as the pruning rate, which can adversely affect overall model performance. To address this, this paper introduces a novel LLM pruning technique dubbed blockwise parameter-efficient sparsity allocation (BESA) by applying a blockwise reconstruction loss. In contrast to the typical layer-wise pruning techniques, BESA is characterized by two distinctive attributes: i) it targets the overall pruning error with respect to individual transformer blocks, and ii) it allocates layer-specific sparsity in a differentiable manner, both of which ensure reduced performance degradation after pruning. Our experiments show that BESA achieves state-of-the-art performance, efficiently pruning LLMs like LLaMA1, and LLaMA2 with 7B to 70B parameters on a single A100 GPU in just five hours. Code is available at https://github.com/OpenGVLab/LLMPrune-BESA.