{"id":90437,"date":"2026-07-24T09:24:19","date_gmt":"2026-07-24T07:24:19","guid":{"rendered":"https:\/\/webraketen.space\/?post_type=glossar&#038;p=90437"},"modified":"2026-07-24T09:41:56","modified_gmt":"2026-07-24T07:41:56","slug":"context-rot","status":"publish","type":"glossar","link":"https:\/\/webraketen.space\/en\/glossar\/context-rot\/","title":{"rendered":"Context Rot"},"content":{"rendered":"<p class=\"wp-block-paragraph\">\u201eLost in the Middle\u201c (Context Decay) refers to the gradual decrease in the performance of Artificial Intelligence (LLMs) when the input context becomes too long or overloaded. Although models offer very large windows (e.g., millions of tokens), accuracy declines because important information gets lost in the flood of information, or the model partially \"forgets\" or ignores instructions and previous conversation histories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The term refers to the measurable loss of quality in model responses as more tokens are fed into the prompt: answers become less accurate, facts from the provided text are lost, and instructions are ignored. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Context Rot is the technical term for the everyday experience of \u201egetting dumber\u201c in long chats or extensive prompts. The effect affects LLMs, chatbots, and <a href=\"https:\/\/webraketen.space\/en\/glossary\/ki-agent\/\" data-internallinksmanager029f6b8e52c=\"13\" title=\"AI Agents - Definition, Function, and Practical Applications\">AI agents<\/a> with long-running sessions and occurs below the token limit, so it is not identical to a context window overflow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This effect was documented in July 2025 by the <a href=\"https:\/\/www.trychroma.com\/research\/context-rot\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.trychroma.com\/research\/context-rot\" rel=\"noreferrer noopener\">Chroma Study by Kelly Hong, Anton Troynikov, and Jeff Huber<\/a>, which systematically tested 18 Frontier models on their behavior with increasing context lengths.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why LLMs become weaker with long contexts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The cause does not lie in a memory limit, but in the way Transformer models distribute attention. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every token in the context competes with every other token for the model's finite attention capability. The more tokens present, the thinner the distribution becomes, and the greater the risk that relevant passages will get lost.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Attention is a budget, not a memory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A context window does not behave like a notepad where everything remains visible at all times. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anthropic describes context as a finite resource with diminishing marginal returns: LLMs have an attention budget that gets consumed when processing large amounts of context. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every additional token reduces this budget because, in the Transformer architecture, each token can attend to every other token. The number of pairwise relationships grows quadratically, while the model's ability to weight them cleanly does not. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The mental model \u201emore context = more knowledge for the model\u201c is misleading; the correct understanding is \u201emore context = more competition for the same focus.\u201c.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Positional encoding and decay in the middle<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to the budget question, position coding comes into play. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">LLMs mostly use Rotary Position Embedding (RoPE), which adds relative position information to each token. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The special feature of RoPE lies in its mathematical decay effect: the direct attention between two tokens automatically decreases as the distance between them increases. This noticeably shapes the model's memory. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While the beginning (system prompts) and end of the text (fresher information) remain highly relevant, the middle of the document quickly falls into a low-attention zone due to the large distance from both ends.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">More recent models have reduced this effect, but no production model has eliminated it entirely. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In practice, this means that important information should not be placed in the middle of long passages, because it is systematically given less attention there than at the beginning or the end.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When context turns red<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Context rot doesn't start only shortly before the token limit, but mostly far before it. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The \u201edecay\u201c in Gemini 2.5 became noticeable at around 100,000 tokens \u2013 even with clean, relevant context. With a 200,000-token window, degradation can occur as early as around 50,000 tokens. <\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"661\" src=\"https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-1024x661.jpeg\" alt=\"A bar chart in German showing the usable tokens compared to the total number in the context window (128K, 200K, 1M). The usable tokens account for approximately 55\u201365 % of the total, with the pink bars labeled with the respective window sizes. The text explains the difference between technical and practical usability.\" class=\"wp-image-90442\" srcset=\"https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-1024x661.jpeg 1024w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-300x194.jpeg 300w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-768x495.jpeg 768w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-1536x991.jpeg 1536w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-2048x1321.jpeg 2048w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-token-fenster-18x12.jpeg 18w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The exact threshold depends on the model and the task, but the assumption that an advertised context window is usable up to the last token is not empirically supported.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Effective vs. Advertised Context Window<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/arxiv.org\/abs\/2404.06654\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/arxiv.org\/abs\/2404.06654\" rel=\"noreferrer noopener\">RULER-Benchmark (Hsieh et al. 2024)<\/a> sets the effective context window at around 50 to 65 percent of the advertised value. Thus, a 1 million token model does not deliver reliable results at 1 million tokens, but rather at 500,000 to 650,000 tokens. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>As a planning anchor, the rule of thumb is:<\/strong> The working limit is not the maximum, but rather about half of the advertised window. If you take this limit into account in your system design, you\u2019ll save yourself the trouble of later debugging sessions caused by misperceptions or missing data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What the Chroma numbers show<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Chroma study provides robust quantitative evidence. 18 Frontier models, including GPT-4.1, Claude 4, Gemini 2.5, and Qwen3, were tested; every single model degraded with increasing context length, without exception. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Accuracy dropped by more than 30 percentage points when a relevant fact was located between positions 5 and 15 of a 20-document context, instead of at the very beginning or end. Even when distractors were masked, the baseline decreased by 7.9 percent solely due to the additional length. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An older Stanford study involving approximately 4,000 tokens and 20 documents found that accuracy dropped from 70 to 75 percent to 55 to 60 percent when the information being searched for shifted to the middle\u2014a difference of 15 to 20 percentage points due to position alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A counterintuitive finding from the Chroma study: models performed better on mixed, unstructured haystacks than on logically coherent documents, across all 18 models. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Structural coherence consistently harmed performance. For practical purposes, this doesn't mean shredding documents, but the idea that a cleanly sorted, thematically coherent long context helps the model has been disproven.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Context rot, overflow, or lost in the middle?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The three terms are often confused, but they mean different things. <\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img decoding=\"async\" width=\"1024\" height=\"590\" src=\"https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-1024x590.jpeg\" alt=\"Infographic with three charts on \u201eContext Window Overflow,\u201c \u201eLost in the Middle,\u201c and \u201eContext Rot.\u201c Each chart shows accuracy versus position, with explanatory texts in German and a special focus on the effects of \u201eContext Rot.\u201c.\" class=\"wp-image-90448\" srcset=\"https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-1024x590.jpeg 1024w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-300x173.jpeg 300w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-768x443.jpeg 768w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-1536x885.jpeg 1536w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-2048x1180.jpeg 2048w, https:\/\/webraketen.space\/wp-content\/uploads\/2026\/07\/context-rot-lost-in-the-middle-overflow-18x10.jpeg 18w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">AI-assisted image generated<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Context window overflow<\/strong> is a hard technical cutoff: Whoever exceeds the token limit loses content or receives an error. Overflow is binary and occurs at the top of the window.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Lost in the Middle<\/strong> is a position bias, which <a href=\"https:\/\/arxiv.org\/abs\/2307.03172\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/arxiv.org\/abs\/2307.03172\" rel=\"noreferrer noopener\">Liu et al. 2023<\/a> First described: Models prefer tokens at the beginning and end of the input, tokens in the middle get lost. This results in the well-known U-pattern in accuracy curves. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A follow-up study by Veseli et al. (2025) differentiates: The U-pattern applies mainly when the context window is less than 50 percent filled. Above this mark, accuracy degrades primarily with increasing distance from the end; the model then prefers recent tokens over middle ones, and middle ones over early ones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Context Rot is the umbrella term, <\/strong>which encompasses and goes beyond both: it denotes the entire gradual quality loss with increasing length, including positional bias, but also independently of it, as the chroma baseline shows with a 7.9 percent drop in masked distractors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In practice: Those who get inaccurate answers with 300,000 tokens in a 1-million-token window see red context, not overflow. Those who find that the answer references the first and last documents well, but the middle poorly, see \"lost in the middle\" as a sub-phenomenon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Context Rot is distinguishable from other reliability issues like hallucinations in that it is tied to input length. Hallucinations can be a consequence of context rot, but they also occur without long contexts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What helps against context rot<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Since the phenomenon depends on the quantity and structure of the context, all countermeasures focus on that: less, more targeted, tidier context. The tested techniques can be categorized into three families (Context Compaction, Context Trimming, Context Isolation), in addition to retrieval approaches at the architectural level and low-threshold workarounds for individual users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Retrieval instead of everything in the prompt<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/webraketen.space\/en\/glossary\/retrieval-augmented-generation\/\" data-internallinksmanager029f6b8e52c=\"15\" title=\"Retrieval Augmented Generation (RAG)\">Retrieval-Augmented Generation (RAG)<\/a> per request retrieves only the most relevant passages from an external knowledge base and passes them to the model, instead of loading the entire document collection into the prompt. As the volume of documents grows, this switch quickly becomes worthwhile compared to \u201econtext stuffing\u201c: the model sees 5 to 20 relevant passages instead of potentially 500 relevant ones, and the attention budget focuses on what matters. RAG attacks context rot at the root because it structurally reduces the context length per request.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Compaction, Trimming, Isolation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Within an ongoing session, three technique families are accessed. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Compaction summarizes previous context parts and replaces the original text with the summary. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Trimming removes parts that are no longer needed for the current task, such as old debug outputs or failed tool calls. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Isolation outsources sub-tasks to sub-agents with their own fresh context, whose results then flow back into the main context.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A systematic evaluation (Xia et al., Diagnosing and Mitigating Context Rot in Long-horizon Search, 2025) in deep search scenarios with four open-source models finds that the combination of compaction and trimming yields the best cost-effectiveness. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Context isolation via sub-agents depends more heavily on the model and can outperform other methods with a strong LLM backbone, but performs worse with weaker backbones. A higher trigger frequency for passive methods mitigates rot additionally, but drives up costs because more frequent summaries mean more model calls.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">New instance with summary<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The issuer's workaround is the lowest-barrier immediate measure and works without any technical setup: The previous conversation is summarized at regular intervals, a new chat instance is started, and the summary is fed in as a fresh starting point. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For individual users in long chat sessions or for AI coding agents whose context windows fill up with debug outputs, failed attempts, and noise, this is the fastest way to reset the attention budget. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The method does not replace a structural solution like RAG or compaction, but it bridges the gap until one is implemented.<\/p>","protected":false},"excerpt":{"rendered":"<p>Unter Context Rot (Kontextverfall) versteht man das allm\u00e4hliche Nachlassen der Leistungsf\u00e4higkeit von K\u00fcnstlicher Intelligenz (LLMs), wenn der Eingabekontext (Input) zu lang oder \u00fcberladen wird. Obwohl Modelle sehr gro\u00dfe Fenster (z.B. Millionen Token) anbieten, sinkt die Genauigkeit, da wichtige Informationen in der Informationsflut untergehen oder das Modell Instruktionen und fr\u00fchere Gespr\u00e4chsverl\u00e4ufe teilweise &#8222;vergisst&#8220; oder ignoriert. Der [&hellip;]<\/p>\n","protected":false},"featured_media":0,"template":"","class_list":["post-90437","glossar","type-glossar","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/glossar\/90437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/glossar"}],"about":[{"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/types\/glossar"}],"version-history":[{"count":5,"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/glossar\/90437\/revisions"}],"predecessor-version":[{"id":90449,"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/glossar\/90437\/revisions\/90449"}],"wp:attachment":[{"href":"https:\/\/webraketen.space\/en\/wp-json\/wp\/v2\/media?parent=90437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}