Context rot is accumulation. Pollution is different: one bad item is enough, and it does not need to be old.
A retrieval returns a passage from the deprecated v1 API docs. A stale comment describes behaviour that changed last year. A failed approach sits in the history without being marked as failed. The model does not know any of it is wrong, so it reasons from it confidently and everything after that point inherits the error.
Why it is worse than a missing fact
A gap tends to produce hedging or a question. Pollution produces a confident, coherent, wrong answer, built correctly on a false premise. It is far harder to notice, because the output has all the surface features of a good one.
It also propagates. In a chain, the polluted step's output becomes the next step's input, so one bad passage at retrieval time can shape a whole trajectory.
Common sources
- Retrieval returning plausible-but-wrong material, especially outdated versions of documentation that still match the query well.
- Failed attempts left unlabelled in history. If a rejected approach is in the window with no marker saying it failed, it reads as context rather than as a dead end.
- Summaries that dropped a qualifier. Lossy compaction turning "this works only in staging" into "this works".
- Untrusted text treated as instruction, which is the pollution case that becomes prompt injection once someone does it on purpose.
Diagnosing it
The tell is a confident answer that is wrong in a *specific, sourceable* way. When output looks wrong, do not immediately reach for the prompt. Read the context that was actually assembled. Most of the time the bad premise is sitting there in plain text, and the prompt was never the problem.
Reducing it
- Precision at the top of the list. Reranking is the main lever, since fewer, better passages means less surface area for a bad one.
- Label provenance and recency. If a passage carries its source and date, the model can weigh a 2023 doc against a 2026 one. Unlabelled, it cannot.
- Mark failures as failures. One line saying "this approach failed because X" converts pollution into useful negative evidence.
- Clear rather than patch. Once a session is polluted, arguing with it rarely works. Restart from a clean statement of current state.
Related terms
Context rot
Context rot is the gradual decay of a long session as stale, superseded, and irrelevant text accumulates in the window. Nothing breaks at any single step, which is why it is usually diagnosed as the model getting worse.
Read definition →PatternProvenRetrieval-augmented generation (RAG)
RAG is the workhorse pattern of context engineering: retrieve the material relevant to a request, put it in the context, and let the model generate an answer grounded in it rather than guessing from memory.
Read definition →PatternProvenReranking
Reranking retrieves a generous set of candidates cheaply, then reorders them with a slower, more accurate model before any of it reaches the context. It buys precision at the top of the list without paying that cost across the whole corpus.
Read definition →ConceptGuardrail
A guardrail is a deterministic check that runs around a model call, on the way in or the way out, and refuses to pass something through. It is ordinary code enforcing what a prompt can only request.
Read definition →