Next-Generation Open-Source LLM Architectures: From Attention Redesign to Million-Token Context in Practice

    A recent wave of open-source large language models has broken the assumption that attention architectures had already converged on a de facto standard. This article explains why leading teams are moving away from Multi-head Latent Attention (MLA) back to simpler Multi-Query Attention (MQA), examines the evolution from MHA to MQA and MLA, and breaks down the four key engineering pillars that make million-token contexts practical—KV cache tiering, sparse attention, prefix caching, and training-side co-design. It also offers actionable guidance for developers building long-context applications, from cache-friendly prompt design to cost monitoring.

    1. Background: When the “Architecture Has Converged” Consensus Broke

    Over the past year, the pace of progress in the open-source LLM community has exceeded many practitioners’ expectations. For a while, the industry broadly believed that the attention architectures of mainstream open-source models had settled on a de facto standard, and that remaining work would focus on data mixtures, post-training, and alignment fine-tuning. However, a recent batch of next-generation open-source models has demonstrated through their technical reports that significant room for architectural improvement remains—and that these improvements are often “tear-it-down-and-rebuild” changes rather than incremental tweaks.

    The most telling signal: several leading teams that had long adopted Multi-head Latent Attention (MLA) abandoned this widely validated approach in their new models, returning instead to the more “primitive” Multi-Query Attention (MQA) and rebuilding a full stack of system-level optimizations around it. This choice sparked intense debate in the community and forced a re-examination of a core question: is attention mechanism selection ultimately about optimizing the model, or about optimizing the entire inference system?

    2. The Evolution of Attention: From MHA to MQA and MLA

    To understand this divergence in technical direction, it helps to review how attention mechanisms have evolved.

    1. The bottleneck of standard Multi-Head Attention (MHA)

    In standard multi-head attention, every attention head maintains its own Key (K) and Value (V) cache. During inference, KV cache memory grows linearly with sequence length, making it the primary bottleneck for long-context inference: it squeezes out memory that could be used for weights and activations, and it dramatically increases the amount of data that must be moved at every decoding step, directly limiting memory bandwidth utilization.

    2. MQA: trading capacity for bandwidth

    Multi-Query Attention (MQA) lets all query heads share a single set of K and V. The change is aggressive, but the payoff is substantial:

    • KV cache size shrinks by tens of times;
    • The amount of KV data read from memory during decoding drops accordingly, sharply increasing inference throughput.

    The cost is potential loss in model expressiveness, which is why Grouped-Query Attention (GQA) later emerged as a compromise, balancing head count against cache size.

    3. MLA: trading computation for capacity

    Multi-head Latent Attention (MLA) took a different path: it projects KV into a low-rank latent space, caching only the compressed latent vectors during inference and reconstructing them via up-projection when needed. Mathematically, this is equivalent to applying a learnable compression encoding to the KV, preserving expressiveness while drastically shrinking the cache. After its introduction, the approach was adopted by multiple mainstream open-source models and was一度 regarded as the architectural consensus of the open-source camp.

    A sketch of the cache difference between the two:

    1. # MQA: all query heads share one KV set
    2. kv_cache_size = num_layers * seq_len * 2 * head_dim # 1 copy of KV
    3. # MLA: cache low-rank latent vectors
    4. kv_cache_size = num_layers * seq_len * kv_lora_rank # compressed vectors
    5. # Reconstructed via up-projection matrices during decoding

    3. Why a “Mature Solution” Gets Abandoned: System-Level Co-Optimization Beats Point Innovations

    At first glance, the decision to drop MLA and return to MQA seems puzzling. But closer analysis reveals it as a classic system-level coupled optimization decision.

    1. A locally optimal point is not a globally optimal system

    MLA excels at the single metric of KV cache compression, but it introduces extra projection matrices and reconstruction computation. In extreme long-context scenarios (hundreds of thousands to a million tokens), this extra computation interacts in complex ways with sparse attention, paged caching, operator fusion, and other system components:

    • Up-projection breaks some opportunities for operator fusion;
    • Compressed vectors require additional engineering to stay compatible with sparse retrieval indexes;
    • On very long sequences, the projection’s own compute and memory-access overhead becomes a larger share of the total.

    MQA, by contrast, achieves lower point-level compression than MLA, but its structure is extremely simple: with few KV heads, it naturally pairs well with deep integration into sparse attention, KV page management, cross-layer cache reuse, and other system techniques. When a team controls both the model architecture and the inference engine, choosing a simpler but more malleable foundation often yields greater overall gains than choosing a scheme that is locally superior but hard to coordinate.

    2. Inference engines and models must be co-designed

    This reflects an important trend in the open-source community: the boundary between model teams and inference framework teams is increasingly blurred. Researchers with architecture backgrounds and engineers steeped in inference engines now make architectural decisions together, and they iterate on—and borrow from—each other’s improvements around shared optimizers (such as the Muon-style orthogonalized update direction that has drawn wide attention in recent years). This positive feedback loop of “talent density plus competitive intensity” is the root cause of the open-source ecosystem’s rapid qualitative leap.

    4. Million-Token Contexts in Practice: Four Key Inference Engineering Efforts

    Beyond architecture, making million-token contexts viable depends on an infrastructure-level “combination punch.” Industry practice falls roughly into four directions:

    1. Tiered and paged KV cache management

    Instead of holding the KV cache as one contiguous block of GPU memory, engines adopt paged management with on-demand swap-in and swap-out; cold data is offloaded to host memory or fast local storage, while hot data stays resident in HBM. This requires fine-grained cache lifecycle management inside the inference engine.

    2. Sparse and retrieval-based attention

    For very long contexts, letting each query attend only to a filtered subset of key tokens reduces computational complexity dramatically from quadratic. The choice of sparsification strategy (block selection, topology-based, or semantic retrieval-based) must be co-designed with cache layout—another textbook case of system-level coupling.

    3. Prefix cache reuse and pricing alignment

    For agent-style multi-turn applications, large numbers of requests share identical system prompts and conversation history. When inference services hit the prefix cache and skip repeated prefilling, costs can drop by an order of magnitude. A notable industry development: several providers have applied aggressive discounts to cache-hit pricing, substantially lowering real-world costs for long-context applications and, in turn, accelerating commercial validation of million-token scenarios.

    4. Coordinated innovation on the training side

    Long-context capability is not purely an inference problem; it also depends on training-side support: progressive sequence-length scaling, optimizer improvements targeting numerical stability (such as iterations around orthogonalized update directions), and residual connections within the attention structure to mitigate signal decay in deep networks. These efforts inform one another and together form the complete technology stack behind long-context capability.

    5. How Developers Can Ship Long-Context Applications

    For application developers who need to reliably support very long contexts, the following practices are worth adopting:

    • Cache-friendly design: Place stable content (system instructions, knowledge base summaries) at the front of the prompt to maximize prefix cache hit rates;
    • Tiered context management: Persist session history in object storage and decouple preprocessing pipelines with message queues, rather than stuffing the entire history into a single request;
    • Load testing and monitoring: Use elastic scaling on container platforms for inference instances, and track core metrics such as TTFT (time to first token), throughput, and cache hit rate through monitoring and alerting systems;
    • Cost accounting: Distinguish pricing between cache hits and misses, and design context-trimming strategies for multi-turn conversations accordingly.

    Cloud platforms provide fairly complete foundational capabilities for these scenarios. For example, comprehensive cloud service offerings—represented by providers such as Baidu AI Cloud—typically cover GPU compute containers, high-performance storage, managed model serving, and observability components. Developers can build their own long-context inference pipelines on top of these general capabilities, leaving the complexity of low-level KV management and scheduling to the platform layer.

    6. Conclusion

    The case of next-generation open-source models abandoning a widely adopted attention scheme, returning to a simpler mechanism, and rebuilding their systems around it offers a clear lesson: once the LLM race enters deep waters, real competitiveness no longer comes from any isolated technical point, but from systematic coordination among model architecture, optimizers, inference engines, and cost models. As million-token contexts move from demos into daily use, this competition around system-level coupled optimization is only entering its most exciting phase.