LLM Architecture Evolution: From MLA to MQA and Million-Token Context

    This article examines the shift from Multi-head Latent Attention (MLA) to Multi-Query Attention (MQA) in new open-source LLMs, explains the systems-level trade-offs behind the architectural change, and outlines the engineering work required to turn million-token context from a paper capability into a practical one.

    LLM Architecture Evolution: From Attention Innovation to Million-Token Context in Production

    1. Background: The Illusion of Architectural Convergence

    Over the past two years, the architecture of open-source LLMs appeared to converge. Several mainstream models adopted Multi-head Latent Attention (MLA), leading to a common view that innovation in attention modules had limited room left and that future work would focus on incremental improvements such as training data and post-training alignment.

    A technical report for a new flagship open-source model challenged that consensus. It abandoned the latent attention approach used in two previous generations and returned to Multi-Query Attention (MQA), combined with a series of system-level optimizations to support context lengths on the order of one million tokens. The shift sends an important signal: model architecture is far from settled. Beyond single-point innovation, system-level coupled optimization is opening a new competitive dimension.

    2. MLA vs. MQA: Two Technical Paths and Their Core Differences

    To understand the architectural shift, it helps to clarify the design motivations behind the two attention mechanisms.

    The core idea of Multi-Query Attention (MQA) is to let all attention heads share the same Key and Value projections. The direct benefits are:

    • A sharp reduction in KV cache size, easing memory bandwidth pressure during inference;
    • Less memory-access bottleneck in the decoding phase, which noticeably improves throughput for long-sequence generation.

    The trade-off is reduced representational capacity: all heads “see” exactly the same KV representations, which theoretically limits attention diversity.

    Multi-head Latent Attention (MLA) takes a different route. It compresses KV projections into a low-rank latent space, caches the compressed latent vectors during inference, and decompresses them when needed. It attempts to strike a better balance between cache size and representational capacity, and for a long time was regarded as the more advanced approach.

    But MLA has its own shortcomings:

    1. Complex computation structure: low-rank decomposition introduces extra matrix operations and places higher demands on operator fusion in inference engines.
    2. Low coupling with emerging training techniques: in scenarios such as low-precision training and sparse activation, numerical stability handling for low-rank structures is more difficult.
    3. Uncertain hardware affinity: some inference hardware is more maturely optimized for regular large matrix operations, while MLA’s decompose-reconstruct pipeline is harder to fully exploit.

    As model scale moves from hundreds of billions of parameters toward trillions, and context length moves from hundreds of thousands toward millions of tokens, these hidden costs are amplified rapidly. The criterion for architecture choice shifts from “which approach has a higher theoretical compression rate” to “which approach has a lower overall cost across the full training-inference chain.”

    3. System-Level Coupled Optimization: Why It Is Harder Than Single-Point Innovation

    The real change behind the new architecture direction is methodological: single-point innovation is giving way to system-level coupled optimization.

    Single-point innovation means making a local improvement to a module—such as attention, feed-forward layers, or normalization—verifying the gain through ablation experiments, and merging it. This approach worked when models were smaller, but in the era of very large models it faces three difficulties.

    First, local optimum does not equal global optimum. An attention variant may improve a benchmark by one point, but if it reduces training throughput by 15% or conflicts with the partitioning strategy used in pipeline parallelism, the overall gain is negative.

    Second, coupling relationships grow exponentially. Attention mechanisms must be co-designed with:

    • Optimizer state layout and gradient communication patterns;
    • Numerical ranges under mixed-precision strategies;
    • KV cache paging and scheduling during inference;
    • Load balancing for Mixture-of-Experts (MoE) routing.

    Third, validation cost is extremely high. A complete architecture validation requires large-scale pretraining, and any “let’s try it” experiment carries a massive compute cost. This requires teams to build a reliable chain of reasoning across theoretical analysis, small-scale proxy experiments, and engineering simulation.

    Therefore, the new generation model’s choice of MQA over MLA is not a technical regression. It is a re-optimization under full system engineering constraints—using a simpler attention structure to gain overall benefits in training stability, inference efficiency, and software-hardware adaptation.

    4. Million-Token Context: From Paper Capability to Usable Capability

    Jumping from hundreds of thousands of tokens to millions is not simply a matter of extrapolating positional encodings. It involves a complete engineering chain.

    1. Positional encoding and extrapolation strategy

    Ultra-long context requires positional encodings to remain separable beyond the training length. Common industry practices include adjusting the base frequency of rotary positional encodings, segmented interpolation, and continued training on long-text data. The key point: extrapolation capability must be taught to the model during training; it is not a free lunch at inference time.

    2. Memory economics of KV cache

    A KV cache for one million tokens reaches tens of gigabytes even under MQA. Feasible engineering approaches include:

    • Cache paging and swapping: borrowing from OS virtual memory ideas, managing KV in blocks and offloading cold data to host memory;
    • Prefix cache reuse: computing repeated prefixes such as system prompts and long documents only once, greatly reducing repeated overhead in multi-turn dialogue and multi-user scenarios;
    • Tiered compression: using more aggressive compression for distant tokens, preserving precision for nearby tokens and semantics for distant ones.

    3. Inference scheduling and cost model

    Memory usage for ultra-long-context requests is highly dynamic. Inference engines need to support continuous batching and preemptive scheduling; otherwise a single large request can block the entire service. From a business perspective, pricing designs such as cache-hit discounts essentially guide user traffic to align with system cache strategy—a typical case of technical and commercial co-design.

    4. Long-sequence capability on the training side

    Long-context capability must be injected during training: long-document pretraining, supervised fine-tuning on long-chain reasoning data, and an evaluation loop for long-range dependencies. Training only on short sequences and then extrapolating often leads to “lost in the middle”—significantly lower utilization of information in the middle of the context than at the beginning and end.

    5. Observations on the Chinese LLM Ecosystem

    One notable phenomenon in this round of architecture evolution is that work from several Chinese teams has clearly stimulated one another—from new attention residual structures to improved second-order optimizers to deep use of open-source operator generation tools. Technical points cite each other and iterate quickly.

    This confirms a pattern: when talent density and competitive intensity reach a certain threshold, the open-source community can produce qualitative progress. Open technical reports, reproducible code, and an active inference framework ecosystem together form the infrastructure for innovation. For enterprise users, mature cloud platform capabilities—such as elastic compute, object storage, logging, and monitoring/alerting—can lower the barrier to private deployment and inference optimization of large models, helping teams turn frontier community results into business value faster.

    6. Practical Recommendations for Developers

    1. Look at system metrics, not single-point metrics, when choosing a model: focus on end-to-end inference cost, first-token latency, and effective information utilization under long context, rather than isolated benchmark scores.
    2. Tier requirements before building long-context applications: not every scenario needs one million tokens; retrieval augmentation and ultra-long context should be combined.
    3. Pay attention to cache strategy design: prefix reuse and session-affinity scheduling often deliver greater cost benefits than switching models.
    4. Stay sensitive to architecture: competition in attention mechanisms is far from over; avoid deeply binding your stack to one specific structure.

    Conclusion

    From latent attention to a return to multi-query attention, and from hundred-thousand-token context to million-token context, the core methodology demonstrated by the new generation of open-source LLMs is global optimization under multiple constraints of compute, memory, and bandwidth. There is no “ultimate answer” in architecture—only a “current optimal solution” under specific engineering constraints. Understanding this is more valuable than memorizing any specific technical term.