Length Is Cheap, Competition Is Not: Attention Predicts Context Rot in Retrieval

Yinuo LiuarXiv 2026

TL;DR

Language models don't fail on long inputs simply because of length; they fail because of "competition" for attention. This paper demonstrates that while thousands of neutral tokens cost almost nothing in retrieval accuracy, just a few semantically similar distractors can cause total failure—a phenomenon perfectly predicted by the attention mass placed on the evidence.

What Problem Does This Paper Address?

As we feed Large Language Models (LLMs) increasingly massive amounts of data, we encounter a phenomenon known as context rot: the model's ability to retrieve specific information declines as the input grows.

For a long time, researchers have debated why this happens. Is it an architectural "tax" where every additional token slightly confuses the model's positional encoding? Or is it a content problem, where the model simply gets distracted by other information? Previous influential work suggested that length alone was the culprit by showing that even "masked" (invisible) tokens hurt performance. This paper challenges that "length-as-tax" narrative, arguing that the real enemy is competition for the model's limited attention.

Methods

The author introduces a "visible-control protocol" to isolate the effects of length versus content. The core task is a simple key-value retrieval (e.g., "The secret code of the river is 4821").

The researchers tested five open-weight models (ranging from 0.5B to 3B parameters) under four specific conditions while keeping the total length and evidence position fixed:

  1. Short: No filler text.
  2. Neutral: Filled with random numbers, words, or repeated sentences.
  3. Competing: Filled with statements that look like the evidence (same template) or even contradict it (same key, different value).
  4. Masked: Filler tokens are hidden from the attention mechanism but their position indices are preserved (replicating prior "length-only" studies).

Crucially, the study measures attention mass ($a^*$): the specific amount of "focus" the model's query token sends to the evidence tokens.

Datasets

The study primarily uses a custom-built synthetic key-value retrieval probe, generating 126,473 individual trials. This allowed for fine-grained control over distractors and "knowledge conflicts" (where a distractor provides a different value for the same key). To validate their findings against prior work, they also evaluated models on MMLU (Massive Multitask Language Understanding).

Key Insights and Ideas

  • Length is "Cheap": On models like Qwen2.5-1.5B, adding 32,000 tokens of neutral text resulted in almost zero loss in accuracy. The model is perfectly capable of "looking past" irrelevant noise.
  • Competition is the Killer: When the filler text matches the format of the evidence, accuracy plummets. If even one distractor uses the same "key" as the query (a conflict), the loss multiplies by up to 110x.
  • Attention is the Smoking Gun: The amount of attention mass left on the evidence is a far better predictor of failure than the length of the document. Inside the model, context rot is essentially "attention dilution."
  • The "Masking" Myth: Prior studies argued length hurts because masking tokens (making them invisible to attention) still caused performance drops. This paper shows that masking is a poor control because it creates "positional gaps" the model never saw during training, which confuses the model more than visible text does.
Figure 1: Retrieval accuracy against context length, with length and evidence position fixed. Neutral text left visible (green) costs almost nothing; the same text masked at preserved positions (blue) costs up to 47 points on Qwen2.5-1.5B; competing statements (orange) cost 56 to 87 points at every length. Mean over trials, pooled over the three neutral fillers; shaded bands are 95% bootstrap intervals.

Key Results

  • Accuracy Stability: With neutral filler, accuracy stayed between 0.97 and 1.00 across most models up to 4K tokens, and up to 32K tokens for Qwen2.5.
  • The Cost of Rivals: Filling the same space with competing statements drove accuracy down to between 0.11 and 0.21.
  • Predictive Power: The log of the attention mass ($log(1/a^*)$) explained up to 58% of the variance in loss, whereas the log of the context length explained at most 8%.
  • Threshold Effect: Models appear to tolerate losing about half of their attention mass before performance falls off a cliff.
Figure 2: Loss ∆(nats) against log(1/a∗) for 4,500 trials of Qwen2.5-1.5B with competing filler at 8K to 32K tokens, colored by length. Black: mean loss in 15 quantile bins of log(1/a∗). Lengths overlap completely, while attention orders the loss.

Limitations and Future Work

The author acknowledges several limitations:

  • Predictive, not Causal: The study shows that attention mass predicts loss, but it doesn't intervene on the attention mechanism to prove it causes the loss.
  • Model Size: The experiments focused on smaller models (up to 3B parameters). While they show the effect is consistent across families, it remains to be seen if massive 70B+ models behave differently.
  • Synthetic Tasks: The results are based on a synthetic retrieval task. While this is the standard for measuring "needle-in-a-haystack" performance, real-world reasoning tasks might involve more complex interactions between length and content.
  • Future Direction: The paper suggests that instead of just shortening contexts, developers should focus on "context engineering"—deduplicating and resolving conflicting statements before they ever reach the model.

Summary updated

Abstract

Why do language models fail on long inputs? The common answer is length. We show that, for retrieval, length is cheap and competition is not. On five open models (0.5B to 3B parameters, four families), neutral filler costs nothing: accuracy stays at 0.97 to 1.00, up to 32K tokens on Qwen2.5-1.5B. Statements in the format of the evidence, placed at the same positions, drop it to 0.16 to 0.33. A single statement that gives the queried key a rival value multiplies the loss by 9 to 110, and every additional rival adds to it. Inside the model, one quantity tracks the failure: the attention mass left on the evidence. Across 126,473 trials it explains up to 58% of the variance in loss; log length explains at most 8%. The masked-filler protocol behind the claim that length alone hurts reproduces on MMLU (11 to 18 points lost at 30K tokens), but fails a visible control in retrieval: masking costs 45 accuracy points at 32K tokens, while the same filler left visible costs none. In retrieval, context rot is a competition for attention. We release the probe and all 126K trial-level measurements.
BibTeX
@misc{liu2026length,
  author = {Yinuo Liu},
  title = {{Length Is Cheap, Competition Is Not: Attention Predicts Context Rot in Retrieval}},
  year = {2026},
  eprint = {2611.04169},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.04169},
}
Figure