Article

Why a million-token context is not expensive: hybrid attention and the KV cache bill

Between late November and early December 2026, three open-weights releases gave the same kind of answer. Amazon Ergo mixes 48 sliding-window layers with 16 global NoPE layers in a 3:1 pattern. Ai2's Olmicro uses 80% Gated DeltaNet recurrent layers plus 20% full attention and drops positional encoding. China Telecom's Xing4.1-Preview pairs MLA with DeepSeek sparse attention. This article works through the KV cache arithmetic from published configurations to show where the cost of long context actually sits, what hybrid designs buy, and what they give up.

One-line summary

Long context is expensive not because the model has to read more text, but because every layer stores a key and a value for every past token. Hybrid attention exists so most layers do not have to.

The long-context bill is written on the KV cache ​

A common misunderstanding: longer context costs more because the model processes more tokens. That is only half true. Prefill compute does scale with tokens, but what makes long context unaffordable to serve is the KV cache that decoding must re-read on every step.

In a standard transformer, every layer and every attention head stores a key and a value for each token in history. Double the input, double the cache. Double the concurrency, double it again. Memory is finite, so long-context models end up with very low concurrency: one user runs fine, ten users at once run out.

Using Amazon Ergo's published configuration makes the arithmetic concrete. Ergo has 64 layers, 8 KV heads and a head dimension of 128 in a GQA layout. At BF16, each token costs 8×128×2 values per layer, which is 4,096 bytes.

ScenarioCalculationKV cache for one 1M-token sequence
64 layers, all global attention64 × 4,096 B × 1,000,000about 256 GiB
Ergo as built: 16 global + 48 window-512 layersglobal 16 × 4,096 B × 1M ≈ 64 GiB; window layers fixed at 48 × 4,096 B × 512 ≈ 96 MiBabout 64 GiB
Global layers stored in MXFP4roughly halved againabout 32 GiB

This is an order-of-magnitude estimate from published configuration, without framework overhead, activations or fragmentation, and without the draft model's cache. It still shows the difference: full attention needs about 256 GiB for a single million-token sequence, nearly impossible on one machine; the 3:1 hybrid brings the same sequence down to the 64 GiB class, which is servable.

Ergo's published structure is 48 sliding-window layers (window 512, RoPE) plus 16 global layers without positional encoding, one global layer every fourth. Window layers are bounded by the window, not the context; only global layers grow linearly. Cost control is, in essence, compressing linear growth into a handful of layers.

Three routes, one goal ​

The three releases from late November to early December illustrate three ways to cut.

ModelHybrid schemeContextPublished benefit
Amazon Ergo (Dec 1)48 window-512 layers + 16 global NoPE, 3:11Mup to 76,115 tokens/s per GPU (Vera Rubin, MXFP4, specific trace set)
Ai2 Olmicro (Nov 30)~80% Gated DeltaNet recurrent + 20% full attention, no positional encoding64K2.7B needs 1.55 GiB of context memory at 65,536 tokens, versus 7.50 GiB for an equivalent all-attention model
China Telecom Xing4.1-Preview (Nov 25)MLA + DeepSeek sparse attention (DSA)1M nativeprefill throughput 4.68x the MLA-only baseline in simulated conditions

Each route is a different way of not storing:

  1. Sliding window does not store distant things. It sees only the last 512 tokens, so history length no longer grows the cache; the price is that information beyond the window arrives only indirectly through layer stacking.
  2. Recurrent layers store a summary, not detail. Gated DeltaNet compresses history into a fixed-size state, so cache is independent of length; the price is lossy compression and weaker exact recall.
  3. Sparse attention does not store what it will not use. It remains attention, but computes and stores only selected positions; the price is that routing must be right, or information is lost.

All three do the same thing: turn memory that grows linearly with length into a constant-size summary plus a small amount of exact memory.

Why 3:1 versus 4:1 is not arbitrary ​

Ergo is 3:1 (48 window layers plus 16 global). Olmicro is 4:1 (80% recurrent plus 20% full attention). The difference looks small but is not.

Global or full-attention layers carry exact memory. A lower ratio saves cache but weakens exact recall; a higher ratio is steadier but approaches pure attention in cost. The empirical band tends to sit between 3:1 and 5:1; going further saves little while quality starts to bend. Ergo needs stronger long-range alignment for 1M context and 128K output, so it took the conservative 3:1. Olmicro targets 64K with a 2.7B model, where 4:1 is the better trade.

There is a detail in how the global layers are placed. Ergo inserts one every fourth layer, so window layers are evenly punctuated rather than clustered. Even spacing keeps the path short from any local window to the layer that summarises it; if all global layers sat at the end, early window information would travel much further before being seen.

Olmicro's numbers belong in a budget sheet ​

Ai2 published the cleanest controlled comparison of this release cycle. Five sizes (275M, 450M, 810M, 1.4B, 2.7B) share one recipe: about 80% Gated DeltaNet layers, 20% full attention, arranged 4:1, with positional encoding removed entirely.

At 65,536 tokens, the 2.7B model's context memory is 1.55 GiB. Comparisons: an equivalent all-attention model needs 7.50 GiB, SmolLM3 3B needs 4.50 GiB, Llama 3.2 3B needs 7.00 GiB. On the same card, the hybrid can hold roughly four to five times the concurrency of a pure-attention model of similar size. That is the difference that decides unit economics, more than any benchmark score.

Dropping positional encoding is not a cosmetic choice either. Positional encodings distort beyond trained lengths and are usually the first thing to break when extending context. Window layers plus global layers without positional encoding make length extrapolation simpler, at the cost of requiring the model to infer order from content, which raises the bar on data and structure design.

Worth noting as a control: Olmicro 2.7B averages 56.5 on OlmoBaseEval, against 56.7 for SmolLM3 3B, which trained on more than twice the tokens. The hybrid design does not appear to have hurt short-context quality.

What you pay for it ​

Hybrid attention is not free. The costs concentrate in three places.

First, exact recall weakens. Window layers cannot see past 512 tokens and recurrent layers compress history into a fixed state. For tasks like finding a clause number in a contract from 300,000 tokens ago, hybrid designs are less reliable than full attention. That is why global layers must remain: they are the exact-lookup fallback.

Second, structural complexity rises. Different layer types mean different parallelism, different cache management, different kernels. Ergo ships MXFP4, MXFP8 and BF16 weights, and both SGLang and vLLM had to write dedicated support. The engineering cost migrates into the serving stack.

Third, benchmarks need recalibration. Classic long-context tests such as needle-in-a-haystack measure exact retrieval, a dimension where hybrid designs are structurally weaker. What should be measured is long-document comprehension and multi-step reasoning over distributed evidence. Judging a new architecture with an old leaderboard tends to mislead.

Three practical rules for long-context teams ​

  1. Compute cache before choosing a model. Take published layer count, KV heads, head dimension and context length, estimate cache per sequence, then divide by per-card memory to get a theoretical concurrency ceiling. That number predicts your bill better than the "supports 1M context" label.
  2. Match the structure to the task. For exact citation (contracts, regulations, codebase retrieval), prefer full attention or a high share of global layers. For long-document synthesis and multi-round evidence gathering, hybrid designs are the better trade.
  3. Put quantization in the budget. Ergo ships MXFP4 and MXFP8 directly, which can halve global-layer cache again; Olmicro's 1.55 GiB is for its default configuration. The same model at different quantization often differs by a factor of two in serving cost.

Boundaries ​

Ergo's layer count, KV heads, head dimension, the 48+16 window and global layout and the 1M context come from the official blog and the SGLang and vLLM technical posts. Olmicro's 4:1 hybrid, lack of positional encoding and the 1.55 / 7.50 / 4.50 / 7.00 GiB figures come from Ai2's release material and Hugging Face blog coverage; its pretraining token range is 423B to 5.07T. Xing4.1-Preview's MLA+DSA and the 4.68x prefill figure are from the official technical report, a vendor self-measurement. The KV cache arithmetic at the top is an estimate from published configuration at BF16, excluding framework overhead and activations; real values vary with implementation, quantization and fragmentation. The 76,115 tokens/s result is SGLang's measurement on Vera Rubin with MXFP4 on the SemiAnalysis AgentX trace set and does not generalise to arbitrary workloads. This article contains no local reproduction and is not a procurement recommendation.

Sources ​