通过代表性注意力头实现更精准的稀疏注意力,显著提升长文本处理效率。
ProxyAttn: Guided Sparse Attention via Representative Heads
- 用压缩后的代表性头近似所有头的得分,实现细粒度重要性评估
- 在高稀疏率下仍保持性能,相比现有方法加速达10.3倍
- 无需训练,适用于主流大模型,适合长文本推理场景
注意力机制的二次复杂度限制了大语言模型在长文本任务中的效率。近期动态估计块重要性的方法虽实现了高效块稀疏注意力,但粗粒度估计导致高稀疏率下性能下降。本文提出ProxyAttn,一种无需训练的稀疏注意力算法,通过压缩注意力头维度实现更精确的块重要性估计。基于多头间相似性的观察,使用池化后的代表性头得分近似所有头得分,并引入块感知的动态预算分配机制。结合代理头得分与多头动态预算,以低计算成本实现细粒度重要性评估。在多种主流模型和广泛基准上的实验验证了注意力头间的内在相似性。所提方法在保持性能的同时,相比现有方法实现显著提升:注意力加速最高达10.3倍,预填充加速达2.4倍。代码已开源。
原文摘要 · Abstract (English)
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. Our code is available at https://github.com/wyxstriker/ProxyAttn.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。