The Evolution of LLM Attention: Moving Beyond MLA to Make Million-Token Context Practical
This article explains why million-token context is fundamentally a memory and bandwidth problem rather than a larger window, and how the KV cache drives that cost. It compares Multi-Query Attention (MQA), Latent Attention (MLA), and a redesigned multi-query-style approach that drops MLA in favor of shared key-values, gating, and local windows. It also covers system-level coupling across cache paging, operator design, parallelism, and scheduling, plus the hidden roles of optimizers and compiler layers, and ends with practical guidance on cache budgeting, real-traffic evaluation, prefix reuse, cloud services, and gradual rollout.
1. The Starting Point: Million-Token Context Is a Reallocation of Memory and Bandwidth, Not a Bigger Window
When people talk about million-token context becoming real, the hard part is not raising the maximum sequence length number. It is that the intermediate state of attention—usually called the KV cache—grows linearly with sequence length. For every layer and every attention head, you must cache the Key and Value vectors of historical tokens. The size is roughly:
KV_bytes ≈ 2 (K and V) × layers × kv_heads × head_dim × seq_len × batch × dtype_bytes
Raise seq_len from 4K to 1M with everything else fixed, and the cache grows 250x. Two consequences follow directly. First, memory is consumed by the cache, compressing the space left for weights and activations. Second, generating each new token requires reading the entire history cache again, so memory bandwidth becomes the main bottleneck in the decode phase. Once you see this, you understand why every change to the attention mechanism is essentially a trade between cache size and read cost.
2. The Essential Difference Between the Two Technical Routes
Early native long-context designs used Multi-Query Attention (MQA): all query heads share one set of keys and values, shrinking the cache to a fraction of the head count, at the cost of weaker expressiveness and poorer training stability. The field then proposed Latent Attention (MLA): compress keys and values into a low-dimensional latent space and up-project them at inference time, trading a low-rank approximation for a balance of cache compression and quality retention. For a while it was seen as the mainstream convergence point for long context.
A recent technical report from an ultra-large-scale model, however, shows that its latest generation abandoned latent attention and adopted a redesigned multi-query-style scheme, combined with stronger positional and gating designs. The signal matters: architectures have not converged, and the gains from a single-point innovation are being absorbed by system-level coordination. The contrast can be abstracted as pseudocode:
# Latent attention: cache low-rank latent vectors, up-project when neededcache = compress(k, v, rank=r) # small size, but extra projection cost per stepk_t, v_t = upsample(cache) # compute traded for space# Multi-query style: all heads share one set of keys and values, with gating and a local windowcache = shared_kv(k, v) # smaller size, more regular readsout = gated_attention(q, cache, local_window=w)
The former “saves” in capacity; the latter “saves” in bandwidth and read continuity. When context length reaches the million-token scale, the bandwidth term is often more fatal than the capacity term. That is the engineering motivation for the rollback.
3. Why System-Level Coupled Optimization Is Harder Than Single-Point Innovation
A single-point innovation can prove its gains on one benchmark table. System-level coupled optimization requires the model structure, parallel partitioning, operator implementation, and cache scheduling to align at the same time. Take long-context inference: at least four things must be handled together.
- Cache paging and reuse: split the KV cache into fixed blocks allocated on demand to reduce fragmentation, and let requests with identical prefixes share cache;
- Operator and structure co-design: once an attention variant changes, kernel functions, tensor layouts, and communication primitives must all be rewritten;
- Parallel strategy matching: the combination of sequence-dimension and head-dimension partitioning determines whether communication volume can be hidden behind computation;
- Scheduling and batching: when long and short requests are mixed, avoid letting long requests block the whole batch.
If any one piece is mismatched, theoretical cache compression can be canceled out by an actual drop in throughput. This is the real meaning of the judgment that “there is still room for architectural improvement”: competition has shifted from proposing an elegant structure to tuning structure, kernels, and scheduling as a whole.
4. The Hidden Battlefield of Optimizers and the Compiler Layer
The other half of long-context training is the optimizer. Matrix-based adaptive optimizers (a class of methods centered on a momentum matrix) can improve convergence efficiency in ultra-large-scale training, but their state overhead and communication volume are far higher than element-wise adaptive methods. To make them practical, they need sharding, low-precision states, communication compression, and similar techniques. Engineering usually focuses on three points: the share of memory taken by states, communication volume per step, and stability under small batches.
The compiler and operator layer is equally critical. Intermediate-layer tools represented by tensor-level programming and automatic scheduling are increasingly used by teams as an alternative path to hand-writing high-performance kernels: express blocking and pipelining in a high-level description, and let the compiler handle scheduling and vectorization. For long context, the value of such tools is fast iteration of attention variants without rewriting the entire kernel set for each structure.
5. Practical Selection and Deployment Recommendations
- Build a cache budget table first: work backward from the target context length, concurrency, and precision to estimate memory usage, and confirm whether a cache compression scheme is needed;
- Evaluate with real traffic: long-context gains must be measured jointly by time to first token, time per token, and throughput; looking at quality scores alone leads to misjudgment;
- Prioritize prefix reuse: in multi-turn dialogue and document Q&A scenarios, the prefix cache hit rate often brings larger gains than fine-tuning the structure;
- Combine general cloud capabilities: use container platforms to host inference services, object storage to hold long documents, message queues to smooth request peaks, and logging, monitoring, and alerting to locate long-tail latency;
- Roll out gradually: validate the stability of a new attention structure at medium context first, then scale up to the million-token level step by step, avoiding a one-time full switch.
6. Conclusion
Making million-token context practical is not a single-point victory for one module. It is the combined result of the attention structure, cache management, optimizers, and the compiler toolchain. Abandoning the existing mainstream scheme and returning to a more “plain” shared key-value route shows precisely that engineering constraints are shaping model structure in reverse. For developers and enterprise users, the pragmatic path is to first account clearly for memory and bandwidth, then let observable metrics drive architecture and deployment decisions.
