arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.22575cs.LGcs.AI
收藏

S2O: 通过在线排列实现稀疏注意力的提前停止

S2O: Early Stopping for Sparse Attention via Online Permutation

Xiamen University(厦门大学)

Yu Zhang, Songwei Liu, Chenqian Yan, Sheng Lin, Beichen Ning, Fangmin Chen, Xing Wang

AI总结:

S2O通过在线排列实现稀疏注意力的提前停止,提高稀疏性上限并减少计算量,同时保持准确性。

摘要:

注意力与序列长度呈平方关系,从根本上限制了长上下文推断。现有的块粒度稀疏化可以减少延迟,但粗粒度的块设定了一个内在的稀疏性上限,即使经过精心设计,进一步改进也困难。我们提出了S2O,通过在线排列实现稀疏注意力的提前停止。受内存系统中虚拟到物理地址映射的启发,S2O重新审视并分解了FlashAttention的执行,使推断能够加载非连续的token,而不是原始顺序中的连续跨度。受注意力热图中细粒度结构的启发,我们将显式排列转换为一种在线、索引引导、离散加载策略;通过极轻的预处理和索引重映射开销,它将重要性集中在一小组高优先级块上。基于这种以重要性引导的在线排列加载,S2O进一步引入了提前停止规则:计算从高到低重要性进行;一旦当前块得分低于阈值,S2O就提前终止并跳过剩余低贡献块,从而提高有效稀疏性并减少计算,同时在受控的误差预算下。结果,S2O显著提高了实际稀疏性上限。在Llama-3.1-8B下,128K上下文中,S2O在匹配稀疏性下将单操作符MSE减少3.82倍,且在匹配MSE下将预填充计算密度减少3.31倍;同时,它保持了端到端的准确性,并实现了7.51倍的注意力加速和3.81倍的端到端速度提升。

英文摘要:

Attention scales quadratically with sequence length, fundamentally limiting long-context inference. Existing block-granularity sparsification can reduce latency, but coarse blocks impose an intrinsic sparsity ceiling, making further improvements difficult even with carefully engineered designs. We present S2O, which performs early stopping for sparse attention via online permutation. Inspired by virtual-to-physical address mapping in memory systems, S2O revisits and factorizes FlashAttention execution, enabling inference to load non-contiguous tokens rather than a contiguous span in the original order. Motivated by fine-grained structures in attention heatmaps, we transform explicit permutation into an online, index-guided, discrete loading policy; with extremely lightweight preprocessing and index-remapping overhead, it concentrates importance on a small set of high-priority blocks. Building on this importance-guided online permutation for loading, S2O further introduces an early-stopping rule: computation proceeds from high to low importance; once the current block score falls below a threshold, S2O terminates early and skips the remaining low-contribution blocks, thereby increasing effective sparsity and reducing computation under a controlled error budget. As a result, S2O substantially raises the practical sparsity ceiling. On Llama-3.1-8B under a 128K context, S2O reduces single-operator MSE by 3.82$\times$ at matched sparsity, and reduces prefill compute density by 3.31$\times$ at matched MSE; meanwhile, it preserves end-to-end accuracy and achieves 7.51$\times$ attention and 3.81$\times$ end-to-end speedups.

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

↑