arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.21174cs.LG
收藏

采用AMP的高效大语言模型:注意力头与多层感知机剪枝

Efficient LLMs with AMP: Attention Heads and MLP Pruning

Escola Politécnica(圣保罗理工大学);Instituto de Matemática e Estatística(数学与统计学研究所);Universidade de São Paulo(圣保罗大学);Instituto de Ciência e Tecnologia Itaú (ICTi)(Itaú科学与技术研究所)

Leandro Giusti Mugnaini, Bruno Lopes Yamamoto, Lucas Lauton de Alcantara, Victor Zacarias, Edson Bollis, Lucas Pellicer, Anna Helena Reali Costa, Artur Jordao

AI总结:

本文提出新型结构化剪枝方法AMP,通过剪枝LLMs的注意力头与MLP结构压缩模型,在常识推理任务上超越当前最优方法,提升推理速度,适用于LLaMA、Phi等模型,支持资源受限场景部署。

摘要:

深度学习推动了计算系统的新发展浪潮,促使越来越复杂问题的自动化成为现实。其中,大语言模型(Large Language Models, LLMs)已显著提升认知任务的表现,常达到甚至超越人类水平。但LLMs庞大的参数规模会带来高计算成本与缓慢的推理速度,给资源受限场景下的部署带来挑战。在应对上述挑战的策略中,剪枝是一种有效的机制,它能在保持预测能力的同时减小模型规模。本文提出AMP(Attention Heads and MLP Pruning),一种新型结构化剪枝方法,通过移除多头注意力(Multi-Head Attention, MHA)和多层感知机(Multilayer Perceptron, MLP)中较不重要的结构,高效压缩LLMs。AMP通过将输入数据投影到权重上来评估结构重要性,克服了现有技术在灵活性或效率上的不足。具体而言,AMP在常识推理任务上超越了当前最优方法,最高提升1.49个百分点,在实现30%剪枝率的同时,对零样本任务性能的影响极小。此外,AMP还提升了推理速度,非常适合部署在资源受限的环境中。我们还验证了AMP在不同LLMs系列(包括LLaMA和Phi)上的灵活性。

英文摘要:

Deep learning drives a new wave in computing systems and triggers the automation of increasingly complex problems. In particular, Large Language Models (LLMs) have significantly advanced cognitive tasks, often matching or even surpassing human-level performance. However, their extensive parameters result in high computational costs and slow inference, posing challenges for deployment in resource-limited settings. Among the strategies to overcome the aforementioned challenges, pruning emerges as a successful mechanism since it reduces model size while maintaining predictive ability. In this paper, we introduce AMP: Attention Heads and MLP Pruning, a novel structured pruning method that efficiently compresses LLMs by removing less critical structures within Multi-Head Attention (MHA) and Multilayer Perceptron (MLP). By projecting the input data onto weights, AMP assesses structural importance and overcomes the limitations of existing techniques, which often fall short in flexibility or efficiency. In particular, AMP surpasses the current state-of-the-art on commonsense reasoning tasks by up to 1.49 percentage points, achieving a 30% pruning ratio with minimal impact on zero-shot task performance. Moreover, AMP also improves inference speeds, making it well-suited for deployment in resource-constrained environments. We confirm the flexibility of AMP on different families of LLMs, including LLaMA and Phi.

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

↑