Beyond Size: How Gradients Shape Pruning Decisions in Large Language Models

📄 arXiv: 2311.04902v2 📥 PDF

作者: Rocktim Jyoti Das, Mingjie Sun, Liqun Ma, Zhiqiang Shen

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

发布日期: 2023-11-08 (更新: 2024-04-08)

备注: Code and models at https://github.com/VILA-Lab/GBLM-Pruner

🔗 代码/项目: GITHUB


💡 一句话要点

提出GBLM-Pruner以优化大语言模型的剪枝决策

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

关键词: 大语言模型 网络剪枝 梯度优化 稀疏性方法 模型压缩 视觉变换器 无训练剪枝

📋 核心要点

  1. 现有剪枝方法如幅度剪枝和SparseGPT未能充分利用预训练LLMs中的梯度信息,导致剪枝效果不佳。
  2. 本文提出的GBLM-Pruner通过利用梯度信息,采用无训练的方式来优化剪枝决策,提升了剪枝的有效性。
  3. 实验结果表明,GBLM-Pruner在LLaMA-1和LLaMA-2上显著超越了现有的剪枝方法,展现出更优的性能。

📝 摘要(中文)

大语言模型(LLMs)因其庞大的参数量而成为网络剪枝的主要目标,剪除部分模型权重而不影响性能。现有方法如幅度剪枝、SparseGPT和Wanda,主要集中于权重或将权重与激活结合以实现稀疏性,但忽视了预训练LLMs中提取的有用梯度。本文提出了一种新颖的稀疏性中心剪枝方法,称为基于梯度的语言模型剪枝器(GBLM-Pruner)。GBLM-Pruner利用泰勒展开的一阶项,通过适当归一化的梯度和少量校准样本,在无训练的情况下确定剪枝指标,并在多个基准测试中显著超越了SparseGPT和Wanda等竞争对手。通过引入梯度,使用该方法的无结构剪枝往往揭示出一些结构模式,反映了LLMs参数结构中的几何相互依赖性。此外,GBLM-Pruner在不进行后续重训练或权重更新的情况下保持了其简单性。对LLaMA-1和LLaMA-2的广泛评估显示,GBLM-Pruner在多个基准测试中显著超越了幅度剪枝、Wanda和SparseGPT。我们还将该方法扩展到视觉变换器上。我们的代码和模型可在https://github.com/VILA-Lab/GBLM-Pruner获取。

🔬 方法详解

问题定义:现有的剪枝方法主要集中在权重或激活的稀疏性,未能有效利用预训练模型中的梯度信息,导致剪枝效果有限。

核心思路:GBLM-Pruner通过利用泰勒展开的一阶项,结合适当归一化的梯度信息,在无训练的情况下确定剪枝指标,从而优化剪枝决策。

技术框架:GBLM-Pruner的整体架构包括梯度提取、剪枝指标计算和剪枝操作三个主要模块。首先,从少量校准样本中提取梯度信息;然后,利用这些信息计算剪枝指标;最后,执行剪枝操作。

关键创新:GBLM-Pruner的核心创新在于引入梯度信息作为剪枝决策的依据,这与传统方法的权重或激活稀疏性不同,能够更好地反映模型参数之间的几何关系。

关键设计:在设计中,GBLM-Pruner采用了适当的梯度归一化方法,以确保剪枝指标的有效性,并且不需要后续的重训练或权重更新,保持了方法的简洁性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

GBLM-Pruner在LLaMA-1和LLaMA-2的多个基准测试中表现出色,显著超越了幅度剪枝、Wanda和SparseGPT,提升幅度达到未知,展示了其在剪枝效率和模型性能保持方面的优势。

🎯 应用场景

该研究的潜在应用领域包括大语言模型的优化和资源节约,尤其适用于需要在计算资源有限的环境中部署的场景。通过有效的剪枝方法,可以在保持模型性能的同时,减少计算和存储开销,具有重要的实际价值和未来影响。

📄 摘要(原文)

Large Language Models (LLMs) with billions of parameters are prime targets for network pruning, removing some model weights without hurting performance. Prior approaches such as magnitude pruning, SparseGPT, and Wanda, either concentrated solely on weights or integrated weights with activations for sparsity. However, they overlooked the informative gradients derived from pretrained LLMs. In this paper, we present a novel sparsity-centric pruning method for pretrained LLMs, termed Gradient-based Language Model Pruner (GBLM-Pruner). GBLM-Pruner leverages the first-order term of the Taylor expansion, operating in a training-free manner by harnessing properly normalized gradients from a few calibration samples to determine the pruning metric, and substantially outperforms competitive counterparts like SparseGPT and Wanda in multiple benchmarks. Intriguingly, by incorporating gradients, unstructured pruning with our method tends to reveal some structural patterns, which mirrors the geometric interdependence inherent in the LLMs' parameter structure. Additionally, GBLM-Pruner functions without any subsequent retraining or weight updates to maintain its simplicity as other counterparts. Extensive evaluations on LLaMA-1 and LLaMA-2 across various benchmarks show that GBLM-Pruner surpasses magnitude pruning, Wanda and SparseGPT by significant margins. We further extend our approach on Vision Transformer. Our code and models are available at https://github.com/VILA-Lab/GBLM-Pruner.