论文

RiRoPE:把位置编码与稀疏注意力协同设计的原生训练方案

Native Position Reindexing for Sparse Attention

精选理由

如果你在做长上下文模型,这篇值得细看。同样是稀疏注意力,它把位置重排做进训练而不是像StreamingLLM只在推理时补丁,RULER得分差距拉开20分以上。研究LLM位置编码和长文本外推的工程师应该会感兴趣。

一项arXiv研究提出RiRoPE(ReIndexing RoPE),核心观点是稀疏注意力下每个query的实际上下文已经改变,位置编码不应沿用为稠密注意力设计的方案,而应与稀疏注意力协同设计。

正文

方法是在训练和推理阶段都将每个query选中的token按原顺序重新赋予连续位置,把相对距离限制在注意力预算内而非整个序列长度。与只在推理时做位置重排的StreamingLLM不同,该方法让模型在训练中主动适应这种依赖query的位置表示。

效率方面,query相关的旋转会破坏已旋转key的复用,作者用结构感知的旋转复用和融合kernel保留tensor-core矩阵乘法,避免逐对生成旋转后的key。实验基于OLMo-3-7B继续预训练:64K长度下比RoPE+YaRN的稀疏注意力基线在RULER上高6.

14分(74.10升至80.

24),HELMET高4.40分(42.

97升至47.37);

在512K(训练长度的8倍)下不经继续训练仍保留约90%的64K RULER得分;在256K下比仅推理时切换位置编码的方案高21.

24 RULER分。这项工作把稀疏注意力从单纯计算约束重新定位为长上下文建模的改进机会,对需要长上下文且控制推理成本的开源模型团队有直接参考价值。

原文 · arXiv cs.AI

Native Position Reindexing for Sparse Attention

Sparse attention typically inherits positional encodings designed for dense attention, despite changing each query's context. Although sparse attention bounds the number of attended keys, these encodings retain large original-sequence distances poorly covered or unseen during training. We argue that positional distances should instead be co-designed with sparse attention, letting long-range interactions share positional representations with short-range ones. To realize this co-design, we make position reindexing native to sparse-attention training: each query's selected tokens receive consecutive positions in their original order during both training and inference, limiting relative distances to the attention budget rather than the full sequence length. Unlike inference-time reindexing in StreamingLLM, native training lets the model adapt to these query-dependent positions rather than merely tolerate them. Applying this rule to rotary position encoding (RoPE) yields ReIndexing RoPE (RiRoPE). A challenge is that query-dependent rotations hinder reuse of rotated keys, erasing the efficiency gains of sparse attention; we address it with structure-aware rotation reuse and fused kernels that preserve tensor-core matrix multiplication without materializing per-pair rotated keys. With matched OLMo-3-7B continued pretraining, RiRoPE outperforms a sparse-attention baseline using RoPE with YaRN at 64K by 6.14 RULER points ($74.10 \to 80.24$) and 4.40 HELMET points ($42.97 \to 47.37$). At 512K---eight times the training length---it retains about 90\% of its 64K RULER score without further training or positional retuning. Native training also outperforms inference-only switching by 21.24 RULER points at 256K. Our work motivates co-designing positional encodings with sparse attention, reframing sparsity not merely as a computational constraint but as an opportunity for better long-context modeling.

产业坐标与信源核验

本条情报归属 AITOP「论文」核心栏目,重点聚焦北美前沿实验室与硅谷科技巨头。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:RiRoPE、RoPE、稀疏注意力、长上下文,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。

信源核验说明:本文原始线索采编自「arXiv cs.AI」(@Lei Zhu, Zexuan Qiu, Zhiwei Li, Zhongwei Wan, Tong Che, Huayang Li, Tian Liang, Hao Gu, Zhijiang Guo, Irwin King, Leo Liang),经 AITOP 多维评分管线结构化提炼。