What is context rot?

Short answer: It is accuracy drop from too much context, even when that content is still relevant and correct.

Unlike pollution, rot can happen without wrong or contradictory items. Packing more tokens into the window can dilute attention and degrade results. More is not always better; budgets and curation matter even for clean content.

Pollution covered what happens when a context window fills with content that’s actually wrong, stale, or contradictory. There’s a subtler and in some ways more surprising phenomenon sitting right next to it: a model’s accuracy can degrade even when everything in its context window is accurate, relevant, and non-contradictory, purely as a function of how much of it there is and where it sits. This is context rot, and it means “just add more good information” isn’t the safe default it intuitively feels like.

What Exactly Is Context Rot, as Distinct From Pollution?

Pollution is a quality problem: something in context is wrong or contradictory. Context rot is a quantity problem that shows up even with perfectly clean content: as a context window grows longer, a model’s ability to accurately use everything within it degrades, not because any individual piece is false, but simply because there’s more competing for the same limited reasoning capacity. Controlled research on this effect has consistently shown that effective context length, the amount a model can genuinely make full use of, falls well short of its stated maximum size, and that this gap gets worse, not better, as context grows.

This means a context window can be entirely free of pollution as defined in the previous chapter, no wrong facts, no contradictions, no irrelevant clutter, and still produce a measurably worse response than a shorter, more focused context would have, purely because of how much total material the model has to reason across at once.

What Is the “Lost in the Middle” Effect, and Why Does It Matter Here?

Controlled experiments placing relevant information at different positions within a long context found that a model reliably integrates information sitting near the beginning or the end of that context far better than information buried in the middle, even when the middle-positioned information was every bit as directly relevant to the question being asked. This isn’t a minor effect. In some of these experiments, the same fact produced meaningfully worse recall depending purely on where within the context it happened to be positioned, not because of anything about the fact itself.

This means position, not just presence, determines whether a piece of retrieved memory actually gets used well. Correctly retrieving the right fact isn’t the whole job if that fact then gets buried in the middle of a long context window where the model’s attention doesn’t reliably reach it.

Why Doesn’t Simply Adding More Relevant Context Reliably Make an Answer Better?

Every additional piece of context, even genuinely relevant context, adds something else for the model to weigh, and that weighing process has real limits, regardless of how technically large the stated context window is. Beyond some point, adding a fifth or sixth relevant fact doesn’t add proportional value, it starts trading off against the model’s ability to hold and reason clearly about the facts already there. This is why the “include everything relevant” instinct, already pushed back on earlier in this Part when discussing what deserves inclusion, isn’t just a budget-efficiency argument, it’s directly tied to genuine accuracy: a shorter, well-curated context frequently outperforms a longer one stuffed with additional, individually valid but collectively excessive material.

Does This Mean Long Context Windows Are a Mistake to Rely On?

Not a mistake, but not the solution to careful context engineering that they’re sometimes assumed to be. A longer window raises the ceiling on how much could theoretically be included, which is genuinely useful for some tasks that legitimately need to reason across a large amount of material at once. What a longer window doesn’t do is change the underlying dynamic where more content, even accurate content, competes for the same finite reasoning capacity. Treating a large context window as permission to stop being selective is exactly the mistake context rot punishes, since the window’s stated capacity and the model’s actual, effective ability to use everything in it are two different numbers, and the gap between them tends to widen as context grows.

How Does Weaviate Engram’s Design Help Minimize the Risk of Context Rot?

Weaviate Engram’s default behavior of extracting compact, atomic facts, and its retrieval API’s explicit limit parameter, both directly support keeping retrieved context small and precise rather than large and diffuse, which is exactly the discipline context rot rewards. Consider a fantasy-series continuity assistant helping a novelist keep canon details straight across a many-book series, where the underlying memory store could easily grow into thousands of individual facts about characters, locations, and plot threads over the course of a long series:

from engram import EngramClient

client = EngramClient(api_key=os.environ["ENGRAM_API_KEY"])

client.memories.add(
    "The enchanted blade Ashcaller can only be wielded by someone who has visited all three elemental shrines; established in book two, chapter fourteen.",
    properties={"series_id": "emberfall-saga"},
)

When the author is drafting a scene in book five involving this blade, the correct move is a tightly limited, highly specific search, not a broad retrieval of everything ever established about the series:

relevant_canon = client.memories.search(
    query="What are the requirements for wielding the Ashcaller blade?",
    properties={"series_id": "emberfall-saga"},
    retrieval_config=HybridRetrieval(limit=3),
)

Limiting this search to three highly specific results, rather than retrieving a broad swath of everything ever established about the series, is exactly what keeps this exact fact from getting buried in the middle of a long, diffuse context window alongside dozens of other less relevant canon details. If the author instead asked a genuinely broad question, say, reviewing every established magical item across the whole series before a major revision pass, a larger, more inclusive retrieval would be the right call for that specific, broader task. The lesson from context rot isn’t that more context is always wrong, it’s that more context is never automatically better, and the right amount has to be judged deliberately against what a specific question actually needs, exactly the discipline this whole Part has been building toward.

Context rot is about how much accurate content a model can actually make good use of. A related concern shifts from quantity to purpose: how retrieved context specifically helps prevent a model from confidently stating things that simply aren’t true, a mechanism worth understanding on its own terms. Our next chapter, How does grounding reduce hallucination?, turns to exactly that mechanism.