From MLA Back to MQA: Choosing the Right Attention Architecture for the Million-Token Context Era

    As large language models scale to handle million-token contexts, the industry is witnessing a surprising architectural shift: moving away from Multi-head Latent Attention (MLA) back to Multi-Query Attention (MQA). This article explores the engineering logic behind this pendulum swing, comparing the evolution of attention mechanisms from MHA to MLA. It analyzes why MQA's simplicity outperforms MLA's low-rank compression at trillion-parameter scales, highlights key infrastructure optimizations for long-context inference, and provides practical guidance for developers to optimize costs and performance in long-context applications.

    1. The ICLR Discussion: Is Attention Architecture Truly Converged?

    At the recent International Conference on Learning Representations (ICLR), one of the most influential academic conferences in AI, a thought-provoking topic repeatedly emerged: over the past few years, the industry largely believed that the attention architecture of advanced open-source models had “converged.” Multi-head Latent Attention (MLA) was considered the de facto standard, with subsequent work expected to be merely minor tweaks. However, the latest generation of frontier models surprisingly abandoned MLA, reverting to the more “retro” design route of Multi-Query Attention (MQA).

    This shift sends a critical signal: model architecture is far from reaching its endpoint and still has massive room for improvement. For developers, understanding the engineering logic behind this “swing” is more important than memorizing specific architecture names—it directly impacts the memory footprint, inference speed, and operational costs of the models you will use in long-context scenarios.

    2. The Three Tiers of Attention: MHA → MQA/GQA → MLA

    To understand this “swing,” we must first review the evolution of attention mechanisms.

    1. MHA: The Starting Point

    Standard Multi-Head Attention (MHA) maintains independent Query, Key, and Value projections for each attention head. It offers the highest expressiveness, but at the cost of a massive KV Cache during inference. For every token generated, the Key/Value of all heads must be written to the cache for retrieval by subsequent tokens.

    Consider a model with 70 layers, 64 attention heads per layer, and a head dimension of 128. In FP16 precision, the KV Cache size per token is approximately:

    1. KV_bytes_per_token
    2. = 2 (K and V) × layers × heads × head_dim × 2 bytes
    3. = 2 × 70 × 64 × 128 × 2
    4. ≈ 2.3 MB

    This means that a 128K context requires about 300 GB of VRAM for the KV Cache alone, far exceeding the capacity of a single machine and necessitating complex distributed offloading and scheduling.

    2. MQA / GQA: Trading Sharing for Memory

    The idea behind Multi-Query Attention (MQA) is straightforward: let all Query heads share the same set of Key/Value heads. The KV Cache size instantly shrinks to 1/heads of the original (e.g., down to about 1.6% for a 64-head model). The trade-off is a loss in expressiveness and potential slight degradation in downstream accuracy.

    Grouped-Query Attention (GQA) is a compromise between the two: several Query heads share a group of KV heads, balancing quality and memory. It has therefore been widely adopted by mainstream open-source models.

    3. MLA: Low-Rank Compression for the Best of Both Worlds

    The core innovation of MLA is projecting K/V into a low-rank latent space for storage and restoring them on-demand during inference. It claims to achieve “MHA-level quality + MQA-level cache size,” leading to its widespread acceptance in the open-source community and its perception as the endpoint of architectural evolution.

    3. Why the “Swing”: The Engineering Logic Behind Returning to MQA

    Since MLA’s metrics look nearly perfect on paper, why did the latest generation of models abandon it? Based on conference discussions and public engineering practices, several highly probable explanations can be summarized.

    1. Hardware Alignment: Low-Rank Restoration is Not “Free”

    During the decoding phase, MLA needs to re-project and restore latent vectors, a matrix multiplication that consumes compute and bandwidth. When model scales leap from the 670B level to the 1.6T level, the compute per token rises significantly. The memory savings brought by MLA become diluted in the overall inference latency, while the additional compute paths it introduces become bottlenecks in the pipeline.

    2. Million-Token Contexts Change the Problem Paradigm

    MLA’s compression benefits are highly pronounced in the tens of thousands to hundreds of thousands context range. However, when the target becomes million-level tokens, the industry generally shifts towards system-level solutions like sparse attention, hierarchical retrieval, and context cache reuse. These solutions require more straightforward capabilities from the KV Cache: it must be addressable, segmentable, and evictable. The structurally simple and semantically transparent MQA-style cache is actually easier to integrate with infrastructure like paged memory management (similar to OS virtual memory page mechanisms), cache hit billing, and cross-request reuse.

    This aligns with an engineering principle: once system complexity crosses a certain threshold, subtraction in architecture is often more effective than sophisticated addition.

    3. Training Stability and Scaling Validation

    As a relatively new design, MLA lacks sufficient accumulated validation of its stability at extreme scales (trillion parameters, trillion-token training volumes). Conversely, MQA’s training dynamics and numerical behavior have been validated over years of large-scale deployment. Reverting to it is a robust choice that reduces engineering risk.

    4. The Infrastructure “Four-Combo” in the Massive Model Era

    To operationalize million-token contexts, the industry has formed four key infrastructure capabilities, which can be summarized as the “four-combo”:

    1. Inference Memory Orchestration: Through paged KV Cache and prefix cache reuse, memory utilization for long-context services is significantly improved. This is the technical prerequisite for billing mechanisms like “input cache hit discounts.”
    2. Mixed Precision & Quantization: FP8 training and low-precision inference compress unit costs while maintaining quality, supporting larger parameter scales to be served within reasonable budgets.
    3. Sparse & Hierarchical Attention: Replacing full attention with a retrieval structure of “a little exact + a lot of approximate” keeps the computational complexity of million-token contexts within a usable range.
    4. Multi-Token Prediction & Speculative Decoding: Producing multiple tokens in a single forward pass increases throughput and amortizes unit costs.

    For end-users, these four capabilities ultimately manifest as a perceivable phenomenon: million-token contexts have transitioned from mere demos to everyday production capabilities.

    5. The Cost Ledger: What Happens After Doubling Parameters

    The parameter count of the latest generation of models jumped from around 670B to the 1.6T level. Training and inference costs have risen significantly, naturally driving up prices. However, a notable commercial design is the heavy and continuously increasing discounts applied to portions of input cache hits.

    The logic here is that when a request’s prefix (system prompts, long documents, codebase context, etc.) hits the server-side cache, inference costs drop dramatically. Vendors are willing to pass these savings on to users. This is essentially using price leverage to guide users to transform their long-context applications from “re-uploading the full text every time” to a cache-friendly mode of “stable prefix + incremental suffix.”

    6. Practical Advice for Developers

    Combining the architectural and cost logic above, it is recommended to follow these patterns when developing long-context applications:

    • Fixed Prefix, Variable Suffix: Place immutable content like system instructions, knowledge bases, and code repository summaries at the beginning of the prompt and keep the text stable. This maximizes cache hit rates and directly reduces call costs.
    • Hierarchical Context Architecture: A million-token context does not mean stuffing everything into a single prompt. A more robust engineering approach is “precise retrieval (RAG) as the foundation + long context as the fallback,” allowing the model to use the full window only when global understanding is required.
    • Evaluate Real Capability Boundaries: Long-window capabilities have a gradient where it is “easy to find a needle in a haystack but hard to perform global comprehensive reasoning.” For critical business operations, build your own evaluation sets for long-document summarization and cross-chapter reasoning, rather than solely relying on the window length metrics advertised by vendors.
    • Watch Architectural Signals for Model Selection: When you observe a model systematically optimizing metrics like memory efficiency in long contexts, time to first token (TTFT), and cache billing, it is highly likely backed by the aforementioned architectural restructuring. Such models are better suited as the foundation for long-context-intensive applications.

    Conclusion

    The swing from MLA back to MQA appears on the surface to be a step backward in technical routes, but it is essentially a rational re-selection under the system engineering constraints of the million-token context era. It reminds us that in the field of AI infrastructure, “convergence” and “endgame” are dangerous words—whenever the target scenario changes (in this case, the million-token window), seemingly finalized architectures will be re-examined. For developers, understanding the memory, bandwidth, and cost logic behind these trade-offs is key to making future-proof decisions in model selection and application architecture design.