arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2402.02834cs.LGcs.CL
收藏

Shortened LLaMA:面向大语言模型的深度剪枝及再训练方法比较

Shortened LLaMA: Depth Pruning for Large Language Models with Comparison of Retraining Methods

Nota Inc.(Nota公司);Captions(Captions公司)

Bo-Kyeong Kim, Geonmin Kim, Tae-Ho Kim, Thibault Castells, Shinkook Choi, Junho Shin, Hyoung-Kyu Song

AI总结:

该研究针对大语言模型计算需求高的问题,提出深度剪枝方法,对比宽度剪枝验证其在内存受限场景下的推理效率优势,并发现大规模语料持续预训练的恢复效果优于LoRA微调,助力构建紧凑高性能的LLM。

摘要:

现代大语言模型(LLM)的结构化剪枝已成为降低其高计算需求的一种途径。宽度剪枝通过缩小投影权重矩阵的规模(例如移除注意力头)同时保持层数不变来实现;与之相对,深度剪枝则移除完整的层或模块,同时保持剩余权重的尺寸不变。当前大多数研究要么仅聚焦于宽度剪枝,要么结合宽度与深度剪枝,鲜有针对这两种剪枝单元(宽度与深度)对LLM推理效率影响的对比分析。本研究表明,简单的深度剪枝能够有效压缩LLM,同时性能可与近期的宽度剪枝研究相当甚至更优。我们的剪枝方法可提升推理速度,尤其在内存受限、运行LLM所需批量大小有限的场景下效果显著,而这类场景中宽度剪枝难以发挥作用。在对剪枝后的模型进行再训练以恢复质量时,在大规模语料上进行持续预训练的效果明显优于基于LoRA的微调,在剪枝比例较高的情况下尤为突出。我们希望本研究能助力构建紧凑且性能强大的LLM。代码和模型可访问:https://github.com/Nota-NetsPresso/shortened-llm

英文摘要:

Structured pruning of modern large language models (LLMs) has emerged as a way of decreasing their high computational needs. Width pruning reduces the size of projection weight matrices (e.g., by removing attention heads) while maintaining the number of layers. Depth pruning, in contrast, removes entire layers or blocks, while keeping the size of the remaining weights unchanged. Most current research focuses on either width-only or a blend of width and depth pruning, with little comparative analysis between the two units (width vs. depth) concerning their impact on LLM inference efficiency. In this work, we show that simple depth pruning can effectively compress LLMs while achieving comparable or superior performance to recent width pruning studies. Our pruning method boosts inference speeds, especially under memory-constrained conditions that require limited batch sizes for running LLMs, where width pruning is ineffective. In retraining pruned models for quality recovery, continued pretraining on a large corpus markedly outperforms LoRA-based tuning, particularly at severe pruning ratios. We hope this work can help build compact yet capable LLMs. Code and models can be found at: https://github.com/Nota-NetsPresso/shortened-llm

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑