Hero Image full

Context Rot

7 min read
Content

What Is Context Rot?

Context rot is the gradual degradation of a language model's output quality as its context window fills with stale, contradictory, or irrelevant information over a long session. The model starts confusing old instructions with current ones, repeating abandoned approaches, and losing track of what actually matters, even though nothing about the model itself has changed.

Key Takeaways

  • Context rot is a property of the session, not the model. The same model that performed well at turn five can look incompetent at turn eighty with a polluted context.
  • The main causes are accumulated dead ends, contradictory instructions given at different points, and large tool outputs that bury the signal.
  • Bigger context windows delay rot but do not prevent it. Models attend unevenly across long contexts, so junk in the middle still degrades results. On the 2025 NoLiMa long-context benchmark, 11 of 13 tested models fell below 50% of their strong short-context baselines at 32K tokens, with GPT-4o dropping from 99.3% to 69.7% [1].
  • The fixes are operational: compact or summarize the session, start fresh with a distilled brief, and practice deliberate context engineering rather than letting history pile up.

How It Works

Every message, tool result, and file dump in a session stays in the context window and competes for the model's attention. Early in a session that history is mostly useful. Over time it accumulates failed attempts, superseded plans, error logs from problems already fixed, and instructions the user later reversed. The model has no built-in mechanism for marking any of that as obsolete. It sees one long transcript and weighs all of it.

Two effects compound the problem. First, models attend unevenly across long inputs, so relevant details buried mid-context get less weight than material near the start or end. Chroma's July 2025 report that named the phenomenon evaluated 18 models, including GPT-4.1, Claude 4, and Gemini 2.5, and found performance degrades consistently as input length grows, with even a single distractor in context reducing accuracy against baseline [2]. Second, contradictions accumulate: if the user said "use REST" at turn ten and "switch to GraphQL" at turn forty, both instructions sit in context, and under pressure the model sometimes reverts to the earlier one. The practical symptom is an agent that re-suggests an approach you rejected an hour ago, or edits a file using a version of it that no longer exists.

This is why agentic coding tools ship compaction features that summarize a session and discard the raw transcript, and why experienced practitioners treat session length as a budget. Agent memory systems exist partly to move durable facts out of the transcript and into storage that gets retrieved cleanly, instead of dragging the whole history forward.

Example

An engineer spends three hours in one session with an AI coding agent migrating a payment service. Early on, the agent explored a migration path using a compatibility shim, which the engineer rejected. Fifty turns later, asked to write the final cutover script, the agent quietly reintroduces the shim, because the exploration is still sitting in context and reads as prior art. The engineer notices, kills the session, and starts a new one with a five-line brief: current state, chosen approach, files involved, constraints, next task. The fresh agent produces the correct script on the first try. Same model, same task, clean context.

What People Get Wrong

The common mistake is assuming the model got worse mid-session, then switching models or filing a bug. Long-session degradation is almost always the context, not the weights. The test is cheap: restate the task in a fresh session with only the relevant facts. If quality snaps back, you were fighting context rot, and the fix is session hygiene rather than a different model.

FAQ

How do I know a session has rotted? Watch for the classic tells: the agent resurrects rejected approaches, contradicts its own recent statements, asks about things already settled, or edits files based on outdated versions. Any of these means the transcript is working against you.

Does compaction fix context rot? Mostly. Summarizing the session and dropping the raw history removes dead ends and stale tool output, which is where most rot lives. The tradeoff is that a bad summary can lose a load-bearing detail, so critical constraints belong in a CLAUDE.md-style standing file, not just the transcript.

Is context rot the same as running out of context window? No. Hitting the window limit is a hard capacity failure. Context rot degrades quality long before the limit, often when the window is only half full, because the problem is the content of the context rather than its size.

Sources

  1. Modarressi et al., arXiv (NoLiMa). "11 of 13 models dropped below 50% of short-context baselines at 32K tokens; GPT-4o fell from 99.3% to 69.7%." https://arxiv.org/abs/2502.05167. Accessed August 2026.
  2. Chroma Research. "Context Rot report: 18 models evaluated; performance degrades as input length grows, a single distractor reduces accuracy." https://www.trychroma.com/research/context-rot. Accessed August 2026.
Glossary pages

Related terms

No items found.
Internal links

Related Topics

No items found.
Let’s get in touch

Ready to build your product?

Book a consultation call to get a free No-Code assessment and scope estimation for your project.
Book a consultation call to get a free No-Code assessment and scope estimation for your project.