Skip to main content
QUICK REVIEW

[论文解读] Everybody Prune Now: Structured Pruning of LLMs with only Forward Passes

Steven Kolawole, Lucio M. Dery|arXiv (Cornell University)|Feb 8, 2024
Digital Rights Management and SecurityComputer Science被引用 6
一句话总结

Bonsai 是一种针对大语言模型的梯度自由、仅前向传播的结构化裁剪方法,在内存受限的情况下实现快速、紧凑的模型,具有与基于梯度和半结构化裁剪相比的竞争力的准确性和加速。它可以在单个 A6000 GPU 上用强大性能生成子 2B 规模的模型。

ABSTRACT

Structured pruning is a promising approach to create smaller, faster large language models. However, existing methods typically rely on computing the gradient via backward passes, which can inflate memory requirements and compute costs. In this work we introduce Bonsai, a gradient-free structured pruning method that eliminates the need for backpropagation, significantly reducing memory requirements and compute costs while achieving state-of-the-art pruning performance. Bonsai uses forward-pass-only perturbative pruning to enable efficient compression of large models on a broader range of hardware configurations. Unlike existing structured pruning approaches, Bonsai not only achieves better compression with fewer resources but also produces models that are twice as fast as those generated by semi-structured pruning. As a concrete demonstration, we use Bonsai to prune 7B and 8B models to 50% sparsity on a single A6000 GPU -- a task challenging for backprop-based methods in memory-constrained settings, as they require 2-3x the memory. Our results show that removing backprop as a requirement not only enables pruning larger models on constrained hardware but can also lead to state-of-the-art efficiency and performance.

研究动机与目标

  • 通过在典型消费硬件内存限制下仅通过前向传播实现裁剪,民主化大语言模型的获取。
  • 开发一种节省内存的结构化裁剪方法,避免反向传播和训练时梯度需求。
  • 通过子模型评估以对扰动方式估计模块重要性,以在全局层级上选择裁剪机会。
  • 证明在受限资源下,前向传播裁剪能够优于基于梯度的和半结构化裁剪。

提出的方法

  • 将结构化裁剪表述为在内存约束下选择不重叠模块的子集。
  • 通过生成并评估少量子模型来估计模块相关性,并求解回归以恢复模块重要性。
  • 使用来自非结构化裁剪指标的有信息先验来偏置子模型采样。
  • 以全局视角(非逐层局部)来计算模块相关性,避免局部最优。
  • 以较小步长迭代裁剪(p_iter)并在每一步重新估计先验。
  • 可选地在裁剪后应用蒸馏和 LoRA 微调来恢复性能。

实验结果

研究问题

  • RQ1在现实内存预算范围内,是否能够仅通过前向传播实现对 LLM 的结构化裁剪?
  • RQ2当梯度优化不可行时,如何高效地估计裁剪所需的模块重要性?
  • RQ3在内存约束下,全局性(非逐层)裁剪决策是否能带来更好的精度-速度权衡?
  • RQ4是否有可能在标准基准上用来自更大架构的子 2B 模型达到有竞争力的性能?

主要发现

  • Bonsai 在前向传播裁剪下实现与父模型相竞争的困惑度,并实现多达 1.58x 的端到端加速。
  • Bonsai 在 6 项评估设置中有 4 项超过了最先进的基于梯度的结构化裁剪方法(LLM-Pruner、LoRAPrune)。
  • 在提交时,使用 Bonsai 将 ~3B Phi-2 模型裁剪到 ~1.8B,在 Huggingface Open LLM 剑桥榜单的 6 项任务中有 4 项获得领先性能。
  • 裁剪后通过 LoRA 与蒸馏的适配可以恢复甚至超过部分基线性能,Bonsai 裁剪模型在若干任务上展现出强大的零-shot 能力。
  • 通过前向传播裁剪,Bonsai 可以在达到目标尺寸的同时保持准确度,并实现显著的加速,为内存受限的从业者提供了一个可行路径。
  • 消融研究表明,扰动评估和基于回归的重要性估计都是 Bonsai 有效性的关键。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。