Open-Source LLM Architecture Analysis: From MLA to MQA and Million-Token Context in Practice
A recent open-source flagship model’s return from MLA to MQA shows that attention architecture is far from converged. This article compares MHA, MQA, and MLA across KV-cache size, expressiveness, computational graph complexity, and prefill/decode decoupling; explains why system-level coupling with attention, parallelism, compiler and operator ecosystems, and training stability matters; and summarizes engineering practices for million-token context, including tiered KV-cache management, sparse and block attention, prefix reuse, and cost control.
1. Background: A New Generation of Open-Source Models Reshakes Architecture Choices
A recently released generation of open-source flagship models has drawn broad discussion. On tasks such as mathematical reasoning, code generation, and agent instruction execution, it shows clear improvements over the previous generation, with especially notable progress in reducing hallucinations. More important than the benchmark numbers, however, is the architectural signal: this model has abandoned the MLA (Multi-Head Latent Attention) used in the previous two generations and returned to the MQA (Multi-Query Attention) route.
The industry had generally assumed that open-source attention architectures had converged on MLA, leaving only minor engineering refinements. This “return” indicates that the design space for attention mechanisms is far from capped, and architectural innovation remains a core lever for improving inference efficiency and cost structure.
2. MLA and MQA: Two Compression Ideas with Different Targets
To understand this architecture switch, start with the shared goal of both approaches: reducing the storage and bandwidth pressure of the KV cache. The difference is what gets compressed.
1. Problems with the MHA baseline
Standard multi-head attention caches the K and V tensors of every layer for every token during autoregressive decoding. Assume the model has L layers, a per-layer KV dimension of 2 × n_kv × d, sequence length s, and batch size b. The total KV cache size is:
kv_cache_bytes = b * s * L * (2 * n_kv * d) * dtype_size
When sequence length reaches hundreds of thousands or even millions of tokens, this quickly overwhelms GPU memory and makes memory bandwidth the throughput bottleneck during decoding.
2. MQA: Compressing the number of KV heads
MQA makes all query heads share the same set of K and V heads, reducing n_kv from dozens to 1. This brings substantial gains during decoding: the KV cache shrinks to roughly 1/n_h of the original size, memory access drops sharply, and decoding throughput improves significantly. The cost is reduced expressiveness: the shared K/V becomes an information bottleneck for all query heads, and quality degradation may be observable.
3. MLA: Compressing the representation dimension
MLA takes another path. It does not reduce the number of KV heads. Instead, it projects K and V into a low-rank latent space, caches the compressed latent vectors, and restores them through up-projection when needed. This preserves the expressiveness of the multi-head structure while compressing the cache to a smaller scale. However, it has a well-known engineering challenge: the form coupling between up-projection and RoPE positional encoding constrains optimizations such as matrix absorption and makes the computational graph more complex.
4. A comparison overview
| Dimension | MHA | MQA | MLA |
|---|---|---|---|
| KV cache size | High | Very low | Low |
| Expressiveness | Strongest | Reduced | Relatively good |
| Computational graph complexity | Simple | Simple | Complex |
| Prefill/Decode decoupling friendliness | Medium | High | Medium-low |
Returning from MLA to MQA is essentially replacing “training-side expressive compression” with “inference-side extreme memory-access compression,” making way for ultra-long context and large-scale concurrency.
3. Why System-Level Coupled Optimization Is Harder Than Point Innovation
Architecture choice is never an isolated paper decision; it is a system-level coupling problem.
1. Coupling with the attention mechanism
If MLA continues to evolve, RoPE and low-rank decomposition compatibility must be solved. If the system switches to MQA, quality loss must be compensated through more aggressive parallelism, sparse attention, or block computation. The two routes pull downstream components in completely different directions.
2. Coupling with parallelism strategy
MQA’s extremely small KV cache makes Sequence Parallel, Radix-style cache reuse, and very large batch decoding easier to apply. MLA’s latent dimension and up-projection constraints limit certain parallel partition dimensions.
3. Coupling with the compiler and operator ecosystem
Inference frameworks differ in how deeply they support operators. Some leading approaches make deep use of community open-source tile-level programming languages and rewrite critical kernels—such as kernels fusing attention, quantization, and communication—at the low level to extract hardware limits. This work depends on substantial infrastructure investment and is a real moat for top teams.
4. Coupling with training stability
A new architecture means new initialization, new learning-rate adaptation, and possibly a new optimizer. Recent work improving the Muon primitive reflects the trend that optimizers and architectures must be adjusted together: parameter-group scales and gradient normalization methods must fit the loss-surface characteristics under the new architecture.
4. Key Engineering for Bringing Million-Token Context into Reality
Ultra-long context cannot be delivered by “changing attention alone.” It usually requires several layers working together.
1. Tiered KV-cache management
- Keep hot data in HBM and offload cold data to main memory or even object storage.
- Use prefix-tree-based cache reuse so multi-turn conversations and multi-branch sampling can share prefix KV.
- Price or prioritize by cache hit rate to encourage users to reuse system-level prefixes.
2. Sparse and block attention
At one million tokens, O(n²) computation is unacceptable. Common industry approaches include block linear attention approximation, retrieval-based token selection, and hybrid sliding-window plus global-token schemes. These are co-designed with the underlying attention implementation; MQA’s low-bandwidth characteristics are particularly favorable here.
3. Example call scenario
# Pseudocode: prefix reuse under ultra-long contextprefix_tree.insert(hash(system_prompt + doc_chunks))session_kv = prefix_tree.match(user_query) # Skip recomputation on a hitresponse = engine.generate(user_query,kv_cache=session_kv,max_window=1_000_000)
4. Balancing cost and experience
Ultra-long-context inference is extremely expensive. Leading models often balance it through tiered pricing (higher tiers for long-context windows), cache discounts, and distinctions between Pro and standard tiers. For developers, the most direct cost-reduction method is to design prompt structure carefully and place invariant content at the front to maximize cache hits.
5. Observation: A Qualitative Shift in the Open-Source Community
The most notable aspect of this round of progress is not a single result but the chain reaction inside the community: a latent-state compression structure proposed by one lab is improved by another team and republished, with the original paper team following up; optimizer primitives are cross-improved among multiple teams; and infrastructure such as tile-level programming languages is deeply adopted by top teams and then fed back into the broader ecosystem. Once talent density and competition intensity reach a certain threshold, the open-source model community shows a qualitative shift of “mutual stimulation”—every public technical report becomes the starting point for the next iteration.
6. Conclusion and Practical Recommendations
For frontline developers and engineering teams, the lessons from this architecture evolution can be summarized as follows:
- Do not treat architecture convergence as settled. The memory-access orientation of attention mechanisms (cache-oriented design) will keep evolving as inference share rises.
- Include inference cost and cache behavior as first-class metrics when evaluating models. Hit rate, throughput, and cost per token often affect business outcomes more than leaderboard scores.
- Use general-purpose capabilities when building applications on cloud platforms. Standard combinations such as object storage, container platforms, monitoring and alerting, and logging services free teams to focus on prompt engineering and cache-friendly design.
- Pay attention to system-level coordination. Integrated design across models, parallelism strategies, operator implementations, and schedulers is key to bringing long context into production.
Architecture has no endpoint, only tradeoffs. The next moment of “abandoning consensus” may not be far away.
