Native Position Reindexing for Sparse Attention
Lei Zhu*, Zexuan Qiu*, Zhiwei Li*, Zhongwei Wan, Tong Che, Huayang Li, Tian Liang, Hao Gu, Zhijiang Guo, Irwin King, and Leo Liang
arXiv preprint arXiv:2611.37952, 2026
Sparse attention typically inherits positional encodings designed for dense attention, despite changing the context available to each query. Sparse attention bounds the number of attended keys, but these encodings can retain large original-sequence distances that are poorly covered or unseen during training. We argue that positional distances should instead be co-designed with sparse attention to improve long-context modeling by allowing long-range interactions to 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, ignoring the gaps left by unselected tokens. Reindexing limits relative positional 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 reassigned, query-dependent positions rather than merely tolerate them. Applying this indexing rule to the commonly used rotary position encoding (RoPE) yields ReIndexing RoPE (RiRoPE). However, a technical challenge is that query-dependent rotations hinder reuse of rotated keys, erasing the efficiency gains of sparse attention in naive training implementations. We address this challenge 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 approximately 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 a shift from inheriting positional encodings to co-designing them with sparse attention, reframing sparsity as not merely a computational constraint but an opportunity for better long-context modeling.