# Context Rot: Why LLM Performance Degrades in Long Contexts — and How to Manage It

    Everyone celebrates bigger context windows, but "fitting" content is not the same as "using" it well. This article explains context rot — the gradual, hard-to-notice decline in model quality as context keeps growing — and traces it to a limited attention budget rather than storage capacity. It explains why gradual decay is more dangerous than a hard crash, why million-token windows shift complexity from capacity limits to context governance, and covers practical techniques: controlling relevance of injected content, compression and summarization, retrieval instead of dumping, placing critical information up front with reinforcement, and building observability for context hygiene. Readers will come away with a clear mental model of why more context can mean worse answers, and a concrete toolkit for spending a limited attention budget on what matters.

    Introduction: Bigger Windows, Same Problems

    In discussions of AI coding assistants and LLM applications, a larger context window is almost always treated as good news. Windows grew from tens of thousands of tokens to hundreds of thousands, and now past a million. Many people naturally assume that if you can fit more in, the model’s ability to follow long conversations, read large files, and run long tasks should improve along with it.

    Real engineering experience says the opposite. The window being able to hold something does not mean the model can use it well. As a session continues and context accumulates, model quality often quietly declines, and that decline is hard to notice. The industry has a name for this phenomenon: context rot. Understanding what it actually is matters more than blindly chasing a bigger window.

    1. What Is Context Rot

    Context rot refers to the degradation of model performance as the amount of context grows. The core mechanism is that the model’s attention gets spread across more and more tokens. Earlier content that has nothing to do with the current task starts to interfere, which dilutes the model’s ability to focus on what is actually important.

    It is worth stressing that this is a performance decline, not a functional collapse. The output stays coherent, the grammar stays correct, and the logic still holds together on the surface. What gets worse, bit by bit, is accuracy, relevance, and attention to detail. It is a gradual slide, not a sudden fall. That distinction matters enormously, because it determines whether you catch the problem early.

    Think of the context as a desk in front of the model. A bigger desk can hold more material, in theory. But a big desk does not mean you find things faster — the more spread out it gets, the longer it takes to dig a particular old notebook out of the pile. A model’s attention budget works the same way: every token you add takes a small share of the attention available for the current task.

    2. The Root Cause: Attention Budget, Not Storage Capacity

    To understand context rot, you need to separate two concepts that often get conflated: storage capacity and attention budget.

    The context window is often described as “memory capacity,” but that analogy is misleading. Humans have limited working memory. Even if you can hold a long conversation in your head, you cannot stay equally focused on every single sentence of it. Large language models have a similar “attention budget” — the effective reasoning resources they rely on when parsing massive amounts of context are finite.

    Which means:

    • Large capacity means you can “hold” more content.
    • Limited attention budget means the model cannot treat all of that content equally.

    When a pile of conversation history, repeated file content, and irrelevant intermediate results goes into the context, the information that is genuinely relevant to the current task ends up with a diluted share of attention. The result is a classic case of information overload: the model loses track of the main point, drops critical constraints, and even starts “forgetting” requirements you stressed a few turns ago.

    3. Why Gradual Decay Is More Dangerous Than a Crash

    If the model suddenly threw an error or crashed at some token threshold, you would actually have an easier time. You would know immediately that something went wrong and go investigate the context. What is genuinely difficult is gradual decay:

    • A crash is obvious. You get an alert right away and step in.
    • Rot is invisible. The output still “looks fine.”

    This gradual degradation leads developers to wrong conclusions. When answers are not accurate enough, you suspect your prompt is poorly written or your question is not clear enough — it rarely occurs to you that the real cause is context that has been “polluted” for too long. Over time, the team gets stuck in a loop of constantly tweaking prompts with little to show for it.

    So in long-context scenarios, actively managing context quality delivers far more value than endlessly expanding context quantity.

    4. Million-Token Windows: Capability or New Burden?

    A context window of a million tokens is roughly six to seven hundred thousand Chinese characters — about the length of three novels. That sounds great, but what it brings is not “less to worry about.” It adds a layer of judgment to every single turn.

    In the past, you had to decide “can this content fit in the window?” Now that the window is big enough, you have to decide: “Should I carry the entire history this time? Which content is noise that should be dropped? Have the critical constraints been buried in irrelevant information?”

    Put differently, scaling up the window did not remove engineering complexity — it moved complexity from a capacity constraint to context governance. Being able to fit something is one thing. Using it well is another.

    5. Engineering Practice: Making Long Context Actually Usable

    Once you understand the mechanism, you can design targeted countermeasures. The following approaches are widely accepted best practices in the industry.

    1. Control the relevance of what you inject

    Do not dump all history into the context indiscriminately. Prioritize information directly relevant to the current task and drop redundant intermediate steps.

    1. # Not recommended: concatenating everything
    2. context = all_history + current_query + all_files
    3. # Recommended: inject on demand
    4. context = (
    5. relevant_history(history, query, top_k=5) # keep only relevant history
    6. + task_spec # explicit task constraints
    7. + retrieved_snippets(query) # retrieved relevant snippets
    8. )

    2. Context compression and summarization

    Apply rolling summaries to earlier long conversations, compressing “verbatim records” into “distilled key points.” This preserves the thread of the task while freeing up attention budget.

    1. # Trigger summarization once a threshold is exceeded, instead of blindly truncating
    2. if token_count(context) > threshold:
    3. context = summarize(old_turns) + recent_turns

    3. Use retrieval instead of piling things up

    For large files and long documents, rather than reading everything in, use retrieval (RAG) to pull only the relevant snippets. In effect, this trades external, distributed storage for the model’s precious attention budget. In general cloud architectures, you can rely on object storage to hold the raw data, a retrieval service to handle recall, and message queues to decouple the pipeline, so that only the distilled results end up in front of the model.

    4. Put critical information up front and reinforce it

    Because irrelevant history interferes with attention, place the most important constraints, goals, and format requirements near the current task in a clearly structured position, and reinforce them moderately when necessary so they do not get buried.

    5. Build observability for context hygiene

    Pair this with monitoring and alerting to track per-request token counts, hit rates, and changes in output relevance. When quality starts to decline as context length grows, trigger a compression or reset strategy promptly.

    Conclusion: Decay Is Gravity, Not a Bug

    Context rot is not a bug you can fix once and be done with. It is more like gravity — as long as the conversation continues and the context keeps growing, it will happen. Real engineering skill lies not in how large a window you can build, but in whether you have a mature approach to context governance: controlling relevance, compressing proactively, retrieving on demand, and observing continuously.

    Once you internalize that “fitting it in” and “getting it right” are two different things, you can avoid a lot of detours in the long-context era — spending your limited attention budget on the information that matters most.