Failure modesAntipatternProven

Context pollution

Also called: poisoned context, context contamination

Context pollution is one wrong or irrelevant thing in the window steering everything downstream of it. Unlike context rot it is not gradual: a single bad passage is enough, and the model treats it as given.

James Phoenix
Understanding Data Updated July 26, 2026

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.
Watch out
Adding "only use the provided sources" to the prompt does not fix pollution, because the polluted passage *is* a provided source. The fix is upstream, in what gets retrieved and how it is labelled.

Related terms

Engineering context for real systems?

Getting the right information into the window at the right time is most of the job. If you want that thinking applied to your product, that is what I do.

See how I can help