Articles

What is context rot? Why longer context can reduce LLM quality

24 November 2026Braintrust Team18 min
TL;DR: Context rot

Context rot is the decline in how reliably a large language model uses information as its input grows longer. The model can miss evidence that remains in the prompt, even when the request fits within its context window. A larger window increases how much information a request can contain, but reliable performance still depends on the task and the content supplied.

This guide explains the factors associated with context rot, the limits of long-context benchmarks, and how to distinguish degraded use of evidence from retrieval and truncation failures. It also covers how to test retrieval, context selection, and compaction against representative questions, including checks for information lost when inputs are shortened.

Braintrust makes context changes reviewable through saved experiments that compare the same questions against consistent quality criteria. Engineering and product teams can examine regressions before release and use the results to establish which context configurations meet the application's requirements.


What is context rot

Context rot describes a pattern in which a language model handles the same task less reliably as the number of tokens in its input grows. The information the model needs is still in the prompt, and the request still fits within the context window, yet the model answers incorrectly, selects the wrong passage, or reports that the information is missing.

Chroma's July 2025 report, Context Rot: How Increasing Input Tokens Impacts LLM Performance, evaluated 18 models on deliberately simple tasks. The experiments found declining performance as input length increased, with the extent of degradation varying by model and test conditions.

Context rot concerns how the model uses available information. Evidence omitted by retrieval or removed before generation creates a separate problem that requires inspecting how the application assembled the request.

Context window size vs. usable context

A context window defines the token capacity available to a model request. Instructions, conversation history, retrieved documents, and tool output consume that capacity; the provider's limits also determine how much room must remain for generated output.

Usable context is the amount and composition of input a model handles reliably for a specific task. There is no universal threshold. For example, a support assistant might answer a refund question correctly from a 2,000-token prompt and miss the same policy inside a 90,000-token conversation history, even when both requests fit within the model's window.

Benchmark scores characterize particular capabilities, but an application's context budget should reflect performance on its own questions and evidence.

Where context rot appears in LLM applications

Applications that accumulate history or combine many sources create several conditions worth testing.

Long conversations: A chat assistant that resends the full history adds tokens with each exchange. A detail supplied on turn three may still be present on turn forty, surrounded by exchanges unrelated to the current question.

Agent loops: Appending every tool call and result accumulates search results, file contents, and API responses. By later steps, the model must distinguish information needed for the current decision from earlier activity.

Document collections: Passing many retrieved chunks or whole documents into one request increases the material the model must examine. Similar passages can make it harder to select the right evidence.

Factors that affect context rot in LLMs

Long-context studies identify conditions associated with declining accuracy, but they do not fully explain the underlying mechanism. Input length, distractors, evidence placement, and the relationship between a question and its answer all belong in a task-specific evaluation.

Input length

Chroma held questions and relevant evidence fixed while increasing the surrounding text, allowing the researchers to examine length without making the required answer more complex. Performance declined across the report's experiments, although the pattern differed by model and task.

For an application, a useful test keeps the answer and reasoning requirements stable as context grows. Comparing easy short questions with difficult long questions would mix the effects of length and task difficulty.

Distractors and semantically similar content

Irrelevant content has no connection to the question. A distractor concerns the same topic and appears useful, but does not answer the specific question. In a support corpus, distractors might include a superseded policy, a similar product's specification, or an earlier question about a different account.

In Chroma's tests, a single distractor reduced accuracy, and adding four reduced it further. Individual distractors had different effects, and that non-uniformity amplified as input length grew. Evaluation cases should therefore include plausible competing passages as well as unrelated filler.

Information placement in the context window

Where evidence appears can affect whether a model uses it. Lost in the Middle, published in the Transactions of the Association for Computational Linguistics in 2024, found that performance on multi-document question answering and key-value retrieval was often strongest when relevant information appeared near the beginning or end of the input.

The effect depends on the task. Chroma found no notable position effect across 11 placements in its particular needle-in-a-haystack test, but observed a position effect in a separate sequence-replication task. Test evidence at the beginning, middle, and end of the application's input before choosing an ordering rule.

Question and evidence similarity

A question can use different wording from the passage that answers it. Chroma measured the similarity between each question and the passage containing its answer, and found that lower-similarity pairs degraded faster as context grew, even though they were answerable at shorter lengths.

Production tests should include paraphrases and indirect requests. For example, a customer asking which subscription works with the company's existing identity provider may need a passage describing SSO availability.

What long-context research shows about context rot

Limits of needle-in-a-haystack benchmarks

A needle-in-a-haystack test places known information inside a long block of text and asks the model to retrieve it. A high score demonstrates performance under the benchmark's conditions, which may involve close wording matches between the question and the relevant passage.

NoLiMa reduces literal overlap between questions and evidence, requiring models to infer associations. AbsenceBench asks models to identify material removed from a document by comparing original and edited versions. Both expose difficulties that simple retrieval tests can overlook, reinforcing the need to evaluate the operations an application actually performs.

Findings from the Chroma context rot report

The report adds three findings that help shape practical tests:

Input structure changed retrieval performance. Models performed better when surrounding sentences were shuffled than when they retained their original order. The finding concerns the tested retrieval setup and does not establish that shuffling production documents improves application quality.

Focused inputs outperformed full histories. Using 306 questions adapted from LongMemEval, the researchers compared focused prompts averaging about 300 tokens with full histories averaging about 113,000 tokens. All tested models performed better with the focused prompts, which were constructed from labeled relevant information and manual adjustments.

Simple replication also degraded. Models became less reliable at reproducing a repeated-word sequence containing one unique word as the sequence grew, showing that long-input failures were not confined to question answering.

The focused-history comparison demonstrates the value of supplying relevant evidence. It does not measure whether a production retriever can select that evidence reliably, so retrieval quality needs a separate evaluation.

Model behavior and research limitations

The study observed different failure patterns across its tested models. Some were more likely to abstain when uncertain; others supplied incorrect answers. Thinking modes improved performance on both focused and full histories where tested, but a gap between the two remained.

The report evaluated models available in mid-2025, and its deliberately simple tasks do not establish performance on every synthesis or agent task. It also left the underlying mechanism unresolved. Use the findings to design tests, then measure the exact model version and configuration intended for production.

Context rot vs. truncation vs. retrieval failure

An answer that ignores expected evidence can arise at different stages of a request. Diagnosis begins by checking whether the evidence reached the model and whether the model could answer correctly with a focused version of the input.

Three request stages and the failure each produces: retrieval never fetches the evidence, assembly cuts it to fit the token budget, or generation receives it in the final payload and the model misses it

Retrieval failure: The search step fails to return the required evidence. Check whether the document was indexed and whether the relevant passage appears among the retrieved candidates.

Truncation: The evidence is present in the history or retrieved results, then removed to satisfy a token budget. Compare the content before context assembly with the final model payload to locate the removal.

Possible context rot: The final payload contains the evidence, but the model gives an incorrect answer or abstains. Repeat the question with a focused input under the same model settings. A reproducible decline on the longer input supports a context-rot diagnosis.

Evidence can also be removed by filtering or summarization. Logging the decisions made during context engineering helps locate the stage that omitted a necessary fact. Evidence presence alone does not prove context rot; prompt ambiguity, reasoning errors, and output variation can also cause failures.

Measuring context rot with task-level evals

A useful evaluation establishes which input conditions reduce task performance and whether a proposed context change addresses the failures. It needs controlled variants for diagnosis and representative production cases for deciding what to release.

Controlled input variants

Build each case around a fixed question, reference answer, and the evidence required to answer it. Keep the model version, instructions, generation settings, and scoring criteria consistent across variants.

Focused baseline: Include the question and necessary evidence. Investigate failures here before attributing problems to context length; the model, instructions, reference answer, or scorer may need attention.

Length variants: Place the same evidence inside progressively longer inputs, such as 8,000, 32,000, and 128,000 tokens where the model's limits permit. Use material from the application's actual context sources and leave room for output.

Distractor variants: Replace unrelated filler with similar but non-answering passages, keeping total length approximately constant when isolating the effect of distractors.

Position variants: Move the evidence near the start, middle, and end without changing the question or surrounding content.

One question and one piece of evidence expanded into four inputs — focused baseline, length variant, distractor variant, and position variant — each scored for correct, abstained, and unsupported answers

Representative questions from production

Production questions show whether controlled failures occur in the cases users actually submit. Include requests expressed differently from the supporting passage, questions involving near-duplicate documents, and questions that depend on details from early in a conversation or across sessions.

Record input length, distractor count, evidence position, and question type as metadata. Grouping results by these conditions reveals whether a strategy fails mainly on long histories, ambiguous passages, or a particular question type.

Scoring correctness, abstention, and unsupported answers

Correctness measures whether the response answers the question accurately, and an abstention check catches cases where the model declines to answer despite sufficient evidence. A groundedness check covers a third failure, assessing whether the claims in the response are supported by the context the model received.

An answer copied from an outdated policy may be supported by text in the prompt but incorrect for a question about the current policy. A groundedness scorer alone can miss the error, so correctness scoring must account for the relevant document version, entity, and timeframe.

Review a sample of scorer decisions against human judgments and keep the rubric stable across comparisons. When the judge or rubric changes, rescore the baseline and candidate consistently before interpreting score differences as application changes.

Case-level comparison across context strategies

Aggregate accuracy can hide failures concentrated in a small but important group. Compare each strategy against the baseline case by case, then examine regressions involving required facts or high-impact decisions before accepting an average improvement.

Run each case several times to distinguish consistent changes from output variation, which temperature and other sampling settings influence. Each trial should generate a fresh response; a stored response returned from a response cache does not provide another independent sample.

Track token usage, cost, and latency alongside quality. Include retrieval, reranking, and summarization overhead when comparing complete strategies, since reducing model input does not guarantee a lower total cost or faster response.

Reducing context rot with retrieval, selection, and compaction

Reducing unnecessary context can improve reliability, but shortening inputs can also remove information needed for an answer. Evaluate each strategy for both evidence retention and task performance.

Retrieval

Retrieval selects passages relevant to the current question, reducing the material the model must examine. It is useful when a corpus or conversation history contains much more information than a particular answer requires.

The risk is failing to retrieve necessary evidence, especially when the query and supporting passage use different wording. Measure retrieval recall on labeled question-evidence pairs alongside answer quality. RAG evaluation separates retrieval performance from generation performance so an improvement at one stage does not conceal a failure at another.

Context selection and filtering

Reranking, relevance thresholds, and deduplication can reduce distracting or redundant material. Version-aware filtering can exclude superseded documents when the question concerns current information, while retaining older versions for historical questions.

A narrow threshold may discard a qualification needed for a broad or multi-part question. Test cases should include answers that depend on several passages, such as a policy rule and an exception stored elsewhere.

Compaction and summarization

Compaction replaces older conversation turns or tool results with a shorter representation. It can keep long sessions within a manageable budget, but a summary may omit details whose relevance becomes clear only in a later question.

Dates, identifiers, quantities, and explicit user constraints need particular attention. Test follow-up questions that refer to early details, and compare the summary against the original source when an answer fails. Preserve access to the original records when later retrieval may be needed.

Select a context policy by its measured ability to preserve required information and meet quality, cost, and latency requirements. A smaller input is useful only when the application still completes the task reliably.

Evaluating context rot with Braintrust

Context policies determine which information an application can use at each step. Braintrust gives engineering and product teams a shared record of the evidence behind a policy change, so release decisions can follow agreed quality requirements.

Step 1: Build a versioned dataset

Braintrust datasets are versioned collections of test cases, and experiments can pin to a specific version so each strategy runs against the same snapshot. Store the question and source material needed to reconstruct the test in the input, with the approved answer in the expected field. Add condition labels as metadata and give each logical case a stable identifier.

Product and support specialists can use Loop to investigate long-conversation failures in plain language and create evaluation cases from relevant production traces. Human review confirms the evidence and expected answer before the cases enter the release suite, reducing the engineering work required to expand coverage.

Step 2: Define task-specific scoring

Use code-based scorers for deterministic requirements such as an exact date or identifier. LLM-as-a-judge scorers can assess answers that allow varied wording and identify abstentions or unsupported claims.

Give correctness scorers the reference answer and any rules for choosing between conflicting passages. A groundedness scorer needs the context actually supplied in that run, including any filtering or compaction, so it can assess support against the evidence available to the model.

A Braintrust LLM-as-a-judge scorer open in the editor with a suggested rubric change highlighted as a diff, beside a Loop panel explaining the proposed criteria

Scorer rubrics need the same version discipline as prompts. Review a proposed rubric change before accepting it, then rescore the baseline so a score movement reflects the application rather than the judge.

Step 3: Run comparable experiments

Run full history, retrieval, and compacted history as separate experiments against the same dataset version. Record the tested configuration in experiment metadata, including the model, context policy, and settings needed to reproduce the run. During diagnosis, vary one context property at a time; compare complete candidate policies once the individual effects are understood.

Braintrust matches rows by input by default. When assembled context changes the input between experiments, set a custom comparison key using the stable case identifier. Matching only on question text can combine unrelated cases when the same question appears with different source histories.

Step 4: Review regressions and consistency

Choose the focused-input run for diagnosis or the accepted production configuration for a release comparison. The experiment comparison view places outputs and scores side by side, so reviewers can see which questions improved or regressed. Filter by metadata to check whether losses concentrate in long histories or specific question types.

Braintrust experiment comparison with per-candidate grades of Improvement, Tradeoff, and Regression alongside score, duration, token, and error metrics

Use repeated trials to examine consistency, then group trials by input to inspect variation within each case. Weigh token usage, cost, and latency against the quality results when deciding whether a candidate policy is ready.

For long prompts, keep the question, context, and instructions in separate logged fields. Diff mode has a 4,096-character limit per field, so logging a long context as one blob leaves it undiffable; separate system_prompt, context, and user_query fields can each be compared independently.

Step 5: Apply release requirements and monitor production

Braintrust's GitHub Action runs evaluations on pull requests and reports changes against a baseline. Enforce quality requirements with a custom reporter that returns a failing status when the candidate misses the agreed thresholds, then configure the evaluation as a required repository check. A pull-request comment alone does not block a merge, and bt eval otherwise exits non-zero only when an eval throws.

After release, online scoring evaluates production traces using configured filters and sampling rates. For conversations spread across traces, a group-scoped rule collects related turns through a shared key such as metadata.session_id, bounded by its group interval and a maximum of 64 traces per group. A judge prompt can then reference {{thread}} to inspect the conversation across those traces.

Braintrust project configuration showing an online scoring rule with its sampling rate and assigned scorer

Review failures and turn production examples into regression tests with verified expected answers before expanding the dataset.

Braintrust's free Starter plan includes 10,000 scores and 1 GB of processed data per month, with 14-day retention, so engineering, product, and QA can review the same context experiments. Long-context runs consume processed data quickly, since every logged prompt counts toward the allowance.

Start free with Braintrust to test context changes before release.

FAQs about context rot (2026)

What is context rot in LLMs?

Context rot describes a loss of reliability as the information supplied to a model grows. A useful warning sign is repeated failure to use a fact that remains in the prompt and that the model handles correctly in a focused test. The term concerns request-time behavior; it does not mean the model's trained knowledge is deteriorating.

Does a larger context window prevent context rot?

A larger window increases capacity but does not guarantee reliable use of every included passage. Set the application's working context budget from task evaluations, including difficult questions and long conversations, then verify the budget again when the model or context policy changes.

How is context rot different from lost in the middle?

Lost in the middle describes sensitivity to evidence position, especially weaker performance when relevant material sits between other content. Context rot covers a broader decline associated with growing inputs. Moving evidence may help a position-sensitive task, but length and distractors can still affect results.

Do reasoning models avoid context rot?

Thinking modes narrowed the decline in Chroma's 2025 tests without removing it. Scores rose on both focused and full histories, and the full-history runs still trailed. Compare reasoning settings on the application's own cases and include their additional cost and latency in the decision.

Does RAG solve context rot?

RAG can reduce the amount of irrelevant material a model receives, but its success depends on retrieving all evidence needed for the answer. It can also return distracting or conflicting passages. Evaluate retrieval recall and answer quality together before treating a shorter retrieved context as an improvement.

How do I test my LLM application for context rot?

Take questions with verified answers and compare a focused input with longer variants under fixed model settings. Repeat the runs and investigate consistent quality drops after confirming the evidence survived context assembly. Braintrust experiments keep those runs on record, so reviewers can open the affected cases when a new context policy is under consideration.

Share

Trace everything