Introduction
The "Achilles' heel" of modern Large Language Models (LLMs) is the quadratic complexity of the attention mechanism. As input text grows—from a short prompt to a 100,000-token book—the computational cost and memory usage explode. To mitigate this, researchers often employ block-sparse attention, which identifies and skips "unimportant" blocks of text.
However, existing methods typically estimate block importance by compressing the sequence dimension (downsampling the text). This coarse-grained approach often "blurs" the results, causing the model to overlook tiny but critical pieces of information—the classic "needle in a haystack" problem. At high sparsity rates, this leads to a significant drop in model intelligence.
ProxyAttn is a training-free algorithm designed to slash the computational cost of LLMs processing long texts by up to 10.3x. By using a few "representative heads" to predict the attention patterns of an entire layer, it achieves high-precision sparse attention without the performance degradation typical of previous methods.
The ProxyAttn Approach
ProxyAttn shifts the strategy from sequence compression to head compression. The approach is built on two key observations regarding how LLMs process information:
- Head Consistency: In deeper layers of an LLM, different attention heads tend to focus on the same sets of tokens.
- Sparsity Variability: While heads look at similar features, some are highly sparse ("picky"), while others are dense ("greedy").
Workflow
- Unified Score Estimation: Instead of calculating attention for all 32 or 64 heads, ProxyAttn groups heads together and calculates a single, high-resolution attention map for one "proxy head." This proxy head is created by pooling the queries and keys of the group.
- Dynamic Budget Allocation: To account for the varying information needs of different heads, the algorithm uses an online method to estimate a "budget" for each individual head.
- Fine-Grained Masking: By combining the high-resolution proxy score with individual head budgets, the system creates a precise mask that tells the hardware exactly which blocks to compute and which to skip.
Crucially, ProxyAttn is training-free, meaning it can be integrated into existing models like Llama 3.1 or Qwen 2.5 without any expensive fine-tuning.
Key Insights
- The "Where" vs. "How Much" Distinction: The most surprising finding is that while attention heads are diverse, their diversity lies mostly in how much they attend to certain tokens, not which tokens they attend to. This allows a single proxy to act as a reliable "scout" for the entire group.
- Preserving the "Needle": By avoiding sequence-dimension compression, ProxyAttn maintains token-level precision. This ensures that even if a head is highly sparse, it still finds the exact tokens it needs.
- Scaling Efficiency: Even for a massive 70B model with 64 heads, a single proxy head is often sufficient to accurately guide the entire layer.
Evaluation and Results
The researchers evaluated ProxyAttn across several rigorous long-context benchmarks, including RULER (synthetic tasks from 4K to 128K tokens), InfiniteBench (real-world long-text tasks), and LongBench-v2 (complex reasoning). Tests were conducted on Llama3.1-8B, Qwen2.5-7B, and Llama3.1-70B.
- Massive Speedups: ProxyAttn achieved up to 10.3x acceleration for the attention kernel itself and a 2.4x end-to-end prefilling speedup (the time it takes the model to process the initial prompt).
- Pareto Frontier: In almost every test, ProxyAttn provided a better trade-off between speed and accuracy than previous state-of-the-art methods like MInference or FlexPrefill.
- Performance Retention: On the RULER benchmark, ProxyAttn maintained nearly full-model performance even when skipping the vast majority of computations. In some cases, the sparse pattern slightly improved results by filtering out noise in the attention scores.
Limitations and Future Work
Currently, ProxyAttn focuses on the pre-filling stage (processing the input). While this is the primary bottleneck for long-context tasks, the decoding stage (generating tokens one by one) also requires optimization. Additionally, the method relies on a threshold ($\gamma$) to determine sparsity. While the authors propose a dynamic way to set this, different applications might still require manual adjustment to find the perfect balance of speed and accuracy.
Future work will investigate integrating proxy heads into the decoding phase and exploring whether this "representative head" logic can inspire entirely new, more efficient model architectures from scratch.
Summary updated