2SSP通过分两阶段剪枝,显著提升大模型压缩效率与性能。
2SSP: A Two-Stage Framework for Structured Pruning of LLMs
- 先剪神经元再剪注意力模块,分步保留结构连通性。
- 在3个稀疏率下均优于5种顶尖方法,最高提速100倍。
- 适合追求高效模型压缩的研究者和工程落地人员。
我们提出一种名为2SSP的两阶段结构化剪枝框架,用于大型语言模型(LLMs)的剪枝。该方法结合宽度剪枝与深度剪枝:第一阶段(宽度剪枝)移除整个神经元及其对应的行和列,以保持每个Transformer块中前馈网络中间状态的连接性,基于神经元对输出幅度的影响重要性评分进行;第二阶段(深度剪枝)则逐次移除对困惑度影响最小的注意力子模块。我们还提出一种新机制,平衡两阶段的稀疏率以达到目标全局稀疏度。在四个LLM家族和三个稀疏率(25%、37.5%、50%)下测试,评估了在三个语言建模数据集上的困惑度以及六个下游任务的表现。结果表明,2SSP在三项语言建模任务和六项下游任务上持续优于五种最先进的竞争方法,剪枝时间最高降低两个数量级。代码已公开于 https://github.com/FabrizioSandri/2SSP。
原文摘要 · Abstract (English)
We propose a novel Two-Stage framework for Structured Pruning (\textsc{2SSP}) for pruning Large Language Models (LLMs), which combines two different strategies of pruning, namely Width and Depth Pruning. The first stage (Width Pruning) removes entire neurons, hence their corresponding rows and columns, aiming to preserve the connectivity among the pruned structures in the intermediate state of the Feed-Forward Networks in each Transformer block. This is done based on an importance score measuring the impact of each neuron on the output magnitude. The second stage (Depth Pruning), instead, removes entire Attention submodules. This is done by applying an iterative process that removes the Attention with the minimum impact on a given metric of interest (in our case, perplexity). We also propose a novel mechanism to balance the sparsity rate of the two stages w.r.t. to the desired global sparsity. We test \textsc{2SSP} on four LLM families and three sparsity rates (25\%, 37.5\%, and 50\%), measuring the resulting perplexity over three language modeling datasets as well as the performance over six downstream tasks. Our method consistently outperforms five state-of-the-art competitors over three language modeling and six downstream tasks, with an up to two-order-of-magnitude gain in terms of pruning time. The code is available at https://github.com/FabrizioSandri/2SSP.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。