Context & Memory

What Long Context Fixed, and What It Did Not

Mid-window accuracy loss and cost per query, measured on your own corpus.

Chapter 2 of 1210 min readOpen access

What Long Context Fixed, and What It Did Not is the chapter that settles an argument most teams are having badly. Long windows changed the calculation genuinely and partially, and the honest position is a decision rule rather than a side.

Key takeaways

  • Below roughly 200,000 tokens, about 500 pages, a knowledge base can go in the prompt without retrieval. Anthropic states that threshold plainly, and a pipeline maintained under it is cost with no return.
  • Advertised context is not effective context. RULER found that of models claiming 32K or more, only half maintained satisfactory performance at 32K.
  • Position still matters. Accuracy is highest at the beginning and end of the input and degrades in the middle, which makes ordering an engineering decision rather than a formatting one.
  • Length degrades performance on its own. Across 18 models, Chroma measured performance varying significantly with input length even on simple tasks, worsened by low question-answer similarity and by distractors.
  • The decision is a calculation over corpus size, freshness, access control and cost per query, and every term in it is measurable on your own corpus.

Read this beside Chapter 1, which set the controllable surface, and Chapter 7, which spends the budget this chapter argues for. Chapter 11 is where the test described at the end becomes a standing measurement.

Somebody senior reads that a model now takes a million tokens and asks the obvious question: why are we maintaining a retrieval pipeline at all.

It is a good question. It deserves a real answer. On some corpora you should not be. On others the pipeline is the only thing making the product affordable, and saying so requires numbers rather than conviction.

What long context genuinely fixed

Three things improved, and pretending otherwise costs credibility in the argument that follows.

Small corpora stopped needing infrastructure. Anthropic's contextual retrieval work of 19 September 2024 puts the line at about 200,000 tokens, roughly 500 pages. A base that size can go in the prompt with no retrieval at all. A team maintaining an index, an embedding job and a reranker over a corpus that size is paying for machinery it can delete.

Whole-document reasoning became possible. Questions that require holding an entire contract, a full incident timeline or a long codebase file at once used to be answered from fragments. Fragments make some questions unanswerable, and no amount of retrieval quality fixes a question that spans the document.

Failure modes got simpler. A pipeline has more places to be wrong than a prompt does, and for a small corpus the reduction in moving parts is a real reliability gain rather than a matter of taste.

Advertised context is not effective context

The first thing long windows did not fix is the gap between the number on the datasheet and the length at which a model still works.

RULER, published in April 2024, is the clearest statement of it. Of the models evaluated, all claiming context sizes of 32K tokens or greater, only half maintained satisfactory performance at 32K. The paper's framing is worth keeping: performance on simple retrieval within a long input is not the same as performance on tasks that require using that input.

That gap has a direct engineering consequence. If your assembly fills a window to its advertised capacity, you are operating in the region where the measurement says behaviour degrades, and you will experience it as inconsistent quality rather than as an error.

Treat the advertised number as a hard limit and your own measured number as the working limit. Chapter 11 shows how to find the second one, and it is usually a fraction of the first.

Position still decides what gets used

Liu and colleagues published the position result in July 2023, revised that November, and it has survived every generation of model since: performance is highest when the relevant information is at the beginning or the end of the input, and degrades significantly when the model must use information in the middle.

The practical reading is that a window has geography. The opening and the closing are prime positions. The middle is where evidence goes to be ignored.

Most assemblies get this exactly backwards without meaning to. The system prompt sits at the top, a long block of instructions and examples follows, the retrieved evidence lands in the middle, and the user's question sits at the end. The decisive material is in the worst position available, which is why Chapter 7 makes ordering explicit rather than incidental.

Length degrades performance on its own

Chroma's Context Rot report of 14 July 2025 tested 18 models, including frontier models from several providers, and its core finding is uncomfortable for the put-it-all-in approach: model performance varies significantly as input length changes, even on simple tasks.

Two secondary findings sharpen it. Lower semantic similarity between the question and the answer produces a steeper decline as the input grows, which means the hard questions degrade fastest. And a single distractor reduces performance relative to baseline, with the effect amplified by more distractors and by longer inputs.

That last one deserves emphasis. It is the mechanism behind a common disappointment. Filling a window with everything plausibly relevant does not give the model more to work with. It gives the model more distractors, and distractors have a measurable cost.

The report is vendor-published research by a company that sells a vector database, which is worth saying out loud. Its methodology is described and its result aligns with the independent RULER and position findings, which is why it is used here.

The cost curve nobody plots

Quality gets debated and cost gets discovered. Every token in the window is paid for on every request, so a design that adds 40,000 tokens of context to each query has multiplied the unit cost of the product by whatever that represents.

Three multipliers turn that into a real number. Query volume, because a cost per query that looks trivial at a thousand a day is a line item at a million. Retry and regeneration rates, which multiply the same window again. And any agent loop, where a single user request produces many model calls, each carrying the assembled window.

Latency behaves similarly and is more visible to users. Time to first token grows with input length, so a product that felt immediate at 4,000 tokens of context feels sluggish at 100,000, independent of any quality change.

Prompt caching changes the arithmetic where the prefix is stable, which is an argument for putting the stable material at the front and the variable material at the end, and one of the few cases where cost and the position effect point in the same direction. Measure the hit rate rather than assuming it. A cache that is invalidated by a timestamp or a per-user greeting near the top of the prompt saves nothing, and that defect is invisible until somebody reads the bill line by line.

Auditability is the fifth term, and it is not technical

There is a requirement that no benchmark measures and that decides the architecture in regulated settings. Can you show, after the fact, which documents an answer was based on.

A retrieval pipeline produces that record naturally. Each answer has a candidate set, a chosen set and identifiers for both, so a question six months later about why the system said something has a factual answer.

A full-context design does not. The evidence for every answer is the entire corpus, so the honest response to an audit request is that everything was in scope. That is fine for a hobby project. It is not fine where a customer, a regulator or a court asks what informed a decision.

The same property helps outside compliance. Citations in the interface come from the chosen set. Feedback of the form "this answer used the wrong document" is only actionable when a document was identifiably used. And the evaluation work in Chapter 11 depends on knowing what the model was given.

So the term belongs in the decision even when the corpus is small. If answers must be explainable, a retrieval layer earns its place at any size, and the reason is recordkeeping rather than accuracy.

The decision rule

Four terms decide it, and all four are measurable rather than debatable.

TermFavours the long windowFavours retrieval
Corpus sizeUnder roughly 200,000 tokens, or a bounded document set per requestMillions of tokens, or growing faster than you can re-upload
FreshnessStatic or slowly changing materialContent that changes hourly, where re-sending everything is impossible
Access controlOne tenant, one permission level, no per-user restrictionsMulti-tenant or role-based, where the retriever must filter before assembly
Cost per queryLow volume, or a stable cacheable prefixHigh volume, where paying for the whole corpus per request is the dominant cost

Access control is the term teams forget, and it is often decisive on its own. If different users may see different documents, then something has to filter, and that something is a retrieval layer whether or not you call it one. OWASP's 2025 entry on vector and embedding weaknesses names cross-context leakage in shared stores as a primary risk, and the mitigation it recommends is permission-aware retrieval.

Answer it on your own corpus, in about a week

None of the above tells you what to do, because your corpus is not the one in any of these studies. The test is small enough to run.

Take 50 real questions with known-good answers. Run three configurations against them: full context where the corpus allows it, your current retrieval pipeline, and retrieval with a generous window that keeps the top 20 chunks rather than the top 5. Score answers with a checker rather than by reading, in the manner Chapter 11 describes. Record cost per query and latency for each configuration, not just accuracy.

Then read the three numbers together. If full context wins on quality and the cost is acceptable at your volume, delete the pipeline and say so loudly. If retrieval wins on cost while matching quality, you have justified the pipeline with a measurement rather than a habit. If the generous-window configuration wins, which is the common outcome above the threshold, then your work is in ranking and assembly rather than in choosing sides.

Anthropic's own numbers point the same way: in their evaluation, retrieving the top 20 chunks outperformed top 5 and top 10, which is what a large window buys you inside a retrieval design.

Chapter summary

Long windows fixed three real things: small corpora no longer need retrieval infrastructure at all, with the practical threshold around 200,000 tokens; whole-document questions became answerable; and fewer moving parts made small systems more reliable. They did not fix the gap between advertised and effective context, where RULER found only half of models claiming 32K or more performing satisfactorily at that length. They did not fix position, since accuracy remains highest at the start and end of the input and degrades in the middle, which most assemblies get backwards by putting evidence in the middle and instructions at the top. They did not fix degradation from length itself, measured across 18 models by Chroma, worsened by low question-answer similarity and by distractors, so filling a window with everything plausible actively hurts. And they did not fix cost, which rises with every token on every request, multiplied by volume, retries and agent loops, with latency following the same curve. The decision is therefore a calculation over corpus size, freshness, access control and cost per query, with access control often decisive on its own because per-user filtering is a retrieval layer under another name. Run the three-way test on your own corpus with 50 real questions, scoring quality, cost and latency together, and expect the common answer above the threshold to be retrieval feeding a generous window rather than either extreme.

The pipeline is justified or deleted on evidence now. Chapter 3 is Retrieval as an Evidence Pipeline, which names the stages between a question and a supported claim, gives each stage a contract, and locates the failure points that Chapter 11 will later attribute blame to.

Sources

  1. RULER: What's the Real Context Size of Your Long-Context Language Models?Hsieh et al., NVIDIA · 2024-04-09 · Research paper · verified
  2. Lost in the Middle: How Language Models Use Long ContextsLiu et al., Stanford University · 2023-07-06 · Research paper · verified
  3. Context Rot: How Increasing Input Tokens Impacts LLM PerformanceKelly Hong, Anton Troynikov and Jeff Huber, Chroma · 2025-07-14 · Vendor engineering · verified
  4. Introducing Contextual RetrievalAnthropic · 2024-09-19 · Vendor engineering · verified
  5. LLM08:2025 Vector and Embedding WeaknessesOWASP Gen AI Security Project · 2025 · Standard · verified