High-Layer Attention Pruning with Rescaling
Songtao Liu, Peng Liu
TL;DR
The paper addresses the high latency of large language models by proposing HARP, a training-free structured pruning method that targets attention heads in the model’s higher layers. It removes the query and key projections in those layers and bypasses the self-attention computation, paired with a non-trainable rescaling parameter alpha in the residual to stabilize representation magnitudes, determined via a greedy, perplexity-based layer-wise search. Across LLaMA3.1-8B, Mistral-7B-v0.3, Qwen2-7B, and Gemma2-9B over 27 tasks, HARP consistently outperforms existing baselines in generation and maintains competitive results on discriminative tasks, with pronounced gains in long-context settings. The method also demonstrates practical efficiency: meaningful speedups for long sequences with modest parameter reduction, and ablations support the value of pruning higher layers and performing alpha search. Together, these results suggest HARP enables faster, more scalable deployment of large LLMs in resource-constrained environments without retraining.
Abstract
Pruning is a highly effective approach for compressing large language models (LLMs), significantly reducing inference latency. However, conventional training-free structured pruning methods often employ a heuristic metric that indiscriminately removes some attention heads across all pruning layers, without considering their positions within the network architecture. In this work, we propose a novel pruning algorithm that strategically prunes attention heads in the model's higher layers. Since the removal of attention heads can alter the magnitude of token representations, we introduce an adaptive rescaling parameter that calibrates the representation scale post-pruning to counteract this effect. We conduct comprehensive experiments on a wide range of LLMs, including LLaMA3.1-8B, Mistral-7B-v0.3, Qwen2-7B, and Gemma2-9B. Our evaluation includes both generation and discriminative tasks across 27 datasets. The results consistently demonstrate that our method outperforms existing structured pruning methods. This improvement is particularly notable in generation tasks, where our approach significantly outperforms existing baselines. Code is available at https://github.com/SongtaoLiu0823/HARP.
