Context rot
Model quality drops as the context fills with old, irrelevant or conflicting material.
Context rot is the drop in a model’s answer quality as its context fills with old, irrelevant or conflicting material. Nothing errors and the window is not full, yet the model follows stale instructions, misses the detail that matters or repeats attempts that already failed. In agents it shows up as a session that was sharp an hour ago and is now going in circles.
Long agent sessions collect failed attempts, outdated file versions and logs. Models do not use long input evenly. Chroma’s Context Rot report tested 18 models, including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3, held task difficulty constant and varied only input length: performance grew less reliable as the input got longer. Passages that look relevant but are not (distractors) made it worse. An earlier study, Lost in the Middle (2023), found models use facts at the start or end of a long prompt more reliably than facts in the middle.
Context rot differs from hitting the context window limit: it starts well before the limit. The countermeasures all keep the context small. Start a fresh session per task, keep decisions in files, use compaction or clear old tool results, and hand noisy searches to subagents that return a short summary. A dynamic workflow applies the same idea to bigger jobs by giving each step its own clean context.
Sources
- Chroma: Context Rot: How Increasing Input Tokens Impacts LLM Performance trychroma.com
- arXiv: Lost in the Middle: How Language Models Use Long Contexts arxiv.org
Related terms
- Context window: The maximum number of tokens the model can read and write in one request.
- Compaction: Replacing the older part of a long conversation with a summary so the agent can keep going.
- Subagent: A separate agent run with its own fresh context, started by a main agent for one subtask.
- Context engineering: Deciding what goes into the model’s context, in what order and when, across a whole task.
- Dynamic workflow: An orchestration script the agent writes at run time. A runtime executes it, starting many subagents in phases and combining their results in code.
- Agent memory: How an AI agent keeps information beyond one conversation: notes, facts and preferences it saves and reads back later.
