Million-Token Context Models: Architecture, Routing, and Deployment
Large context windows are not just a parameter-count problem. This article examines how to engineer million-token LLM systems by separating total and active parameters with Mixture of Experts, compressing long-context state and KV cache, tiering reasoning depth by task, and mapping workloads to flagship or efficient model tiers. It also covers evaluation metrics, routing configuration, cloud infrastructure considerations, and fallback strategies for production deployment.
The Problem Is No Longer Just “Bigger Models”
Real enterprise tasks are often not single-turn chat. They involve placing an entire policy, contract, research report, repository description, or project archive into one conversation and asking the model to retrieve, summarize, and reason across it. Once context reaches the 100K to 1M token range, the bottleneck quickly shifts from “are there enough parameters?” to “how much historical state must be moved at every step?” If you still rely on dense full-parameter inference and a full-history key-value cache, latency, memory, and cost per request will all spiral out of control.
A more useful discussion is therefore not about chasing a particular launch-day claim, but about breaking the capability into four engineering concerns: how to separate total parameters from active parameters, how to compress state for ultra-long context, how to tier reasoning depth by task, and how to map different workloads to different model specifications.
Sparse Experts: Trade Total Capacity for Per-Step Cost
The basic idea behind Mixture of Experts (MoE) is simple: keep many expert sublayers in the network, but route each token to only a small subset of them. Total parameters determine the breadth of knowledge the model has seen and retained; active parameters determine the compute actually burned in a single forward step. The two do not need to grow proportionally.
In deployment, the constraints to watch are not slogan-style “trillion-parameter” claims, but three measurable issues:
- Routing stability. If expert assignment fluctuates sharply for similar inputs, cache hit rates and batching both suffer. Training and inference should use consistent routing policies, and expert load should be monitored for long-term skew.
- Activation scale. Active parameters roughly define the compute upper bound for a single request. Complex research, multi-step planning, and agent orchestration can tolerate larger activation; everyday summarization, rewriting, and Q&A should be pushed toward smaller activation, otherwise average cost will be dragged up by a small number of heavy tasks.
- Communication and memory. After experts are partitioned, cross-device communication is often more expensive than the matrix multiplication itself. Specification selection should consider both the compute graph and the topology, not just the parameter table.
A practical hierarchy is “flagship specification + efficient specification”: the former has higher total capacity and activation and handles deep reasoning and tool-calling chains; the latter has smaller activation and handles high-frequency, short-output, cacheable office workflows. Both should share the tokenizer, system-prompt protocol, and evaluation set; otherwise routing policies and prompt engineering cannot be reused.
Million-Token Context: Memory, Not Vocabulary, Is the Expensive Part
The user value of long context is straightforward: no need to manually split documents or repeatedly paste background, and the model can align clauses or cross-chapter facts within the same state. Engineering cost mainly comes from attention state, especially the key-value cache (KV Cache). As sequences grow longer, the cache grows approximately linearly with layers, heads, and precision; as batch size rises, memory hits the ceiling before compute does.
Common cost-reduction paths in the industry can be combined, but each must be validated separately for quality regression:
- Cache quantization and paging. Reduce historical keys and values to lower bit widths and manage them by page to simplify eviction and reuse.
- Sparse or sliding-window attention. Use dense attention at short range and retain only highly relevant positions or summary slots at long range.
- Hierarchical memory. Store original chunks, section summaries, and entity indexes in layers, and read them back on demand during inference instead of keeping all source text in hot cache.
- Prefix caching. Share system prompts and fixed knowledge-base prefixes across multiple requests to avoid repeated prefill.
Evaluating a “long-text capability jump” should not report only the maximum window. At minimum, look at time to first token at full window, prefill cost per thousand tokens, cache footprint relative to short context, and tasks beyond needle-in-a-haystack—for example, cross-distance conflict resolution, table-versus-body consistency, and negation and exception clauses in long documents. Many models have large window numbers, but effective attention utilization in the latter half drops noticeably, so production systems may still need chunking or indexing.
Reasoning Modes: Make Thinking Depth a Policy, Not a Switch
The same model should not use the same decoding path for “change a title” and “verify liability boundaries across a hundred-page contract.” Dividing reasoning into several tiers is a reasonable product abstraction, but the tiers must correspond to observable compute budgets, not marketing labels.
An operable three-level strategy is usually:
- Direct answer. Few samples, short chain of thought or no explicit chain of thought; suitable for classification, extraction, and format conversion. Validate with latency and format compliance rate.
- Standard deliberation. Allow moderate-length intermediate reasoning; suitable for most analysis, code explanation, and option comparison. Validate with factual consistency and citation coverage.
- Deep exploration. Increase search breadth or self-check rounds; suitable for high-risk decision support. Set maximum steps, maximum tokens, and timeout, otherwise cost is uncontrollable.
Agent scenarios also need to separate “thinking” from “acting”: planning steps can be deep, but state updates after tool returns should be shallow, avoiding rereading a million-token context every turn. External tools (retrieval, code execution, spreadsheet calculation) should carry verifiable facts, while the model handles orchestration and explanation, reducing the need to “memorize answers” inside ultra-long prompts.
Data and Training: Scale Does Not Prove Coverage
Pretraining token volume only indicates the order of magnitude of exposure; it does not indicate domain coverage, deduplication quality, or long-document distribution. If a million-token window is trained mostly on short text, extrapolating to the full window can cause middle forgetting, repetitive generation, and instruction drift. A safer approach is long-sequence continued pretraining, document-level packing, and targeted post-training for retrieval, summarization, and conflict detection. In alignment, separately reduce fabricated clauses and require the model to state what is missing when it does not know; otherwise long context will amplify the length of hallucinations.
Open-source and commercial-use licenses can lower the barrier to secondary development, but license text itself does not equal a reproducible training recipe. Enterprises still need security assessment, data transfer, and log retention design when adopting such models; a permissive license should not be mistaken for complete capability or compliance.
Model Selection and Acceptance Testing
Organizing tasks by “context length × reasoning depth × call frequency” is more useful than choosing sides by parameter scale.
- High-frequency, short-output, pre-cacheable context: prefer the efficient specification with prefix caching and result caching.
- Low-frequency, strong logic, toolchain required: prefer specifications with larger activation, and limit the trigger conditions for the deep tier.
- Very long source text but local questions: parse structure and retrieve first, send only relevant chunks plus a global summary to the model, and use the full window as a fallback rather than the default.
The acceptance set should come from real documents, redacted and version-fixed. Metrics should include at least: the proportion of answers traceable to source locations, key factual error rate, full-window latency percentiles, peak cache per request, and whether fallback paths are available (automatic switch to shallower reasoning or shorter context after timeout). Without these numbers, any claim of “doubling efficiency” or “using only a fraction of the original compute” cannot be reproduced.
An illustrative request strategy can be expressed as configuration rather than hard-coded in business logic:
routing:default_tier: efficientescalate_to_flagship_when:- context_tokens_gt: 200000- task_in: [legal_review, multi_hop_research, agent_plan]reasoning:direct: { max_steps: 1, budget: low }standard: { max_steps: 4, budget: medium }deep: { max_steps: 12, budget: high, timeout_s: 120 }fallback: shorten_context_then_retry
Working with General Cloud Capabilities
Long-context services usually also depend on object storage for source documents, message queues for peak shaving, container platforms for elastic replicas, and logging and monitoring to observe latency and error rates. These are general capability categories; selection focuses on quotas, isolation, and observability, not on treating the model window number as proof that the infrastructure is ready. Prefill and decode have different resource profiles and are suitable for separate pool scheduling: prefill consumes compute and bandwidth, while decode depends more on cache residency. Co-locating them on the same small instance easily causes cache thrashing.
If inference is hosted on cloud resources such as Baidu AI Cloud, the focus should still be on writing model specifications, context tiers, and reasoning tiers into explicit policies, and using monitoring to connect cache usage, queue wait, and timeout fallback. A cloud platform provides the compute and operations foundation; it does not replace your own evaluation set and cost model.
Conclusion
The value of ultra-long context is reducing manual chunking; the value of sparse activation is decoupling total capacity from per-step cost; the value of tiered reasoning is making expensive compute happen only on a small number of tasks. When combined, they must be validated with full-window latency, peak cache, factual traceability, and fallback strategy. Parameter tables and window limits can serve as design inputs, but they cannot replace these measurements. Selecting specifications by task matrix, controlling deliberation budgets, and separating source retrieval from model inference are the practices that can be deployed sustainably.
