Abstract
The quadratic complexity of attention mechanisms limits the efficiency of Large Language Models (LLMs) on long-text tasks. Recently, methods that dynamically estimate block importance have enabled efficient block sparse attention, leading to significant acceleration in long-text pre-filling of LLMs. However, their coarse-grained estimation inevitably leads to performance degradation at high sparsity rates. In this work, we propose ProxyAttn, a training-free sparse attention algorithm that achieves more precise block estimation by compressing the dimension of attention heads. Based on our observation of the similarity among multiple attention heads, we use the scores of pooled representative heads to approximate the scores for all heads. To account for the varying sparsity among heads, we also propose a block-aware dynamic budget estimation method. By combining the scores from representative proxy heads with multi-head dynamic budgets, we achieve a more fine-grained block importance evaluation at low computational cost. Experiments on a variety of mainstream models and extensive benchmarks confirm the underlying similarity among attention heads. Leveraging a fine-grained estimation, the proposed method achieves substantial gains in performance and efficiency compared to existing methods. More precisely, ProxyAttn can achieve up to 10.3x attention acceleration and 2.4x prefilling acceleration without significant performance loss.
Introduction
The "long-context" era of Large Language Models (LLMs) faces a significant bottleneck: the quadratic complexity of the attention mechanism. As input sequences grow, the computational and memory requirements for calculating attention scores increase exponentially. To address this, sparse attention techniques are often employed to skip unimportant tokens. However, existing methods typically estimate block importance by compressing the sequence dimension (e.g., pooling blocks of tokens). This "coarse-grained" approach often overlooks small but critical tokens, resulting in performance degradation at high sparsity levels. ProxyAttn proposes a novel "dimension swap": instead of blurring the sequence, it compresses the heads to maintain high-resolution sequence details.
Methodology
ProxyAttn introduces two primary innovations to achieve fine-grained importance estimation with minimal overhead: Unified Score Estimation and Dynamic Budget Allocation.
Unified Score Estimation via Proxy Heads
The fundamental observation driving ProxyAttn is that multiple attention heads within a single layer often exhibit high consistency in their focus, particularly in deeper layers. By partitioning heads into groups and calculating a single "proxy" attention score for each group using pooled queries and keys, ProxyAttn provides a high-resolution, token-level map of importance at a fraction of the standard computational cost.
Dynamic Budget Allocation
While heads may focus on similar tokens, their individual "sparsity thresholds" vary. ProxyAttn employs a lightweight "block-aware" estimation to determine a unique sparsity budget for each head. By analyzing the attention distribution of the final block, the algorithm decides how many blocks each specific head must attend to. This combination of a shared high-resolution map and individual budgets allows the model to maintain performance while maximizing efficiency.
Experimental Results
ProxyAttn was evaluated across several demanding benchmarks, including RULER, InfiniteBench, and LongBench-v2, using Llama3.1-8B/70B-Instruct and Qwen2.5-7B-Instruct-1M models.
Performance and Efficiency Trade-offs
On the RULER benchmark, ProxyAttn consistently outperformed state-of-the-art sparse attention methods such as MInference and FlexPrefill. As shown in the figure below, ProxyAttn maintains high accuracy (Ruler Score) while achieving significant speedups in Time to First Token (TTFT).
Key results include:
- Efficiency: ProxyAttn achieved a 10.3x speedup for attention kernels at 256K tokens and a 2.4x speedup for end-to-end prefilling.
- Scalability: The method scaled effectively to the Llama3.1-70B model, providing a 2.08x end-to-end prefilling speedup on 128K sequences without significant accuracy loss.
- Architecture Sensitivity: The number of required proxy heads varies; Llama models performed well with a single proxy head, while Qwen models required four due to their higher Grouped-Query Attention (GQA) ratio.
Conclusion
ProxyAttn presents a training-free, "plug-and-play" algorithm that significantly reduces the computational cost of long-context LLMs. By leveraging head consistency and dynamic budgeting, it achieves substantial gains in both performance and efficiency. Future research will investigate the utility of proxy heads for the decoding phase of LLM inference.
Summary updated