arXiv:2504.17768cs.CLcs.LG2025-04ACL被引 29

探索稀疏注意力在大模型中的效率与精度权衡,给出实际部署建议。

The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMs

论文配图:The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMs
图 1 · 摘自论文原文
  • 构建稀疏注意力分类体系,系统评估六种方法在不同场景下的表现。
  • 大模型用稀疏注意力可超越小模型性能,且长序列容许更高稀疏度。
  • 推理阶段的分页选择更可行,适合生产环境,需根据任务选策略。

稀疏注意力为扩展Transformer大模型的长上下文能力提供了有前景的方案,但其效率与准确性的权衡仍不清晰,主要因缺乏全面评估。本文开展了迄今为止规模最大的无训练稀疏注意力实证分析,评估了六种方法在多个模型家族和规模、长达128K token的序列以及高达0.95(即1/20注意力预算)稀疏度下的表现,覆盖九个不同任务。首先,我们基于四个设计维度对快速发展的稀疏注意力方法进行了分类。分析得出关键洞见:1)稀疏注意力有效——在相同计算成本下,更大的稀疏模型优于较小的密集模型,提升了帕累托前沿;2)对于所研究的无训练方法,在预填充阶段进行细粒度逐查询重要性估计不切实际——既因估算成本高,又因缺乏能将细粒度稀疏转化为实际加速的稀疏内核;因此必须在全局到词元与块到块选择间做任务依赖性权衡;而在解码阶段,词元到页面的选择变得可行,支持更好泛化和更高稀疏容忍度;3)更长序列可承受更高稀疏度,表明生产中使用固定预算的方法次优。这些发现为稀疏注意力部署提供实用指导,并为未来评估提出方法建议。代码已公开于 https://github.com/PiotrNawrot/sparse-frontier。

原文摘要 · Abstract (English)

Sparse attention offers a promising strategy to extend long-context capabilities in Transformer LLMs, yet its efficiency-accuracy trade-offs remain unclear due to the lack of comprehensive evaluation. We address this gap with the largest-scale empirical analysis to date of training-free sparse attention, evaluating six methods across multiple model families and sizes, sequences up to 128K tokens, and sparsity levels up to 0.95 (i.e., $1/20$ attention budget) on nine diverse tasks. We first organise the rapidly evolving landscape of sparse attention methods into a taxonomy along four design axes. Our analysis then yields actionable insights: 1) sparse attention is effective: larger sparse models outperform smaller dense ones at equivalent cost, improving the Pareto frontier; 2) for the training-free methods we study, fine-grained per-query importance estimation during prefilling remains impractical-due to both the cost of estimation and the lack of sparse kernels that translate fine-grained sparsity into wall-clock gains-forcing a task-dependent choice between global-to-token and block-to-block selection. Instead, during decoding, token-to-page selection becomes feasible, enabling better generalisation and higher sparsity tolerance; 3) longer sequences tolerate higher sparsity, suggesting that fixed-budget methods in production are suboptimal. Together, these findings provide practical guidance for deploying sparse attention and methodological recommendations for future evaluations. Our code is available at https://github.com/PiotrNawrot/sparse-frontier.

稀疏注意力大模型效率优化推理

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