RoPE Distinguishes Neither Positions Nor Tokens in Long Contexts, Provably

Yufeng Du, Phillip Harris, Minyang Tian, Eliu A Huerta, Srikanth Ronanki, Subendhu Rongali, Aram Galstyan, Hao PengarXiv 2026

TL;DR

Modern Large Language Models (LLMs) frequently advertise massive context windows, but their underlying positional mechanism—Rotary Positional Embedding (RoPE)—mathematically breaks down at scale. This paper provably demonstrates that as context length grows, RoPE-based attention suffers from severe "inversion" and "aliasing" failures, effectively reducing its ability to distinguish positions and tokens to random guessing.

What Problem Does This Paper Address?

Transformers are inherently permutation-invariant; they view text as an unordered bag of words unless we explicitly encode position. RoPE has become the industry standard for this task, utilized in state-of-the-art models like Llama 3, Mistral, and DeepSeek. It works by rotating pairs of dimensions in the query and key vectors at different frequencies, aiming to capture fine-grained local order via high-frequency oscillations and long-range relationships via low-frequency decay.

Despite advertised context windows reaching millions of tokens, practical implementations often fail at long-context tasks well within their theoretical limits. The authors of this paper investigate whether these failures are merely engineering bottlenecks or an intrinsic limitation of RoPE itself. They prove it is a fundamental mathematical flaw: in long contexts, RoPE fails at both position identification (knowing where a token is) and token identification (knowing what a token is).

Methods

The authors introduce a novel theoretical framework by treating the unnormalized attention score (the "RoPE product") as a normal random variable. By applying the Central Limit Theorem to the high-frequency components of RoPE, they model how the attention score's mean decays while its variance explodes as context length ($M$) increases.

Using this probabilistic approach, they mathematically define and prove four distinct failure modes:

  1. Position Inversion: The model favors a token farther away over the same token closer.
  2. Position Aliasing: Different distances yield identical attention scores.
  3. Token Inversion: The relative relevance ranking of two different tokens flips depending on their position.
  4. Token Aliasing: Replacing a key token with a completely different token leaves the attention score unchanged.

They validate these proofs empirically by analyzing a single attention head from Llama 3.1-8B and by testing full multi-head, multi-layer models on a synthetic retrieval task.

Datasets

To evaluate position identification without the confounding factor of complex language semantics, the authors design a synthetic indexing task.

The model is fed a Python list containing only four distinct integers (0, 1, 2, 3) stretched across various token lengths, followed by a query asking for the value at a specific index (e.g., arr[100]). They evaluate 100 random samples per context length across six popular open-source models:

  • Small models (≤ 8B): Llama-3.1-8B-Instruct, Mistral-7B-Instruct-v0.3, Qwen3-8B
  • Large models (≥ 100B): DeepSeek-V3.1, Kimi-K2.5, gpt-oss-120b

Key Insights and Ideas

  • The Chaos of High Variance: As context length scales up, the high-frequency oscillatory components of RoPE introduce massive variance into the attention scores, making the attention distribution highly unpredictable.
  • The Coin-Flip Limit: For both position and token inversion, the probability of failure approaches 0.5 as context length grows. This means the model becomes no better than random chance at maintaining locality bias or token rankings.
Oscillation and decay of the RoPE product as context length scales up.
  • Attention Invariance: Due to limited numerical precision (like BF16 or FP16 formats), tiny differences in attention scores are rounded away. This creates "aliasing," where swapping two tokens or moving a token to a completely different position results in the exact same attention output.
Figure 1: Position aliasing induces an attention invariance failure: there exist large numbers of positions where swapping two key tokens (dog, cat) keeps the attention output of a query token opet unchanged.
  • The Base Hyperparameter Trap: A common industry practice to extend context length is increasing the RoPE base hyperparameter ($B$). The authors prove this is a zero-sum game: increasing $B$ helps mitigate token inversion but actively accelerates position inversion, sacrificing the model's spatial awareness.

Key Results

  • Ubiquitous Aliasing in Production Models: Empirical testing on Llama 3.1-8B reveals that within a context of just 8K tokens, a staggering 75,000 pairs of positions exhibit position aliasing under standard BF16 precision.
Heatmaps showing the dense distribution of position aliasing pairs in Llama 3.1-8B.
  • The 4K Performance Cliff: In the indexing task, every single tested model—regardless of whether it was a lightweight 7B model or a massive 120B model—suffered a catastrophic drop in accuracy. While they achieved near-perfect accuracy at short lengths, performance plummeted to the random-guess baseline (25% accuracy) by the time the context reached just 4,000 tokens.

Limitations and Future Work

While the empirical results hold true for full-scale LLMs, the rigorous mathematical proofs in this paper are primarily derived for single-head attention. The authors acknowledge that real-world multi-head, multi-layer architectures provide some structural redundancy, though their experiments show this redundancy is insufficient to overcome RoPE's core limitations. Additionally, the proofs assume relatively uniform rotary amplitudes across dimensions, which may oversimplify trained models where specific attention dimensions dominate.

The authors conclude that engineering tweaks like scaling data or adjusting hyperparameters cannot bridge this gap. Instead, future long-context AI research must pioneer fundamentally new architectures for encoding position and token order.

Summary updated

BibTeX
@misc{du2026rope,
  author = {Yufeng Du and Phillip Harris and Minyang Tian and Eliu A Huerta and Srikanth Ronanki and Subendhu Rongali and Aram Galstyan and Hao Peng},
  title = {{RoPE Distinguishes Neither Positions Nor Tokens in Long Contexts, Provably}},
  year = {2026},
  eprint = {2605.15514},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.15514},
}

Loading related content...

Figure