arXiv:2605.15514cs.CLcs.AI2026-05被引 3

RoPE在长文本中无法区分位置和词元,理论证明其有效性会随上下文变长而崩溃。

RoPE Distinguishes Neither Positions Nor Tokens in Long Contexts, Provably

论文配图:RoPE Distinguishes Neither Positions Nor Tokens in Long Contexts, Provably
图 1 · 摘自论文原文
  • 从理论上证明RoPE在长上下文中失去局部性与一致性
  • 位置或词元变化时注意力分数不变,失败概率趋近随机
  • 现有模型结构无法弥补此缺陷,需新编码机制

我们揭示了旋转位置编码(RoPE)在基于Transformer的长上下文语言模型中的内在局限性。理论分析仅依赖于上下文长度,不依赖具体内容。证明当上下文长度增加时,RoPE注意力变得不可预测,并丧失两个核心有效性特征:一是局部性偏差消失,较远位置不再被弱化;二是词元相关性不一致,同一关键向量在不同位置可能得分反转。两种情况的失败概率趋近0.5,等同于随机猜测。进一步证明,当关键词元移位或替换为其他词元时,注意力分数保持不变,表明无法区分位置或词元。调整RoPE基值虽可提升词元区分能力,但必然牺牲位置区分能力。增大该超参数虽能更好区分词元,却不可避免削弱位置区分。实证分析显示,多头多层架构无法克服这些限制。研究暗示未来长上下文Transformer模型需引入根本性的新位置与顺序编码机制。

原文摘要 · Abstract (English)

We identify intrinsic limitations of Rotary Positional Embeddings (RoPE) in Transformer-based long-context language models. Our theoretical analysis abstracts away from the specific content of the context and depends only on its length. We prove that as context length increases, RoPE-based attention becomes unpredictable and loses two properties that are central to its effectiveness. First, it loses its locality bias: RoPE is no more likely to favor nearer positions than substantially farther ones. Second, it loses consistency in token relevance: a key vector that receives a higher attention score than an alternative at one position may receive a lower score at another. In both cases, the probability of failure approaches 0.5, no better than random guessing. We further prove that the attention score can remain unchanged when a key token is moved to a different position, or even replaced by a different token, indicating a failure to distinguish positions or tokens. Adjusting the RoPE base trades off distinguishing positions against distinguishing tokens but cannot preserve both at the same time. Increasing the RoPE base hyperparameter, a common practice in today's long-context models, helps distinguish different tokens, but inevitably sacrifices the ability to distinguish positions. Our empirical analysis shows that multi-head, multi-layer architectures are insufficient to overcome these limitations. Our findings suggest that fundamentally new mechanisms for encoding position and token order may be needed in future Transformer long-context language models.

位置编码Transformer长文本理论分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。