Sparse Fine-tuning for Inference Acceleration of Large Language Models

📄 arXiv: 2310.06927v2 📥 PDF

作者: Eldar Kurtic, Denis Kuznedelev, Elias Frantar, Michael Goin, Dan Alistarh

分类: cs.CL, cs.AI

发布日期: 2023-10-10 (更新: 2023-10-13)


💡 一句话要点

提出稀疏微调方法以加速大型语言模型推理

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 稀疏微调 大型语言模型 蒸馏训练 推理加速 自然语言处理 机器翻译 语音识别

📋 核心要点

  1. 现有的标准损失微调方法在高稀疏性下难以恢复模型的准确性,限制了大型语言模型的应用。
  2. 本文提出了一种新的稀疏微调方法SquareHead,通过蒸馏损失实现高稀疏性下的准确恢复,提升了模型的推理效率。
  3. 实验结果表明,稀疏微调在75%稀疏性下仍能保持准确性,并在CPU和GPU推理中实现显著加速。

📝 摘要(中文)

本文考虑了大型语言模型(LLMs)稀疏微调的准确性问题,即在特定任务上对预训练LLMs进行微调,同时引入权重稀疏性。我们观察到,标准的基于损失的微调方法在高稀疏性下可能无法恢复准确性。为此,我们进行了详细的蒸馏类型损失研究,确定了一种基于L2的蒸馏方法,称为SquareHead,能够在所有模型类型中实现高稀疏性下的准确恢复。在实际效率方面,我们展示了稀疏LLMs在CPU和GPU运行时的加速效果,并指出在内存受限的情况下,稀疏性也可以用于减少内存带宽。我们展示了在T5、Whisper和开放GPT类型模型(MPT)上的端到端结果,证明了稀疏微调可以在75%稀疏性下保持准确性,并提供显著的推理加速。

🔬 方法详解

问题定义:本文旨在解决大型语言模型在高稀疏性下微调时准确性下降的问题。现有的标准损失微调方法在这种情况下表现不佳,导致模型性能受限。

核心思路:提出了一种新的蒸馏损失方法SquareHead,基于L2损失,能够在高稀疏性下有效恢复模型的准确性。通过这种方法,模型在保持稀疏性的同时,仍能实现良好的推理性能。

技术框架:整体架构包括预训练模型的稀疏微调、蒸馏损失的计算以及模型推理的优化。主要模块包括稀疏性引入、损失计算和推理加速。

关键创新:最重要的技术创新在于提出了SquareHead蒸馏损失方法,使得在高稀疏性下模型的准确性得以恢复。这一方法与传统的损失微调方法有本质区别,能够更好地适应稀疏性。

关键设计:在参数设置上,采用了特定的稀疏率和损失函数设计,确保在75%稀疏性下模型性能不下降。此外,模型结构也进行了优化,以适应稀疏性带来的变化。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,稀疏微调方法在75%稀疏性下保持了模型的准确性,并在CPU和GPU推理中实现了显著的加速,具体加速幅度未明确说明。该方法首次证明了稀疏性与量化方法的兼容性,为未来的研究提供了新的方向。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、机器翻译和语音识别等。通过提高大型语言模型的推理效率和准确性,能够在实际应用中显著提升用户体验,推动相关技术的广泛应用与发展。

📄 摘要(原文)

We consider the problem of accurate sparse fine-tuning of large language models (LLMs), that is, fine-tuning pretrained LLMs on specialized tasks, while inducing sparsity in their weights. On the accuracy side, we observe that standard loss-based fine-tuning may fail to recover accuracy, especially at high sparsities. To address this, we perform a detailed study of distillation-type losses, determining an L2-based distillation approach we term SquareHead which enables accurate recovery even at higher sparsities, across all model types. On the practical efficiency side, we show that sparse LLMs can be executed with speedups by taking advantage of sparsity, for both CPU and GPU runtimes. While the standard approach is to leverage sparsity for computational reduction, we observe that in the case of memory-bound LLMs sparsity can also be leveraged for reducing memory bandwidth. We exhibit end-to-end results showing speedups due to sparsity, while recovering accuracy, on T5 (language translation), Whisper (speech translation), and open GPT-type (MPT for text generation). For MPT text generation, we show for the first time that sparse fine-tuning can reach 75% sparsity without accuracy drops, provide notable end-to-end speedups for both CPU and GPU inference, and highlight that sparsity is also compatible with quantization approaches. Models and software for reproducing our results are provided in Section 6.