arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.30554cs.LG
收藏

远近注意力:面向长上下文大语言模型解码的区域感知稀疏检索

Near-Far Attention: Region-Aware Sparse Retrieval for Long-Context LLM Decoding

University of Science and Technology of China(中国科学技术大学)

YuanShuo Wang, Jianchao Tan, Lei Gong, Teng Wang, Wenqi Lou, Xuehai Zhou

AI总结:

该研究针对长上下文LLM解码的稀疏注意力开销问题,提出远近注意力(NFA),通过轻量门控估计器、无校准子空间提取器和距离感知两级选择器,在保持任务质量的同时实现显著加速。

摘要:

稀疏注意力可降低长上下文解码的成本,但token选择会引入额外的评分与排序开销;此外,均匀页面评分忽略了近、远上下文之间的相关性差异。我们提出远近注意力(Near-Far Attention, NFA),该方法在保持候选评分轻量化的同时,使检索适配区域注意力模式。在预填充阶段,轻量门控估计器可识别解码过程中可跳过的区域,仅为密集预填充时间增加不到1%的开销;对于剩余区域,无校准子空间提取器提供页面级与token级评分共享的紧凑特征,无需离线校准;距离感知两级选择器则对近、远页面进行差异化评分,并在共享预算下联合排序候选token。在多个模型家族、参数规模及GQA/MLA架构上的评估显示,NFA的整体任务质量与全注意力相当;在512K上下文长度的Qwen3-8B模型上,NFA实现了最高5.49倍的算子加速和2.97倍的全模型解码加速(含选择开销)。

英文摘要:

Sparse attention reduces the cost of long-context decoding, but token selection introduces additional scoring and ranking overhead. Moreover, uniform page scoring overlooks differences in relevance between near and far context. We propose Near-Far Attention (NFA), which adapts retrieval to regional attention patterns while keeping candidate scoring lightweight. During prefill, the Lightweight Gate Estimator identifies regions that can be skipped during decoding, adding less than 1% to dense-prefill time. For the remaining regions, the Calibration-Free Subspace Extractor supplies compact features shared by page-level and token-level scoring without offline calibration. The Distance-Aware Two-Level Selector then scores near and far pages differently and jointly ranks candidate tokens under a shared budget. Evaluations across model families, parameter scales, and GQA/MLA architectures show aggregate task quality comparable to full attention. On Qwen3-8B at 512K context length, NFA achieves up to $5.49\times$ operator speedup and $2.97\times$ whole-model decoding speedup over FlashInfer, including selection overhead.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑