[论文解读] LLM-Pruner: On the Structural Pruning of Large Language Models
LLM-Pruner 引入任务无关、结构感知的对大语言模型的剪枝,在最小数据量下实现显著压缩,并在使用 LoRA 的大约 3 小时后训练完成。
Large language models (LLMs) have shown remarkable capabilities in language understanding and generation. However, such impressive capability typically comes with a substantial model size, which presents significant challenges in both the deployment, inference, and training stages. With LLM being a general-purpose task solver, we explore its compression in a task-agnostic manner, which aims to preserve the multi-task solving and language generation ability of the original LLM. One challenge to achieving this is the enormous size of the training corpus of LLM, which makes both data transfer and model post-training over-burdensome. Thus, we tackle the compression of LLMs within the bound of two constraints: being task-agnostic and minimizing the reliance on the original training dataset. Our method, named LLM-Pruner, adopts structural pruning that selectively removes non-critical coupled structures based on gradient information, maximally preserving the majority of the LLM's functionality. To this end, the performance of pruned models can be efficiently recovered through tuning techniques, LoRA, in merely 3 hours, requiring only 50K data. We validate the LLM-Pruner on three LLMs, including LLaMA, Vicuna, and ChatGLM, and demonstrate that the compressed models still exhibit satisfactory capabilities in zero-shot classification and generation. The code is available at: https://github.com/horseee/LLM-Pruner
研究动机与目标
- 在不破坏多任务求解和生成能力的前提下,以任务无关的方式对 LLM 进行压缩。
- 在压缩过程中尽量减少对原始训练语料的依赖。
- 实现快速的后训练,以在剪枝后恢复性能。
- 在无需手工设计的情况下,自动识别需要剪枝的耦合结构组。
提出的方法
- 构建依赖图以识别 LLMs 中的耦合结构,使它们被一起剪枝。
- 使用来自小型公开数据集或合成样本的一阶信息和(近似的)二阶信息来估计组级重要性。
- 根据定义的聚合策略(例如求和、乘积、最大、仅保留最后一个)剪枝低重要性组。
- 使用基于 LoRA 的后训练在有限数据(~50k 样本)和单个 GPU 大约 3 小时内高效恢复/剪枝。

实验结果
研究问题
- RQ1任务无关的结构剪枝是否能在 LLaMA、Vicuna、ChatGLM 等模型上跨多种任务和生成能力保持功能?
- RQ2基于依赖的剪枝在零样本分类和生成质量方面与非依赖剪枝相比有何差异?
- RQ3不同组重要性聚合策略在剪枝决策中的有效性如何?
- RQ4使用 LoRA 后训练恢复剪枝后的 LLM 需要多少数据和时间?
主要发现
- 对 LLaMA-7B 进行快速 LoRA 恢复后,剪掉 20% 参数也能保留大约 95% 的原始零-shot 性能。
- 剪枝后拥有 5.4B 参数的 LLM 在多份数据集上经过微调后甚至超越某些较小基线模型,而 50% 的剪枝会导致显著下降。
- 基于依赖的剪枝是必不可少的;即使经过微调,移除依赖也会严重损害零样本生成和分类。
- 在聚合策略中,Sum 在生成质量和分类性能之间提供了较好的平衡。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。