Open a new chat and ask one clear question. The answer is often sharp.
Now paste in forty pages of documents first, then ask the same question. The model may skip a detail, lose an instruction, confuse two similar passages, or answer with confidence even though the evidence is right there in the prompt.
You gave it more information. It had more room to work. Yet the result got worse.
That pattern has a name: context rot.
Context rot is the observed, task-dependent decline in a language modelās performance as the amount of input grows, even when the task is held broadly constant and the model remains below its advertised context limit. It is not the same as running out of tokens, truncation, or a broken prompt. The model may accept the input successfully and still use it less reliably.
The important qualification is that context rot is not one universal curve. Different models, tasks, positions, distractors, evaluators, and quality thresholds produce different results. A model may retrieve one fact from a very long document and still struggle to compare ten scattered clauses across that same document.
This article explains what the research actually shows, why popular long-context benchmarks can look better than real work, how to measure an effective context window for your own system, and when to choose long context, RAG, external memory, or a hybrid design.
Key takeaways
Click any topic to expand or collapseContext Window Capacity vs. Quality
A large context window is a capacity limit, not a quality guarantee. Long-context performance depends on the model, task, position of evidence, distractors, and scoring rule.
NoLiMa Benchmark Insights
NoLiMa exposed the weakness of literal matching. In its evaluation, 11 of 13 tested models fell below half of their short-context baseline at 32K tokens; GPT-4o fell from 99.3% to 69.7% under that benchmarkās conditions.
RULER vs. Lost in the Middle Metrics
RULER and Lost in the Middle measure different problems. Do not collapse retrieval, multi-hop reasoning, aggregation, and position bias into one ālong-context score.ā
RAG Status and Relevance
RAG is not automatically obsolete. Retrieval can reduce noise, improve provenance, enforce permissions, and control cost; long context can simplify bounded-document workflows.
Effective Window Measurement
Measure your own effective window. The useful number is the longest input at which your model still meets your quality floor on your real tasks.
Context Engineering Approach
The practical fix is context engineering. Select, compress, externalize, isolate, and verify context instead of filling the window by default.
What Is Context Rot?
Context rot is a practical name for a measurable performance problem: as the input becomes longer, the model becomes less reliable at the same or a closely matched task.

The phrase became widely associated with Chromaās Context Rot report, which evaluated 18 language models across controlled tasks. The report deliberately kept task complexity constrained while varying input length. Its central finding was not that every model failed at exactly the same point. It was that performance became non-uniform and degraded as the input grew, often before the advertised maximum was reached.
That distinction matters. A context window answers:
How many tokens can the system accept?
Context rot asks a different question:
How much context can the model use reliably for this task?
Those numbers are related, but they are not interchangeable.
What context rot is not

Context rot is not simply:
- A full context window: quality can decline before the limit.
- Truncation: the model may receive the entire prompt and still miss relevant information.
- A synonym for hallucination: hallucination can happen in short prompts too, although long or conflicting context may increase the risk of confident errors.
- Proof that long context is useless: long context can be the simplest choice for a bounded document or a task where global access matters.
- A single model defect: the effect varies by model family, task, prompt construction, distractors, and evaluation method.
Anthropicās engineering guidance on context engineering makes a similar operational point: context should be treated as a finite resource with diminishing returns. Its āattention budgetā language is a useful engineering model, not a standardized scalar that can be read from an API.
Why the Context Window Number Misleads
A vendorās context length is usually a maximum supported input size. It does not promise uniform attention, equal retrieval accuracy at every position, or strong multi-document reasoning at the limit.

The same distinction appears in other systems. A database may accept a very large query, but that does not mean the query plan will remain efficient. A filesystem may hold millions of files, but that does not make every file equally discoverable. Capacity and usability are different properties.
Long-context evaluation also has a measurement problem. If a benchmark hides a sentence that shares the same vocabulary as the question, the model may solve the task through lexical matching. That is useful evidence of retrieval under that construction. It is not enough evidence of flexible comprehension.
The original Needle in a Haystack test harness remains useful as a stress test. But a single needle task should not be treated as a complete long-context evaluation. For a working taxonomy of these benchmark families and a step-by-step protocol for designing your own test, see our guide to Long-Context LLM Benchmarks.
Near-perfect needle retrieval means the model solved that retrieval task under that prompt construction. It does not establish that the model can synthesize scattered evidence, resolve contradictions, respect permissions, or maintain a long-running agent state.
NIAH, NoLiMa, RULER, and Lost in the Middle: What Each Benchmark Measures
These benchmarks are not interchangeable. The most useful question is not āWhich model wins in a long context?ā but āWhich failure mode does this evaluation expose?ā
| Evaluation | What it tests | Useful signal | What it cannot prove |
|---|---|---|---|
| Needle in a Haystack | Finding planted information in long distractor text. | Basic retrieval and sensitivity to length or needle position. | Broad comprehension or reliable synthesis. |
| NoLiMa | Retrieval when question and needle have minimal literal overlap. | Whether lexical matching is doing too much of the work. | General reasoning across every document type. |
| RULER | Multiple needles, tracing, aggregation, and other long-context tasks. | A broader view than one-fact retrieval. | Your production workload unless you reproduce its conditions. |
| Lost in the Middle | How answer position affects multi-document QA and key-value retrieval. | Position sensitivity and the U-shaped accuracy pattern. | A universal law for all current models and prompts. |
What NoLiMa changed

NoLiMa modifies the familiar needle setup by reducing the literal overlap between the question and the relevant passage. That removes an easy shortcut.
The paper evaluated 13 models claiming at least 128K-token contexts. At 32K tokens, 11 models fell below half of their strong short-context baselines on the benchmark. GPT-4o, one of the stronger exceptions, dropped from a 99.3% short-context baseline to 69.7% at 32K.
Those are important figures, but they need the label on NoLiMaās benchmark. They are not a universal capability score for GPT-4o, and they do not tell you how the same model will behave on your contracts, codebase, or support tickets.
What RULER added

NVIDIAās RULER benchmark evaluates 17 long-context language models across 13 tasks, including multi-needle retrieval, tracing, and aggregation. Its motivation is straightforward: a model can perform well on vanilla NIAH and still struggle when the task requires more than locating one matching phrase.
RULER reported that only about half of the models claiming at least 32K tokens maintained its benchmark-specific satisfactory-performance threshold at 32K. That threshold is part of RULERās methodology. It should not be treated as a universal physical definition of an effective window.
What Lost in the Middle showed

The Lost in the Middle study moved relevant information through a long input and measured performance on multi-document question answering and key-value retrieval. Accuracy was generally stronger when the relevant information appeared near the beginning or end and weaker when it appeared in the middle.
The āU-shaped curveā is a useful design warning. It does not mean a model literally reads the first part and then forgets the middle like a human skimming a report. That is a metaphor for a measured position effect, not a complete mechanism.
A 2026 preprint, Lost in the Middle at Birth, proposes an architectural explanation for position bias at initialization. It is a single arXiv preprint, not an established consensus. Treat it as an interesting hypothesis that requires replication, not as the final explanation for every long-context failure.
The Three Taxes on a Long Prompt
The following framework is an editorial diagnostic, not a formal scientific decomposition. It is useful because different failures require different interventions.

1. The length tax
More tokens mean more material for the model to process, compare, and keep relevant. Even if the correct passage is present, extra context can make the task harder. The size of this effect depends on the model and workload.
2. The position tax
The same evidence can be easier to use at one position than another. Critical information buried in the middle may compete poorly with instructions at the beginning and the latest user request at the end.
3. The distraction tax
A plausible but wrong passage is more dangerous than irrelevant noise. It resembles the answer, competes for attention, and can create confident errors. Chromaās controlled distractor experiments found model-specific degradation and different abstention behavior in the tested models.
Diagnostic Rule
Click to expand or collapse detailsRAG Optimization vs. Top-K Trade-off
If you retrieve more passages, you may reduce the chance of missing evidence while increasing both the length and distraction taxes. That trade-off is why āincrease top-kā is not a universal RAG fix.
Improve retrieval quality, reranking, document structure, metadata, and query routing before assuming that more context is better.
How to Measure Your Effective Context Window
There is no universal token number that is āsafeā for every task. Measure the point at which your own system stops meeting a pre-declared quality floor.
Use this protocol:
- Choose a real task set. Include lookup, comparison, aggregation, contradiction resolution, and abstention cases if your product needs them.
- Create paraphrased questions. Avoid copying distinctive words from the source document. Otherwise, you may accidentally build a second needle-in-a-haystack test.
- Hold the task constant. Increase surrounding context in steps while keeping the underlying answer and scoring rule stable.
- Test position. Put the relevant evidence near the beginning, middle, and end.
- Add controlled distractors. Use one plausible wrong passage, then several, and record confident-error rate separately from abstention.
- Set the quality floor before testing. For example, 85% answer accuracy, 95% citation precision, or a domain-specific cost of error. The number must match your use case.
- Record more than accuracy. Track citation support, abstention, latency, input tokens, output tokens, cost, tool failures, and manual corrections.
- Repeat across model versions. A model alias or provider update can change the curve.
This is an editorial heuristic, not a standardized benchmark. It describes the share of the advertised window that remains usable for your chosen task and quality floor.
You can express the result as an effective-window ratio:
Effective-window ratio = longest acceptable input length Ć· advertised context length Ć 100
The ratio is useful for planning, but it is not a property of the model in isolation. A model may have one ratio for single-document extraction and another for multi-document aggregation.
Long Context vs. RAG: Which Should You Use?
The āRAG is deadā debate asks the wrong question. The real choice is how much information should enter each model call, how fresh and traceable that information must be, and where authorization should be enforced.
Long context is often a good fit when you have one bounded document, need broad access to its contents, have modest concurrency, and can tolerate sending a large prompt. RAG is often a better fit when the corpus is large, changes frequently, must be cited, contains permissions, or includes many documents that are irrelevant to most queries.
A hybrid design is common: retrieve a small candidate set, rerank it, include the strongest evidence, and allow the model to request more context only when necessary.
| Workload condition | Good starting point | Why | What to measure |
|---|---|---|---|
| One document, moderate length, one-off analysis | Long context | Less infrastructure and fewer retrieval misses. | Answer quality, latency, and total token cost. |
| Large, changing, or fragmented corpus | RAG | Selects evidence and supports updates without sending everything. | Recall, precision, reranking, freshness, and answer grounding. |
| Sensitive enterprise documents | Permission-aware RAG | Authorization must happen before content enters the prompt. | ACL correctness, leakage tests, provenance, and audit logs. |
| Long-running agent or coding session | Hybrid context engineering | Use compaction, notes, on-demand tools, and isolated sub-agents. | Task success, drift, tool-output size, recovery, and cost. |
For the retrieval side, see Vertex Frontierās guide to advanced RAG data preprocessing and retrieval. The important point is that chunking and metadata do not automatically make an answer correct; they improve the evidence available to retrieval and must be evaluated as part of the whole pipeline.
When the corpus is confidential, semantic relevance is not authorization. A relevant chunk that a user is not allowed to see must never enter the model context. See document-level access control in RAG and this guide to secure enterprise RAG architecture for that boundary.
Context Engineering: The Practical Fix
Prompt engineering asks how to phrase instructions. Context engineering asks what the model should see now: instructions, tool descriptions, retrieved evidence, memory, user history, state, and observations.

Anthropic describes context engineering as curating the smallest useful set of tokens for the desired behavior. A practical taxonomy is:
Write
Put durable information somewhere outside the active transcript: a project brief, decision log, task state, database record, or structured note. Do not make the model rediscover the same facts in every turn.
Select
Choose only the files, passages, tool results, and memories that matter for the next decision. Retrieval, metadata filters, reranking, and just-in-time file inspection all belong here.
Compress
Summarize older turns, remove repeated tool output, and retain decisions, unresolved issues, constraints, and evidence. Compaction is useful, but aggressive compression can delete details that become important later.
Isolate
Give separate tasks or specialists separate windows. A sub-agent that returns a concise verified result may be more useful than one agent carrying the entire project transcript.
Verify
Do not let a modelās statement that āthe task is completeā count as proof. Check tests, citations, file changes, permissions, output schemas, and user-facing behavior independently.
For the system layer around these decisions, read Vertex Frontierās Harness Engineering guide for reliable AI agents. A harness adds tools, state, execution boundaries, policies, observation, and verification around the model. It is not merely a longer prompt.
Context Budget Breakdown
Click to expand or collapse detailsA compact context budget to test
Use percentages as a starting hypothesis, not a universal standard:
- 10% Instructions and output contract
- 55% Selected evidence
- 20% Compacted working state
- 10% Decisive question or passage near the end
- 5% Reserve for headroom
The exact allocation will vary. The point is to make the budget explicit and testable rather than allowing every retrieved passage and tool output to compete equally.
Three Documented Lessons

NoLiMa: remove the shortcut before trusting the score
NoLiMaās challenge was simple: if the question and the hidden evidence share obvious words, the benchmark may reward matching rather than flexible association.
The studyās 13-model evaluation showed substantial degradation as context grew under its low-overlap construction.
The lesson is not that every model fails at 32K. The lesson is that your evaluation should remove shortcuts that your production workload does not provide.
Practical change: paraphrase evaluation questions, include indirect references, test distractors, and score unsupported confidence separately from correct answers.
Chroma: simple tasks can still be length-sensitive
Chromaās report tested 18 models with several controlled tasks, including semantic needle variants, conversational question answering, and a repeated-word replication task. It also examined distractors and different haystack structures.
The report is valuable because it avoids claiming that the models were solving a full enterprise workload. The tasks were intentionally simple. If performance changes even under those controls, production tasks involving synthesis, ambiguity, tools, and multiple steps deserve their own evaluation rather than a confident extrapolation.
One surprising observation was that shuffled haystacks sometimes performed better than logically ordered passages in the tested setup. Chroma reports the observation but does not claim to know why. That is exactly how the result should be used: as a reason to test document structure, not as a reason to destroy structure in production.
Recursive Language Models: make the document a variable
Recursive Language Models take a different approach. Instead of placing an enormous document directly into one model call, the long input is treated as an external variable. The model writes code to inspect slices and delegates parts of the work to smaller clean contexts.
The paper reports striking results on aggregation tasks, including a smaller model outperforming a larger plain-context setup under specific benchmark conditions. That does not make recursive language models production-ready by default. It introduces more orchestration, more calls, more failure modes, and more latency.
A reported reproduction is a useful warning: baseline runtime was about 3.6 seconds, recursion depth one about 89.3 seconds, and depth two about 344.5 seconds in the cited setup. More recursion was not automatically better.
The transferable idea is narrower and more useful: do not force one model call to carry an entire corpus when the task can be decomposed into inspectable pieces. Vertex Frontierās guide to recursive language models covers the mechanism and its safety limits in more detail.
Cost: Long Context Is Also a Budgeting Decision
Long prompts can increase cost simply because there are more input tokens. Some providers also use thresholds or different rates for larger prompts. These prices change, so treat the following as dated examples rather than permanent facts.
As of September 2026, OpenAIās published pricing lists GPT-5.6 Sol at $4 per million input tokens and $20 per million output tokens below its documented 272K threshold. Prompts above that threshold are billed at 2Ć input and 1.5Ć output for the full request, according to the official OpenAI pricing page.
Google also publishes model-specific pricing tiers on its Gemini API pricing page, including thresholds for some long-context models.
Anthropic documents different pricing behavior for its current model families; check the current Claude pricing documentation before comparing providers.
These pricing schedules do not prove that vendors believe quality is worst at the threshold. Pricing is a commercial rule; performance is an evaluation result. Keep those claims separate.
The cheapest prompt is not always the shortest prompt. A large prompt can save retrieval engineering for a small one-off job. But at volume, unnecessary context can multiply cost, latency, and error opportunities at the same time.
Security: More Context Also Means More Untrusted Material
Context engineering is not only a performance problem. It is a security boundary.

Every document, tool result, retrieved chunk, memory entry, and user message may contain stale instructions or hostile content. A model may treat text inside a document as an instruction unless the application clearly separates data from control. More context creates more opportunities for prompt injection, policy confusion, and accidental exposure.
A secure design should answer:
- Who is allowed to retrieve this document?
- Was authorization checked before the chunk entered the prompt?
- Can the model distinguish source text from system instructions?
- Is the source current, or has a policy been superseded?
- Can the application show which passages supported the answer?
- Are tool outputs bounded, sanitized, and logged?
Reducing context does not replace access control. A smaller unauthorized prompt is still unauthorized. The right principle is: retrieve less, but retrieve only what the user is allowed to see.
Common Mistakes

Treating the advertised window as the working specification
Measure your own quality floor instead. The vendor number is a boundary condition, not a deployment target.
Increasing top-k whenever retrieval misses something
More candidates may improve recall and worsen distraction. Test reranking, query rewriting, metadata filters, parent-child retrieval, and source quality before increasing context blindly.
Copying source wording into evaluation questions
This rewards lexical overlap. Use paraphrases and indirect references when your application requires semantic retrieval.
Putting the critical instruction in the middle
Place durable instructions where your evaluation shows they survive best, and repeat only the constraints that genuinely need to remain active. Do not assume that a formatting trick compensates for an overloaded prompt.
Compressing without a recovery path
Summaries can omit edge cases. Preserve source links, decisions, unresolved issues, and the ability to reopen the original evidence.
Assuming RAG automatically solves context rot
RAG can return duplicate, stale, irrelevant, or unauthorized passages. Retrieval quality and context assembly must be evaluated together. Vertex Frontierās RAG preprocessing guide is a useful companion for that pipeline.
Calling a modelās confident answer independent verification
A second model can provide another opinion, not proof. Use deterministic checks, source citations, tests, permission checks, and human review where the consequences justify them.
A Before-and-After Context Design
| Design choice | Context dumping | Context engineering |
|---|---|---|
| Documents | Send the entire folder. | Retrieve, filter, rerank, and preserve provenance. |
| History | Keep every turn and tool output. | Compact history and externalize durable state. |
| Tools | Expose every tool and full output. | Expose relevant tools and bound their output. |
| Evaluation | Measure only final answer accuracy. | Measure accuracy, citations, abstention, latency, cost, and drift. |
| Verification | Trust the modelās completion message. | Check the result against an explicit contract. |
When a Bigger Context Window Is the Right Answer
The point is not to build a retrieval system for every document.

Use long context first when:
- the input is one bounded document or a small set of closely related documents;
- the task benefits from seeing broad context at once;
- the corpus does not require complex authorization filtering;
- the request volume makes extra retrieval infrastructure hard to justify;
- your own evaluation shows the model meets the quality floor at the target length.
Use RAG, external memory, or a hybrid when:
- most of the corpus is irrelevant to each question;
- information changes frequently;
- users need citations or passage-level provenance;
- documents carry different permissions;
- requests run at high volume;
- the task spans long agent trajectories;
- aggregation, conflict resolution, or multi-step reasoning matters more than simple retrieval.
The correct decision is empirical. Run both designs on the same representative task set, with the same success definition and a realistic cost and latency budget.
Final Takeaway
Context rot changes the engineering question.
Do not ask only how many tokens a model can accept. Ask how much context it can use reliably for the task you actually care about, at the error rate your users can tolerate, with the latency, cost, provenance, and security controls your system requires.
Sometimes the answer will be a long context window. Sometimes it will be RAG. Often it will be a hybrid: retrieve less, preserve the source, externalize state, isolate complex work, and verify the result.
The practical advantage does not come from owning the biggest window. It comes from knowing what deserves to enter it.
FAQ: Context Rot and Long-Context LLMs
What is context rot in LLMs?
Context rot is the observed, task-dependent decline in a language modelās performance as the amount of input grows, even when the task remains broadly the same and the model is below its advertised context limit.
What causes context rot?
Several factors can contribute, including longer inputs, position-sensitive retrieval, plausible distractors, task complexity, training distribution, and the way the evaluation is constructed. No single explanation covers every model and workload.
Does a larger context window fix context rot?
No. A larger window increases the amount of input a model can accept, but it does not guarantee uniform accuracy or reliable reasoning at the maximum length. Test the model on your task and quality floor.
How many tokens can an LLM use reliably?
There is no universal number. The reliable length depends on the model, task, evidence position, distractors, evaluator, and acceptable error rate. Measure the longest input that meets your own quality floor.
Is RAG still useful with million-token context windows?
Yes, depending on the workload. RAG can reduce irrelevant context, support freshness and citations, control cost, and enforce document permissions. Long context may still be simpler for a bounded document. A hybrid design is often worth testing.
What is the Lost in the Middle problem?
Lost in the Middle describes a position effect found in long-input evaluations: relevant information placed in the middle can be used less reliably than information near the beginning or end. The size of the effect depends on the task and model.
How can you prevent context rot?
Measure your task-specific effective window, retrieve and rerank only useful evidence, compact old history, externalize durable state, bound tool output, isolate subtasks, and verify answers with sources or deterministic checks.
Are recursive language models ready for production?
Recursive language models are a promising research pattern for processing inputs through smaller inspectable contexts, but their tooling and operational trade-offs are still workload-dependent. Recursion can add substantial latency and should be evaluated before production use.
š Article Timeline & History
Successfully updated on September 15, 2026 with the latest details.
This article was originally published on September 13, 2026.
Was this article helpful?










[…] For a full breakdown of why long context fails and how to measure your effective window, read our deep dive on context rot in LLMs. […]
[…] For the benchmarks behind that finding, NoLiMa, RULER, and Lost in the Middle, and how to measure your own effective context window, see our dedicated context rot analysis. […]
[…] matters: simply pasting more into the prompt can degrade quality, a measurable effect known as context rot. Read our analysis on Recursive Language Models and agent context routing to see how agents inspect […]
[…] A retriever cannot return evidence that was never extracted or indexed correctly, and a language model cannot reliably reason over context that is fragmented, duplicated, stale, unauthorized, or stripped of its provenance. Preprocessing improves the evidence available to retrieval; it does not by itself prove that the final answer is grounded. Even clean, well-chunked context can underperform as the prompt grows, a task-dependent decline explained in our context rot guide.” […]
[…] with more context is not automatically better, because quality degrades as input grows, see our context rot analysis for the […]
[…] Most teams reach for RAG as a relevance problem: turn a question into a vector, pull back the nearest chunks, drop them into the context window. That part works well. But a fuller context window is not automatically a better one, long-context performance degrades in measurable, task-dependent ways, as we explain in our context rot guide. […]
[…] URL request. More context also means more surface for untrusted material, a security dimension of context rot worth designing […]
[…] Frontier’s guide to context rot in long-context models goes deeper into the mechanics behind this specific failure […]