Architecture Deep Dive: Trillion-Parameter Sparse Multimodal LLMs with Long Context

    This article breaks down the engineering practices behind a 2.8-trillion-parameter sparse multimodal model with a 1M-token context window. It examines three core innovations: KDA lower-bounded decay parameterization for linear attention numerical stability, Quantile Balancing for auxiliary-loss-free MoE load balancing across 896 experts, and Block AttnRes for cross-layer information sharing. It also covers the multi-stage pretraining pipeline (8K to 1M) and million-token Agentic RL post-training, with practical adoption guidance for engineering teams.

    Architecture Deep Dive: Trillion-Parameter Sparse Multimodal LLMs with Long Context

    1. Background: Entering the Trillion-Parameter Sparse Era

    Around 2026, the focus of competition in large models shifted from “can it run at all” to “how to maintain training stability and inference efficiency at the scale of trillions of parameters and million-level context.” A representative technical approach in the industry is a multimodal large model built on a Mixture-of-Experts (MoE) architecture: total parameters on the order of 2.8 trillion, roughly 104 billion activated parameters per forward pass, native support for visual input, and a 1-million-token ultra-long context window.

    The challenges at this scale cannot be solved by simply “throwing more compute” at them. They are systemic engineering problems across three dimensions:

    1. Computational efficiency for ultra-long context: The complexity of attention mechanisms grows with sequence length. Traditional full attention becomes untenable at the million-token level in terms of both memory and compute overhead.
    2. Training stability for massive-expert MoE: When the number of routed experts reaches hundreds or even close to a thousand, load balancing, gradient stability, and communication overhead all deteriorate sharply.
    3. Long-horizon reasoning capability for agents: A million-token context must not only be “readable” but also support multi-step reasoning, tool calling, and other agentic tasks.

    This article addresses these three core problems, breaking down the corresponding architectural innovations and training paradigms, and distilling the three most reusable techniques.


    2. Overall Architecture Overview

    The model’s architecture can be summarized as a trinity of “attention layers + MoE layers + cross-layer information sharing”:

    • Attention module: Combines Kimi Delta Attention (KDA) with Gated Multi-head Latent Attention (Gated MLA), and enables cross-layer information sharing through attention residuals (AttnRes).
    • MoE module: Adopts the Stable LatentMoE architecture, containing 896 routed experts, paired with the SiTU-GLU activation function and a Quantile Balancing (QB) mechanism.
    • Pretraining strategy: Multi-stage context progression from 8K → 64K → 256K → 1M.
    • Post-training strategy: Million-token-level Agentic RL (agent reinforcement learning).

    The following sections examine each layer in detail.


    3. Core Innovation 1: KDA Lower-Bounded Decay Parameterization

    3.1 Pain Point: Numerical Overflow in Linear Attention

    Linear attention and its variants (such as Delta Net-style structures) offer linear-complexity advantages for long-sequence modeling, but their chunked computation contains a subtle engineering trap.

    Within-chunk computation requires scaling by the reciprocal of the cumulative decay factor Γ. When the decay factor accumulates under limited precision such as BF16, its reciprocal can severely overflow or underflow. This prevents diagonal tiles from following the standard matrix multiplication path and forces them into explicit position-pair, element-wise computation. The result: diagonal blocks cannot fully exploit Tensor Core matmul acceleration, dragging down overall throughput.

    3.2 Mechanism: From Unbounded Decay to Lower-Bounded Scaling

    In conventional approaches, log-decay typically takes an unbounded Negative-Softplus form with a range of (-∞, 0), which can theoretically extend infinitely negative and cause the reciprocal to be unbounded.

    KDA’s solution changes the log-decay to a lower-bounded Scaled Sigmoid form with a fixed lower bound of -5:

    1. g_th = g_min · Sigmoid(e_A^h · z_th), where g_min = -5

    The effect of this change: within any 16-token tile, the reciprocal scaling factor is locked within a safe numerical range, eliminating overflow.

    3.3 Benefits: Unified Dense GEMM Path, Native NoPE Extrapolation

    Comparison Dimension Conventional Approach KDA Lower-Bounded Decay
    Diagonal block computation Explicit position pairs, no Tensor Core Unified Dense GEMM with off-diagonal blocks
    Numerical stability Prone to overflow/underflow under BF16 Bounded scaling factor, safe
    Position encoding Relies on explicit position encoding Natively supports NoPE direct extrapolation to 1M
    Engineering change — Minimal, mainly at the operator implementation layer

    For developers, this technique has exceptionally high reuse value: minimal engineering change, yet a substantial boost to the efficiency of linear attention operators implemented on CUDA/CUTLASS. It does not require redesigning the entire model—only adjusting the activation function form of the decay parameter eliminates the special computation branch for diagonal blocks.


    4. Core Innovation 2: Quantile Balancing

    4.1 Pain Point: Load Balancing for Very-Large-Scale MoE

    The core problem of MoE is routing: which experts each token is assigned to. When the number of experts reaches 896, imbalanced load causes some experts to be overloaded and others idle, wasting compute and undermining training stability.

    Conventional approaches rely on auxiliary loss to encourage balanced routing, but auxiliary loss introduces additional gradient interference and, in large-expert scenarios, converges slowly and is difficult to tune.

    4.2 Mechanism: Auxiliary-Loss-Free Dynamic Load Balancing

    The core idea of the Quantile Balancing (QB) mechanism is: dynamically adjust routing thresholds via quantile statistics to achieve load balancing without auxiliary loss.

    Specifically, QB does not “softly” guide routing through an additional loss term. Instead, it directly computes quantiles based on the routing score distribution of the current batch to set capacity thresholds for each expert. This makes:

    • Load balancing an intrinsic property of the routing logic rather than an external constraint.
    • No need to tune auxiliary loss weight hyperparameters during training.
    • Fast balancing response, adapting to dynamic changes under extremely sparse conditions (selecting a few out of 896).

    4.3 Reuse Value

    The QB mechanism is a useful reference for any team adopting large-scale MoE: it removes the tuning burden of auxiliary loss while ensuring training stability under extremely sparse conditions. It is one of the key pieces determining whether very-large-scale expert MoE can actually be trained.


    5. Core Innovation 3: Block-Level Attention Residuals (Block AttnRes)

    5.1 Pain Point: Representation Bottleneck in Deep Transformers

    As model depth increases, deep Transformers face representation degradation: gradient signals attenuate during cross-layer propagation, and shallow-layer information struggles to reach deeper layers effectively. Meanwhile, cross-layer memory and communication overhead grow linearly with depth.

    5.2 Mechanism: Block-Level Design for Cross-Layer Information Sharing

    Block AttnRes changes attention residuals from “per-layer” to “block-shared”:

    • Transformer layers are divided into several blocks.
    • Attention residual connections are established at the block level rather than independently per layer.
    • Cross-layer information is shared through block-level residuals, breaking the deep representation bottleneck.

    5.3 Benefits

    • Breaks the depth representation bottleneck of deep Transformers: Block-level sharing allows smoother gradient and information flow.
    • Reduces memory/communication overhead: Compared with per-layer residuals, the block-level design entails less cross-layer communication.

    6. Training Paradigm: Multi-Stage Pretraining + Agentic RL

    6.1 Multi-Stage Context Progression

    The model uses staged pretraining to progressively expand the context window:

    1. 8K → 64K → 256K → 1M

    The necessity of this progressive strategy:

    • Training directly at 1M context makes attention compute and memory footprint extremely difficult to sustain.
    • Staged progression lets the model first learn short-range dependencies, then gradually adapt to long-range dependencies.
    • Combined with KDA’s NoPE extrapolation property, this ultimately enables direct extrapolation to 1M context.

    6.2 Million-Token-Level Agentic RL Post-Training

    After pretraining, million-token-level Agentic RL post-training is layered on top, targeting the challenge of long-horizon agent reasoning. This means the model must not only “understand” a million-token context but also perform multi-step planning, tool calling, state tracking, and other agentic behaviors within it.


    7. Engineering Adoption Recommendations

    For teams looking to borrow these techniques in their own systems, the following priority order is recommended:

    First priority: KDA lower-bounded decay parameterization

    • Changes are concentrated at the operator layer, with low risk and direct benefits.
    • Suitable for teams that already have linear attention implementations and want fast validation.

    Second priority: Quantile Balancing

    • If you already use an MoE architecture and are struggling with auxiliary loss tuning, experiment with QB first.
    • Requires implementing quantile statistics and dynamic threshold logic.

    Third priority: Block-level attention residuals

    • Involves model structure design, a larger change.
    • Suitable for scenarios where depth exceeds a certain threshold and deep representation degradation has been observed.

    At the training strategy level:

    • Multi-stage context progression should be treated as a standard workflow for long-context training.
    • Agentic RL requires supporting long-horizon task datasets and reward design.

    8. Summary

    The engineering practice of trillion-parameter sparse multimodal large models is fundamentally about solving three dimensions simultaneously: attention efficiency, MoE stability, and long-horizon reasoning capability. KDA lower-bounded decay parameterization solves the numerical bottleneck of linear attention, Quantile Balancing solves load balancing for very-large-scale experts, and block-level attention residuals solve deep representation degradation. Together, they support stable training at million-level context under extremely sparse conditions.

    For developers, these techniques are not limited to trillion-scale models—the parameterization tricks, balancing strategies, and residual design ideas are equally instructive for small- and medium-scale models. Understanding the underlying mechanisms matters more than memorizing specific parameters.