Skip to content
Double the context, but not double the effective capability

Double the context does not mean double the effective capability

“I’ll just stuff the entire document library into the context and the model can answer any question” — I’ve seen this assumption collapse more than once. A team doing after-sales support loaded over three hundred product documents into a 128k window in one go, and the frontend simply stopped doing retrieval. After launch, the answer style was indeed more coherent, but wrong answers on clause details didn’t decrease, time-to-first-token went from under a second to three or four seconds, and inference cost per session rose by an order of magnitude. The window was sufficient; the capability didn’t follow.

This bill has to be broken down. Doubling the window buys addressable space — not usable attention, and not proportional cost. Mix these three things together and expanding the window becomes an architectural decision that looks free but is actually very expensive.

The window is address space, not attention

Most long-context evaluations use “needle in a haystack”: bury one sentence in a pile of irrelevant text and see whether the model can retrieve it verbatim. These tests pass at high rates because the task only requires locating a single point. Real business rarely asks questions this way. A user asks “which of these three rules takes precedence,” and the model has to compare three places at once and rule out two similar but outdated notes. Locating and comparing are two different levels of difficulty.

The structural reason isn’t hard to explain. Attention scores all token pairs in the input; there’s no explicit switch for “this page is irrelevant, skip it.” Irrelevant material doesn’t sit quietly — it competes for weight. Put ten documents in the context, seven of them irrelevant, and those seven dilute the weight of the three genuinely useful ones at every layer. The effective context is therefore noticeably shorter than the nominal window, and it shrinks as distractor density rises. One phenomenon repeatedly observed in public research is position bias: information placed at the beginning and end is more likely to be used, while information buried in the middle is easily missed.

The judgment here: for tasks requiring multi-hop reasoning — that is, tasks where several pieces of information must be chained together to answer — cutting irrelevant material from ten documents to three often helps accuracy more than expanding the window from 32k to 128k. Doubling the window mainly buys space to hold more irrelevant material, unless you also do the filtering.

A counterexample shows the problem isn’t only about length. One team fed a two-hundred-page contract in whole and asked “how is the penalty calculated”; the model answered cleanly and crisply, because the relevant clause was on the first two pages. Switch to “which clauses in this contract conflict with Appendix 3” — same input, same model — and the error rate immediately climbs. The former is locating; the latter is comparing. Under the same window, performance on the two tasks can differ enormously.

Cost is two different curves

The first segment is prefill — running the entire input through one forward pass. The attention portion of the computation grows roughly quadratically with sequence length; the rest grows linearly. Quadruple the length and prefill workload rises by more than ten times, at that order of magnitude. What the user perceives is time-to-first-token: a few hundred milliseconds for short requests, several seconds for long inputs — and this latency can’t be masked with streaming output, because not a single character has been generated yet.

The second segment is the KV cache — the key-value cache that must stay in GPU memory during decoding. Every token’s key and value must be held; occupancy grows linearly with context length, and is multiplied by the number of concurrent requests. Quadruple the window, and memory per request quadruples, while the number of requests a single card can serve concurrently drops to roughly a quarter. Latency and throughput degrade together, and this is determined by hardware — no amount of tuning brings it back.

The billing structure amplifies this once more. Most vendors use tiered pricing for long inputs: past a certain threshold the unit price goes up, so long context isn’t bought at a linear price. Prefix caching can save the prefill of a repeated prefix, but it can’t save memory occupancy, and it can’t save the squeezed concurrency. Caching solves duplicate billing, not capacity.

Short context plus retrieval Long context fed in whole
Time-to-first-token Stable at the few-hundred-millisecond level Rises with input length, reaching seconds
Cost per request Proportional to the number of retrieved chunks Superlinear, and triggers tiered unit pricing
Concurrency density High Noticeably lower
Multi-hop accuracy Constrained by retrieval quality; chunking severs dependencies Better when material is complete, worse when distractors are many
Primary failure mode The chunk that should have been recalled wasn’t Attention diluted; answers look plausible but details are wrong

Stack the two curves and the consequence is: the cost of short context plus retrieval grows linearly with request count, while the cost of long context fed in whole grows with request count multiplied by length. Double the business volume and the former’s bill doubles; the latter’s may multiply several times over.

When long context is genuinely worth it

The criterion isn’t whether the window is big enough — it’s whether the material has dependencies that must be visible simultaneously.

Long context genuinely wins in three kinds of scenarios. Cross-section consistency checks, such as conflicting clauses earlier and later in a contract, or the same metric appearing under two definitions in a document. Codebase-level changes, where changing a function signature requires seeing all callers and implementations at once. Timeline attribution, such as who agreed to what at which step in a long meeting transcript. In these tasks, chunking severs dependencies, and no matter how accurate retrieval recall is, it won’t help, because the answer isn’t in any single chunk.

The unsuitable scenarios are equally clear: high-frequency consumer Q&A, voice interaction, anything where time-to-first-token enters user perception. One frequently overlooked consumer is multi-turn conversation. Every turn resends the entire history; as turns accumulate, cost grows quadratically with turn count, and what the user perceives is “the longer we chat, the slower it gets.” I lean toward setting a hard cap on conversation history and compressing anything beyond it into structured state, rather than appending indefinitely.

Here’s a criterion you can use on the spot: if more than half of a request’s input is “possibly relevant,” do retrieval; only if more than half is “must be seen simultaneously to judge” is long context worth it. You don’t need precise statistics for this ratio — flipping through a few dozen real requests is enough to estimate it.

Treat context as a budget to allocate

With the window fixed, first decide what qualifies to occupy a slot, then decide how much it gets. This process answers one question: should this request assemble context, or feed the whole thing in?

flowchart TD
    A[请求进来] --> B{必须同时看多处才能判断}
    B -->|否| C[先检索再拼上下文]
    B -->|是| D{一次性且可等待}
    D -->|否| E[切分加结构化状态]
    D -->|是| F[整篇送入并留余量]
    C --> G[限制片段数与干扰项]
    F --> H[预留重试与工具返回]

The budget belongs in code, not in documentation. Taking a 32k window as an example, my default allocation is this:

YAML8 lines
1
2
3
4
5
6
7
8
context_budget:
window: 32768
system_prompt: 1000 # 超过就拆,不靠模型忽略多余段落
retrieved_chunks: 5 # 每段上限 800 token
history_turns: 4 # 更早的压成结构化状态
history_state: 600
output_reserve: 3000 # 给生成和重试留的,不算浪费
on_overflow: drop_oldest_chunk

What to do on overflow must also be decided in advance. By default, drop the oldest or least relevant chunks, rather than hoping the model will ignore them on its own. A request with a full context will overflow the moment a tool call returns a result that needs appending, and all the preceding reasoning is wasted.

One more layer: compressing long input into structured state is usually more robust than compressing it into a summary. A summary loses fields; structured state loses phrasing. The former leaves the model one fewer number to check against; the latter merely changes the syntax.

What a doubled window crushes first is evaluation

Change the window and the existing eval sets are almost all short-input, so of course the metrics don’t move. The team then concludes “the impact is small” — until those plausible-looking, detail-all-wrong answers start showing up in production.

Three things need to be added: multi-hop questions under long input; a distractor-density gradient, where the same question is paired with 3, 10, and 30 irrelevant documents respectively; and a position gradient, placing key information at the beginning, middle, and end respectively. The first two probe attention dilution; the third probes position bias.

A minimum viable approach: sample a few dozen real long inputs from production logs, manually mark which paragraph the key information falls in, then look solely at the hit rate for requests where “the key information is in the middle third.” This number is usually much uglier than overall accuracy — but it’s the metric you should actually be watching after expanding the window. Overall accuracy gets propped up by the many easy samples where “the answer is right at the beginning,” and everything looks calm.

The next time someone proposes “just make the context window bigger,” ask for three numbers first: time to first token, cost per request, and the hit rate for key information that falls in the middle section. If these three numbers don’t improve together, doubling the window just moves the problem from capability to the bill.

References

About this Post

This post is written by Lu's Blog, licensed under CC BY-NC 4.0.

#Inference Costs #Long Context #Product trade-offs

Comments