想压缩Transformer模型?CAHP自动剪掉冗余注意力头,不用调参,在SST-5和MNLI上比梯度方法更强,还保住了中间层的关键结构。
CAHP将注意力头选择重新定义为全局图论问题,利用图聚类和信息论距离识别互补子集。该方法无需预定义稀疏度,通过检测边际性能下降曲线自动确定每层保留的头数。在SST-5和MNLI基准上,CAHP在不同规模Transformer中均优于梯度方法,尤其在高压缩率下。结构分析表明,CAHP避免了梯度方法的“邻近偏差”,保留了模型中间层的功能关键头。
Complementary Attention Head Pruning for Efficient Transformers
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.