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

互补注意力头剪枝用于高效Transformer

Complementary Attention Head Pruning for Efficient Transformers

Bar-Ilan University(巴伊兰大学)

Yaniv Livertovsky, Shahar Somin, Gonen Singer

AI总结:

提出CAHP框架,将注意力头选择建模为全局图论问题,通过图聚类和信息论距离保留互补头,自动确定剪枝数量,在SST-5和MNLI上优于现有方法。

摘要:

基于Transformer的模型在自然语言处理中的显著成功源于架构的规模化,这导致大量参数并阻碍了在资源受限环境中的部署。虽然结构化剪枝提供了一条压缩路径,但现有的最先进方法通常依赖于基于梯度的重要性排序或随机门控,这些方法存在不稳定性、结构退化以及需要大量手动超参数调整的问题。在本文中,我们引入了CAHP(互补注意力头剪枝),一种新颖的事后框架,将头选择重新定义为全局图论问题。CAHP不是孤立地评估头,而是利用基于图的聚类结合信息论距离度量来识别并保留一组拓扑多样化的互补注意力头。无需预定义稀疏度或剪枝比例,该框架通过识别递减的边际性能曲线自动确定各层中保留的注意力头数量,其中根据所选多项式次数,剪除额外头会导致性能急剧下降。在SST-5和MNLI基准上跨不同Transformer模型规模的广泛评估表明,CAHP始终优于竞争基线,特别是在高压缩率情况下。此外,我们的结构分析表明,CAHP避免了基于梯度的剪枝方法的“邻近偏差”(倾向于主要保留靠近输出层的头),而是保留了模型中间层中功能关键的注意力头集合。

英文摘要:

The remarkable success of Transformer-based models in natural language processing stems from architectural scaling, which leads to a large number of parameters and hinders deployment in resource-constrained environments. While structured pruning offers a pathway to compression, existing state-of-the-art methods often rely on gradient-based importance ranking or stochastic gating, which suffer from instability, structural degeneration, and the need for extensive manual hyperparameter tuning. In this paper, we introduce CAHP (Complementary Attention Head Pruning), a novel post-hoc framework that redefines head selection as a global graph-theoretical problem. Rather than evaluating heads in isolation, CAHP utilizes graph-based clustering combined with information-theoretic distance measures to identify and preserve a topologically diverse subset of complementary attention heads. Without requiring a predefined sparsity level or pruning ratio, the framework automatically determines the number of selected attention heads across layers by identifying a diminishing marginal performance curve, where pruning additional heads leads to a sharp degradation in performance, as determined by the chosen polynomial degree. Extensive evaluations on the SST-5 and MNLI benchmarks, across different Transformer model scales, demonstrate that CAHP consistently outperforms competitive baselines, particularly in high-compression regimes. Furthermore, our structural analysis shows that CAHP avoids the "proximity bias" of gradient-based pruning methods, which tend to preserve heads mainly in layers close to the output, and instead retains a functionally critical set of attention heads in the model's intermediate layers.

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

↑