Context Rot: Why Longer Context Makes LLMs Forgetful and How to Manage It
This article explains Context Rot, the gradual decline in large language model performance as a conversation's context grows. It covers why a longer context spreads the model's attention thinner, how the problem shows up in practice, especially in AI coding assistants, and five practical ways to manage context, including keeping sessions focused, summarizing before starting a new session, and limiting inputs to relevant files.
1. A Common Puzzle: Why Does AI Seem to Get “Dumber” as a Chat Goes On?
Many developers have had a similar experience. They use an AI coding assistant to modify a function. In the first few rounds, it responds quickly, understands precisely, and makes fast, correct changes. After a dozen or so rounds, however, its behavior changes. It starts apologizing repeatedly, making the same mistakes, and fixing one problem while breaking another. It resembles a colleague who has had two drinks and still insists they can keep working.
The first reaction is often, “Did I fail to explain something clearly?” Most people doubt themselves many times over. The real cause is usually not that, though. The context accumulated in that session (a session is one complete conversation) has already rotted.
The industry has a name for this: Context Rot. Understanding it is a prerequisite for using large models effectively.
2. What Context Is: A Desk That Keeps Filling Up
Context is everything a model can “see” during a single inference: user messages, model replies, files it has read, tool call results, and more. All of it is concatenated and placed in the same window.
Think of it as a desk in the model’s mind. Mainstream models now have very large desks, with windows that often span hundreds of thousands or even millions of tokens. In Chinese text, that is roughly the length of several full-length novels.
That sounds appealing. A window can hold an entire codebase, a full requirements document, and hundreds of conversation turns. In practice, being able to fit something in the window is one thing. Using it well is another.
3. The Nature of Context Rot: Gradual Decline, Not a Crash
A widely cited description holds that as context grows, model performance declines. Attention gets spread across more tokens, and old, irrelevant content starts to interfere with the current task.
The key distinction is this: the decline is gradual, not a crash.
Performance slides downward slowly rather than falling all at once. A sudden fall is immediately noticeable, but a slow slide is almost invisible. That is what makes context rot dangerous. You will not see a clear error message. You will only notice output quality quietly getting worse. Answers become vague, earlier agreements are forgotten, and mistakes that were already corrected reappear.
For this reason, context rot is not a fault that can be fixed the way a bug is fixed. It is a process that inevitably occurs as long as the conversation continues. Rot is gravity, not a bug.
4. Why Rot Happens: The Physical Limits of the Attention Budget
Why does this happen? The industry often uses an analogy. Human working memory is limited, and large models likewise have an “attention budget” that is consumed continuously as they parse large amounts of context.
My take is this: a bigger desk does not mean you can spread out more things and still find what you need.
- Each additional stack of papers adds a few seconds to finding your earlier notes.
- The bigger the desk, the more your organizing skills are tested, because you have to remember what is in each corner.
- Models work the same way. Each additional token takes a small share of attention.
Mechanically, attention is computed across all tokens. The longer the context, the smaller the share of attention allocated to the information that is actually relevant to the current task. Failed attempts from dozens of turns earlier, outdated code versions, and abandoned solution discussions all still occupy space on the desk and keep generating noise.
So a one-million-token window does not make your work easier. With every turn, you have to make one more judgment: Is the current context still clean?
5. Strategies: Manage Actively Instead of Piling Up Material
Since rot is an inevitable pattern, the goal is not to eliminate it but to manage it. The following practices have proven effective:
1. Keep sessions short and focused, and avoid following a single path indefinitely
Limit each session to one relatively self-contained task. When the task is complete or the direction changes, start a new session instead of endlessly extending an old conversation. Use a context summary as the bridge rather than carrying dozens of turns of stale history.
2. Use context compression and summarization
Many AI coding tools offer compression, summarization, or “handoff” features. They distill the key conclusions, agreed-upon plans, and current progress of a long conversation into a concise context, then open a new session. This is like clearing the desk and keeping only the most important checklist.
3. Subtract inputs, and do not feed in the entire repository
Provide only the files and code snippets relevant to the current task. Context quality matters far more than quantity. Ten precise files are worth more than a hundred “just in case” documents.
4. Anchor key information in long sessions
Restate important constraints, coding conventions, and settled decisions periodically, in concise form, to counteract attention dilution.
5. Watch for signs of degradation and cut losses early
When the model frequently forgets earlier agreements, repeats mistakes, or gives hollow answers, do not keep spending effort on corrections. Restart the session. A cycle of apologizing, fixing, and apologizing again is a classic sign of rot.
6. Closing Thoughts
Larger context windows are real technical progress, but they do not remove the underlying engineering problem. A window solves the problem of fitting more in. The results depend on how well that context is managed.
Treat a large model as a capable colleague with limited working memory. Give it clean information, clear tasks, and timely summaries, rather than a desk piled with scrap paper. Once you understand Context Rot as a kind of physical law, you have cleared a conceptual hurdle that many users have not yet crossed. The quality difference across long conversations does not come down to luck. It comes down to context management.
