DTS:基于增量的分块评分用于高效长上下文稀疏注意力
DTS: Delta-Based Tile Scoring for Efficient Long-Context Sparse Attention
AI总结:
针对长上下文稀疏注意力的评分瓶颈,提出无训练的DTS方法,通过并行增量打包加速锚点选择,在LLaMA-3.1-8B-Instruct上实现评分延迟降低与预填充加速。
摘要:
大型语言模型(LLMs)日益需要处理长文档和代码库,使得长上下文注意力成为主要的预填充瓶颈。块稀疏注意力通过跳过注意力矩阵中不重要的块来减少计算,但对块进行准确评分本身可能代价高昂。我们提出基于增量的分块评分(Delta-Based Tile Scoring,DTS),这是一种用于稀疏块注意力的无训练、内容自适应分块评分方法。DTS根据局部向量变化选择查询和键锚点,在冗余区域使用更少的代表,同时在异构区域保留更多细节。为加速锚点选择,并行增量打包将查询和键序列划分为与分块对齐的块,并对这些块同时执行有界局部扫描。随后使用原始查询、键和值向量计算所选分块。在LLaMA-3.1-8B-Instruct上,DTS使RULER和LongBench的平均得分与全注意力的差距保持在0.10个百分点以内,其中RULER在最高128K token下进行评估。在128K token时,与XAttention相比,DTS将测量的评分流水线延迟降低了38%。在四块NVIDIA H100 GPU上,当token数为512K时,它实现了比使用FlashAttention-2的PyTorch全注意力基线高3.3倍的预填充加速。
英文摘要:
Large language models (LLMs) increasingly need to process long documents and codebases, making long-context attention a major prefill bottleneck. Block sparse attention reduces computation by skipping unimportant blocks of the attention matrix, but scoring blocks accurately can itself be expensive. We propose Delta-Based Tile Scoring (DTS), a training-free, content-adaptive tile scoring method for sparse block attention. DTS selects query and key anchors according to local vector changes, using fewer representatives in redundant regions while retaining more detail in heterogeneous regions. To accelerate anchor selection, parallel delta packing partitions the query and key sequences into tile-aligned chunks and performs bounded local scans over these chunks concurrently. The selected tiles are then computed using the original query, key, and value vectors. On LLaMA-3.1-8B-Instruct, DTS keeps average RULER and LongBench scores within 0.10 percentage points of full attention, with RULER evaluated up to 128K tokens. At 128K tokens, DTS reduces measured scoring-pipeline latency by 38% compared with XAttention. On four NVIDIA H100 GPUs, it achieves a 3.3$\times$ prefill speedup over a PyTorch full-attention baseline using FlashAttention-2 at 512K tokens.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。