RRAttention: 通过每头轮换位移实现动态块稀疏注意力以支持长上下文推理
RRAttention: Dynamic Block Sparse Attention via Per-Head Round-Robin Shifts for Long-Context Inference
AI总结:
RRAttention通过轮换位移策略实现动态块稀疏注意力,提升长上下文推理效率,实现99%的完整注意力性能和2.4倍加速。
摘要:
注意力机制的二次复杂度对大语言模型处理长上下文构成了关键瓶颈。尽管动态稀疏注意力方法提供了输入自适应的效率,但它们面临根本性的权衡:需要预处理、缺乏全局评估、违反查询独立性或导致高计算开销。我们提出了RRAttention,一种新的动态稀疏注意力方法,通过头级轮换位移(RR)采样策略同时实现了所有 desirable 的特性。通过在每个步长内跨注意力头轮换查询采样位置,RRAttention 在保持查询独立性的同时,通过步长级聚合实现了高效的全局模式发现。我们的方法将复杂度从O(L²)降至O(L²/S²),并采用自适应Top-τ选择以实现最优稀疏性。在自然语言理解(HELMET)和多模态视频理解(Video-MME)的大量实验中,RRAttention 恢复了超过99%的完整注意力性能,同时仅计算一半的注意力块,实现了在128K上下文长度下的2.4倍加速,并优于现有动态稀疏注意力方法。
英文摘要:
The quadratic complexity of attention mechanisms poses a critical bottleneck for large language models processing long contexts. While dynamic sparse attention methods offer input-adaptive efficiency, they face fundamental trade-offs: requiring preprocessing, lacking global evaluation, violating query independence, or incurring high computational overhead. We present RRAttention, a novel dynamic sparse attention method that simultaneously achieves all desirable properties through a head \underline{r}ound-\underline{r}obin (RR) sampling strategy. By rotating query sampling positions across attention heads within each stride, RRAttention maintains query independence while enabling efficient global pattern discovery with stride-level aggregation. Our method reduces complexity from $O(L^2)$ to $O(L^2/S^2)$ and employs adaptive Top-$τ$ selection for optimal sparsity. Extensive experiments on natural language understanding (HELMET) and multimodal video comprehension (Video-MME) demonstrate that RRAttention recovers over 99\% of full attention performance while computing only half of the attention blocks, achieving 2.4$\times$ speedup at 128K context length and outperforming existing dynamic sparse attention methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。