Million-Token Context and Sparse MoE: A Technical Breakdown of Modern LLM Architecture

    This article breaks down how modern large language models achieve million-token context windows and trillion-parameter scale without exploding inference costs. It separates model capability into three dimensions—knowledge capacity, per-token inference cost, and task completion—then explains how sparse Mixture-of-Experts (MoE) decouples capacity from compute, how sparse attention and KV cache compression make long context affordable, and how tiered reasoning modes allocate compute by task difficulty. It also includes a context-budget implementation example and practical guidance for building agents on top of such models. The full text is provided in English below.

    Introduction: From a Parameter Race to an Efficiency Race

    Over the past two years, the narrative around large language models has mostly centered on parameter counts and benchmark scores. Recent technical progress has clearly shifted toward a different dimension: how to support longer contexts, more stable deep signal propagation, and more complex multi-step tasks under the same or even lower compute budget per token. A preview release of an open-weight model, after several delays, shipped in two size tiers, with a million-token context window across the board, along with public weights and a technical report. Setting aside the specific product, this can be abstracted into three general technical questions: how to make ultra-long context affordable, how a sparse expert structure decouples knowledge capacity from inference compute, and how multiple reasoning-effort levels serve different kinds of tasks.

    1. Breaking Down Capability: Three Independent Dimensions

    When evaluating this class of models, it helps to separate capability into three layers that do not blur into each other, rather than drawing conclusions from a single score.

    The first layer is knowledge capacity, determined mainly by total parameter count and training corpus coverage. The second is per-token inference cost, determined by activated parameters, attention complexity, and caching strategy. The third is task completion, determined jointly by reasoning effort, tool use, and how context is organized.

    The configuration in the source material is fairly representative: the larger tier has roughly 1.6 trillion total parameters with about 49 billion activated, while the smaller tier has roughly 284 billion total parameters with about 13 billion activated. Both offer a million-token context window, and the weights are released under a permissive license. Compared with the previous generation’s roughly 660 billion total parameters, total parameters grew about 2.4x, while activated parameters rose only from about 37 billion to about 49 billion. The key implication is that the gating network is sparser, fewer experts actually participate in computation per token, the addressable space of knowledge expands, and compute does not scale up proportionally.

    2. Sparse MoE: Decoupling Capacity from Compute

    The core idea of sparse Mixture-of-Experts (MoE) is to use a routing network to select a few experts per token. A typical configuration places hundreds of experts per layer while activating only a handful per token. The benefits and costs are both clear.

    On the benefit side, total parameters can grow by an order of magnitude while inference FLOPs stay roughly flat. On the cost side, routing imbalance overloads some experts while leaving others idle, so both training and inference need extra load balancing and capacity control. Common engineering mitigations include noise injection and temperature tuning in routing, expert capacity limits with drop policies, shared experts that carry general-purpose capability, and grouped routing to reduce cross-device communication overhead.

    It is worth stressing that sparse does not mean free. Memory usage still scales with total parameters, and cross-device communication from expert parallelism, along with cache management under long context, can become the real throughput bottlenecks.

    3. Million-Token Context: Complexity, Caching, and Sparse Attention

    Standard self-attention scales quadratically with sequence length, making a dense implementation at a million tokens nearly infeasible. Three approaches are widely accepted in the industry: sparse attention (computing only a subset of query-key interactions), chunking and sliding windows (limiting the receptive field while adding global tokens), and cache compression and quantization (lowering KV cache precision or applying low-rank compression).

    The approach mentioned in the source material combines the first two: it reuses a proven sparse attention design and introduces a more aggressive sparse scheme, together with residual connection modifications and a faster optimizer to improve signal stability and convergence efficiency in deep networks. The claimed result is that at a million-token setting, per-token compute is about 27% of the previous generation, and KV cache usage is about 10%.

    For developers, the direct implication is that long context becomes a schedulable resource rather than a demo feature, though it still requires engineering constraints. Below is an illustrative context-budget implementation for hard truncation and priority retention at the application layer:

    1. def build_context(system, tools, history, docs, budget=1_000_000):
    2. # Reserve room for output and reasoning overhead to avoid edge-case truncation
    3. reserve = 20_000
    4. limit = budget - reserve
    5. fixed = system + tools
    6. remain = limit - len(fixed)
    7. # Prioritize documents by relevance; keep history in reverse chronological order
    8. picked_docs, used = [], 0
    9. for chunk in sorted(docs, key=lambda c: c.score, reverse=True):
    10. if used + len(chunk.text) > remain * 0.6:
    11. break
    12. picked_docs.append(chunk.text)
    13. used += len(chunk.text)
    14. remain -= used
    15. recent = []
    16. for turn in reversed(history):
    17. if remain <= 0:
    18. break
    19. recent.append(turn)
    20. remain -= len(turn)
    21. return fixed + "\n".join(picked_docs) + "\n".join(reversed(recent))

    4. Three Reasoning-Effort Levels: Allocating Compute by Task

    Splitting reasoning into direct output, standard deep thinking, and maximum deep thinking turns the “thinking budget” into a tunable parameter. Engineering guidance:

    • Direct output mode: classification, extraction, format conversion, short Q&A, optimized for low latency and low unit cost.
    • Standard deep thinking: multi-constraint writing, code modification, routine analysis.
    • Maximum deep thinking: complex agent planning, long tool-call chains, mathematical and logical proofs.

    The comparison in the source material fits this pattern: the maximum tier improved from 34.5 to 37.7 on a high-difficulty comprehensive knowledge test, and from 85.5 to 90.2 on a hard retrieval-and-filtering task, with claims of surpassing some overseas closed-source flagships on certain dimensions. Treat such numbers as results under specific evaluation conditions, and always re-test on your own business data before deployment.

    5. Practical Notes for Agent Deployments

    In agent scenarios, the bottleneck is usually not the model itself but context organization and state management. Four actionable practices:

    1. Externalize state: keep long-task state in external storage (such as object storage, message queues, or logging services) and let the model hold only summaries and pointers, avoiding unbounded context growth.
    2. Validate in segments: define verifiable intermediate artifacts for each subgoal and roll back on failure, reducing one-shot bets across long chains.
    3. Minimize tools: tool descriptions themselves consume context, so trimming the tool set per scenario works better than piling on more tools.
    4. Observability: use monitoring alerts and distributed tracing to record token consumption, cache hit rate, and truncation counts, turning cost into an optimizable metric.

    On the deployment side, if you host inference services on a container platform, it is advisable to isolate batching and concurrency by tier, scheduling the few long requests from maximum deep thinking separately from the high-concurrency short requests of direct output mode, so they do not compete for memory and bandwidth.

    6. A Rational Conclusion

    Million-token context and trillion-scale sparse MoE represent a clear efficiency path: sparsification decouples knowledge capacity from inference compute, sparse attention and cache compression push long-context cost into an operable range, and multiple reasoning-effort levels place compute precisely on hard tasks. The recommendation for developers is to focus on three things: re-test results on your own scenarios, the engineering constraints of context and caching, and observability of inference cost. Capabilities offered by Baidu AI Cloud in model serving and compute scheduling can serve as one general-purpose infrastructure option for hosting such workloads.