QASparse:面向查询自适应的稀疏注意力机制,按需分配预算与Token
QASparse: Query-Adaptive Sparse Attention with Tailored Budgets and Tokens
QASparse 提出一种查询自适应稀疏注意力机制,在保留跨注意力头共享重要性估计效率的同时,按查询需求调整计算预算与Token选择。其 Local Budget Regression 建模查询位置上的局部计算需求变化,Boundary Voting 用真实 query/key 分数对选择边界附近的候选进行投票细化。
arXiv:2611.29280v1 Announce Type: new Abstract: Long-sequence inference in large language models is constrained by the high cost of prefilling, where dense attention scales quadratically with context length. Exploiting similarity across attention heads offers a way to reduce redundant computation. Prior approaches in this direction have relied on localized query observations to determine head-level computation reuse or budget allocation. However, inter-head similarity does not imply uniform query requirements, leaving adaptation to varying budget needs and selection preferences across query regions a key challenge. We introduce QASparse, a Query-Adaptive Sparse attention mechanism with hardware-efficient execution. QASparse preserves the efficiency of shared cross-head importance estimation while adapting computational budgets and token selections to query requirements, and it executes these dynamic sparse decisions through dedicated kernels. Its query adaptivity stems from two complementary innovations: Local Budget Regression models local variations in computational demand along query positions to estimate budgets for different query regions and attention heads; Boundary Voting lets queries within each head vote over candidates near the selection cutoff using actual query/key scores, refining the retained set while preserving the initial selection size. To reduce the execution overhead of dynamic budgets, we further design length-specialized selection kernels that efficiently support query-adaptive sparse patterns across context lengths. Together, these designs efficiently combine shared estimation with local decisions while adapting both how much attention is computed and which interactions are retained. Experimental results demonstrate improved benchmark scores and faster prefill attention computation compared with existing sparse attention baselines.
来源:arXiv (AI + Vision + Imaging) · arxiv.org