arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.14721cs.LGcs.AIcs.CL
收藏

PAT:面向大型语言模型的剪枝感知微调

PAT: Pruning-Aware Tuning for Large Language Models

School of Electronic Science and Engineering, Nanjing University(南京大学电子科学与工程学院);University of Arizona(亚利桑那大学);Samsung Electronic Research Centre of China(三星中国电子研究中心);Interdisciplinary Research Center for Future Intelligent Chips, Nanjing University(南京大学未来智能芯片交叉研究中心)

Yijiang Liu, Huanrui Yang, Youxin Chen, Rongyu Zhang, Miao Wang, Yuan Du, Li Du

AI总结:

本文提出剪枝感知微调(PAT)范式,通过在Attention和FFN间插入混合稀疏化模块(HSM)并结合Identity Loss,在微调阶段消除冗余并最大程度保留性能,实验证明其优于LoRA且实现显著加速。

摘要:

大型语言模型(LLMs)在语言任务中表现优异,尤其是在预训练后进行监督微调时。然而,其庞大的内存和计算需求阻碍了实际应用。结构化剪枝通过减少不重要的权重维度来解决这一问题。然而,传统的后置剪枝往往导致显著的性能损失,且由于容量减小,进一步的微调恢复效果有限。由于模型微调旨在精炼预训练模型中通用且杂乱的知识,我们致力于将结构化剪枝与微调相结合,并提出剪枝感知微调(PAT)范式,以在消除模型冗余的同时最大程度地保留模型性能。具体而言,我们在Attention和FFN组件之间插入了创新的混合稀疏化模块,以相应地稀疏化上游和下游线性模块。HSM由一个轻量级算子和一个全局共享的可训练掩码组成。轻量级算子使训练开销与LoRA相当,而可训练掩码统一了待稀疏化的通道,确保了结构化剪枝。此外,我们提出了Identity Loss,它解耦了HSM的变换和缩放属性,以增强训练鲁棒性。大量实验表明,PAT在性能和效率上均表现出色。例如,我们的Llama2-7b模型在25%的剪枝率下实现了1.33倍的加速,同时在训练成本相近的情况下,准确率比LoRA微调模型高出最多1.26%。代码:https://github.com/kriskrisliu/PAT_Pruning-Aware-Tuning

英文摘要:

Large language models (LLMs) excel in language tasks, especially with supervised fine-tuning after pre-training. However, their substantial memory and computational requirements hinder practical applications. Structural pruning, which reduces less significant weight dimensions, is one solution. Yet, traditional post-hoc pruning often leads to significant performance loss, with limited recovery from further fine-tuning due to reduced capacity. Since the model fine-tuning refines the general and chaotic knowledge in pre-trained models, we aim to incorporate structural pruning with the fine-tuning, and propose the Pruning-Aware Tuning (PAT) paradigm to eliminate model redundancy while preserving the model performance to the maximum extend. Specifically, we insert the innovative Hybrid Sparsification Modules (HSMs) between the Attention and FFN components to accordingly sparsify the upstream and downstream linear modules. The HSM comprises a lightweight operator and a globally shared trainable mask. The lightweight operator maintains a training overhead comparable to that of LoRA, while the trainable mask unifies the channels to be sparsified, ensuring structural pruning. Additionally, we propose the Identity Loss which decouples the transformation and scaling properties of the HSMs to enhance training robustness. Extensive experiments demonstrate that PAT excels in both performance and efficiency. For example, our Llama2-7b model with a 25\% pruning ratio achieves 1.33$\times$ speedup while outperforming the LoRA-finetuned model by up to 1.26\% in accuracy with a similar training cost. Code: https://github.com/kriskrisliu/PAT_Pruning-Aware-Tuning

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

↑