Long-Context Testing at Million-Token Scale: How Well Do LLMs Actually Handle Long Inputs
Million-token context windows are moving from marketing claims to default configurations, but the advertised length and the usable length are not the same thing. This article breaks down where long-context costs really come from, the four types of degradation observed in testing, and the engineering strategies that make long inputs practical. You will find notes on sparse activation and cost structure, KV cache growth, paged caching, sparse attention, position encoding extrapolation, prefix reuse, layered evaluation design, and a retrieval-first architecture with long context as a fallback.
1. Why “Million-Token Context” Became a Default Rather Than a Gimmick
Over the past two years, long context windows have been a headline feature of flagship models, yet a clear gap remains between the advertised length and the length that is actually usable. A recent class of very large mixture-of-experts (MoE) models now ships a million-token window as the default, in two tiers: a flagship version with roughly 1.6T total parameters and about 49B activated parameters, and a lightweight version with roughly 284B total parameters and about 13B activated parameters. Both share the same million-token context window.
What matters here is not the number itself but the change in cost structure brought by sparse activation. Because only part of the experts are computed at inference time, the marginal cost of long sequences drops significantly, which is what finally makes long context viable in production.
2. Where the Real Cost of Long Context Comes From
The overhead of long context does not come mainly from parameters. It comes from the quadratic complexity of attention with respect to sequence length and the linear growth of the KV cache. Estimating at 1 million tokens, with a hidden dimension in the thousands and dozens of layers, the KV cache alone often reaches tens of gigabytes, far beyond the memory of a typical single accelerator. In practice, several techniques are commonly combined:
- Paged cache management, to reduce fragmentation and wasted reservation;
- Sparse or sliding-window attention, trading some global coverage for throughput;
- Position encoding extrapolation and interpolation, so relative positions remain stable beyond the training length;
- Prefix reuse, caching system prompts and fixed documents for repeated calls.
A sketch of the call flow (pseudocode, showing the process only):
chunks = split_by_token(doc, size=200_000, overlap=5_000)index = build_index(chunks) # keyword or vector indexctx = assemble(system_prompt, index.top_k(query, k=8), history)resp = llm.chat(ctx, max_tokens=1024, temperature=0.2)
3. Four Types of Degradation Observed in Testing
The first is “lost in the middle.” When key information sits in the middle of a long input, recall drops noticeably, while the beginning and end perform best. This is directly tied to uneven attention distribution.
The second is degraded pointer-style retrieval. When a task requires locating a specific ID, amount, or clause, the model tends to return an approximate value rather than the exact one.
The third is broken multi-hop reasoning. When clues scattered across multiple positions must be chained together, the longer the chain, the higher the error rate.
The fourth is instability under length extrapolation. Once the input goes beyond the training distribution, repetition, grammatical degradation, and even premature termination can appear.
4. Reusable Engineering Strategies
Evaluation must be layered: start with single-point retrieval, then aggregation and statistics, and finally multi-hop reasoning. Record accuracy curves across different positions and different lengths instead of reporting a single aggregate score.
For production pipelines, prefer “retrieval first, long window as fallback”: use an index to narrow the range first, and hand large passages of source text to the model only when necessary. For precision-sensitive fields, use structured extraction plus rule-based validation rather than letting the model recite numbers directly.
On cost control, caching stable prefixes, routing tasks by difficulty to the flagship or lightweight version, and setting a hard cap on output length typically yield differences of several times.
5. A General Capability Mix for Cloud Deployment
To build this kind of system on Baidu AI Cloud, object storage can hold the original long documents, a message queue can smooth out and retry parsing tasks, a container platform can host inference services with elastic scaling, and logging plus monitoring and alerting can track time to first token, cache hit rate, and failure rate. This combination is independent of any specific model and is a portable, general architecture.
6. Conclusion
The value of a million-token context lies not in “how much you can stuff in” but in “whether the part you need can be retrieved reliably.” Treating the window as a capacity metric invites misjudgment. Treating it as a system capability that must be designed together with retrieval, caching, and evaluation is the correct engineering perspective.
