Why Does AI Get Dumber with Longer Context? Unpacking Context Rot
A Problem Every Engineer Has Hit You feed Claude or GPT-4 a 100-page document and ask it to extract a specific number from section 8. The answer is wrong. Yo…

A Problem Every Engineer Has Hit
You feed Claude or GPT-4 a 100-page document and ask it to extract a specific number from section 8. The answer is wrong. You paste just that section — perfect accuracy. The model didn't get dumber. Its attention got diluted. This is Context Rot.
At SFD Lab, our 13-agent collaboration pipelines regularly generate 50K+ token contexts. We've hit this wall enough times to write it up properly.
What Is Context Rot?
Context Rot describes what happens when increasing context window size causes a model's retrieval accuracy for middle-positioned information to degrade significantly — even when that information is explicitly present in the prompt.
Researchers call this the "Lost in the Middle" problem. A Stanford study confirmed it: critical information placed at the beginning or end of a prompt yields dramatically better recall than the same information buried in the middle — accuracy drops of 20-30% are common.
Three Degradation Mechanisms
1. Positional Bias
Transformer attention computes similarity scores across all tokens, but positional encodings (RoPE, ALiBi, Sinusoidal) introduce weight biases by position. Tokens near the start and end have shorter gradient paths through multi-layer attention, meaning their signals decay less.
# Simplified: effective attention weight at position i
effective_attention(i) = raw_attention(i) * position_decay(i)
# position_decay is systematically lower at middle positions2. Attention Dilution
Imagine a model's attention heads have a fixed "attention budget." Expanding context from 4K to 128K tokens means each token's average share of that budget shrinks from 1/4000 to 1/128000 — a 32x dilution. Information that would have stood out in short contexts gets buried.
3. KV Cache Compression Side Effects
To run long-context inference in limited VRAM, engineers use KV cache compression (StreamingLLM, H2O, etc.). These methods drop "unimportant" KV pairs — but importance is judged by past attention scores, which systematically favor recent tokens. This creates a feedback loop that amplifies recency bias.
Our Test Results
We embedded the same API doc section at different positions and asked: "What is the rate limit for this endpoint?"
| Position | Accuracy | Avg Latency |
|--------------|----------|-------------|
| Top 10% | 94% | 1.2s |
| Middle 40-60%| 61% | 1.8s |
| Bottom 10% | 89% | 1.3s |A 33-point accuracy drop for middle-positioned content. Unacceptable in production.
Engineering Mitigations
Strategy 1: Front-Load Critical Information
Put your most important instructions, constraints, and key data at the very start of your system prompt — not buried after pages of background. SFD Lab's agent prompts follow "Critical instructions → Background → Examples" order, never the reverse.
Strategy 2: RAG Over Full-Document Injection
Instead of injecting 100 pages, use vector retrieval to pull only the top-3 relevant chunks. We've converted all our PRD and API docs into a vector store. Retrieval-augmented generation consistently outperforms raw context injection for long documents.
Strategy 3: Map-Reduce Summarization
Summarize long documents in segments first, then process the summaries. Primitive but robust — our go-to for processing research reports in the content pipeline.
Strategy 4: Explicit Attention Anchors
Insert explicit cues like "Pay close attention to the following section:" before critical content in long prompts. Studies show this boosts retrieval accuracy by 15-20% by artificially elevating the attention score for that region.
Where the Industry Is in 2026
Gemini 1.5 Pro advertises 1M token context, but independent benchmarks still show meaningful middle-position degradation beyond 256K. Claude 3.7 introduced dynamic attention windows that give higher weight to user-flagged "important" sections — but this requires explicit user tagging, it's not automatic.
The most promising research direction: sparse attention + content routers. Rather than every token attending to every other, a lightweight classifier first identifies which tokens are "worth attending to" before the expensive attention pass. The architectural similarity to MoE sparse routing is not coincidental.
SFD Lab Note
The most painful version of this problem for us was cross-session context accumulation. Our task tracker was injecting full task history into agent prompts. By day 5, some agents had 80K+ token prompts and were silently ignoring early instructions.
Our fix: the tracker only surfaces tasks from the last 7 days in active prompts. Older tasks get archived and excluded. Context Rot isn't unsolvable — it requires intentional information architecture to fight it.