arXiv:2503.03588cs.CLcs.LG2025-03被引 10

提出PowerAttention,让大模型高效处理长文本

PowerAttention: Exponentially Scaling of Receptive Fields for Effective Sparse Attention

  • 通过指数扩展感受野实现稀疏注意力
  • 128K上下文下推理快3倍,任务准确率提升5%~40%
  • 适合需要长距离依赖的场景,如信息检索

大语言模型在处理长文本时受限于注意力机制的二次复杂度。稀疏注意力虽具潜力,但现有方法常存在有效上下文不完整或实现复杂的问题。本文从感受野角度分析自回归大模型的稀疏注意力,指出现有方法在扩展感受野上的不足,并提出PowerAttention——一种基于理论分析的新稀疏注意力设计。该方法使d层模型的感受野呈指数级增长,每个输出词元可关注到2^d个输入词元,确保上下文完整连续。实验表明,PowerAttention在Passkey Retrieval和RULER等长依赖任务上相比静态稀疏注意力提升5%~40%,且时间复杂度与滑动窗口注意力相当。效率测试显示,在128K上下文下,其预填充和解码阶段速度比动态稀疏注意力和全注意力快3.0倍,是处理长序列的高效且易用方案。

原文摘要 · Abstract (English)

Large Language Models (LLMs) face efficiency bottlenecks due to the quadratic complexity of the attention mechanism when processing long contexts. Sparse attention methods offer a promising solution, but existing approaches often suffer from incomplete effective context and/or require complex implementation of pipeline. We present a comprehensive analysis of sparse attention for autoregressive LLMs from the respective of receptive field, recognize the suboptimal nature of existing methods for expanding the receptive field, and introduce PowerAttention, a novel sparse attention design that facilitates effective and complete context extension through the theoretical analysis. PowerAttention achieves exponential receptive field growth in $d$-layer LLMs, allowing each output token to attend to $2^d$ tokens, ensuring completeness and continuity of the receptive field. Experiments demonstrate that PowerAttention outperforms existing static sparse attention methods by $5\sim 40\%$, especially on tasks demanding long-range dependencies like Passkey Retrieval and RULER, while maintaining a comparable time complexity to sliding window attention. Efficiency evaluations further highlight PowerAttention's superior speedup in both prefilling and decoding phases compared with dynamic sparse attentions and full attention ($3.0\times$ faster on 128K context), making it a highly effective and user-friendly solution for processing long sequences in LLMs.

稀疏注意力长文本大模型效率优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。