← All engineering notes

Long context · 2026-11-13

Making a million tokens usable

A million-token context is a capacity, communication and scheduling problem before it is a model feature. We do the KV accounting first, then take each model apart.

1,045,368input tokens, three needles retrieved
710 → ≈195s, GLM-5.3 cold first token at 1M
12.4Mtoken KV pool, Kimi-K3 DCP8

Start with the KV bill

Every token in context leaves state behind. How much state each model keeps per token decides how many long requests fit on a machine at the same time, and therefore what kind of parallelism we need.

ModelKV per tokenKV pool (measured)1M cold first tokenKey measure
GLM-5.3≈55 KB1.12M on decode: one 1M request per node at a time194–200 sPipeline-parallel prefill; decode KV-wait timeout 300 → 1,800 s
DeepSeek-V4.1MLA compressed2.2M152–233 sFixed an indexer out-of-memory; long-request admission and length-aware placement
GLM-5.3-Flash≈31 KB2.415M per replica174 sSingle-socket TP4 to avoid the cross-socket link
Qwen3.8≈24 KB≈1.05M811–825 sYaRN ×4; KV pool cap still to be raised (target 600 s)

Needles hidden at the start, middle and end with IDs; every run gets a random prefix so the cache cannot help.

The Qwen row is honest about a gap: its cold first token is still above our 600-second bar, and the fix (raising the KV pool cap) is not done yet.

Why Kimi-K3 is friendly to long context

Kimi-K3 mixes two kinds of attention. Only 24 of its 93 layers use MLA, whose KV cache grows with the context. The other 69 use KDA, which keeps a fixed-size state no matter how long the input is. Between pipeline stages, only a few KB of activations per token cross the network.

Kimi-K3 · 93 layers24 MLA layers: KV cache grows with context length69 KDA layers: fixed-size stateLayer order is schematic. Only about a quarter of the layers pay a per-token KV cost.
Fig. 1 · Kimi-K3 layer types. Long context costs KV on about a quarter of the layers.

On two H200 servers we enabled decode context parallelism across eight GPUs (DCP8), which splits one request's KV into eight shards. The KV pool reached 12.4 million tokens. A 1,045,368-token input retrieved all three needles in 167 seconds. The trade-off: no speculative decoding in this pool, so a single request runs at 61 tok/s.

Kimi-K3 · 2×H200 · DCP8 · 1M context8×H200 (141 GB)Layers 1–47 (47)RDMA8×H200 (141 GB)Layers 48–93 (46)1–4748–93GPUs161M retrieval1,045,368 tok · 167 sNeedles3 / 3KV pool12.4MSingle request61 tok/s
H200 · 141 GBH100 · 80 GBRTX 6000D · 84 GB · PCIeRDMA / RoCETCP
Fig. 2 · The long-context pool for Kimi-K3.

GLM-5.3: prefill and decode want different shapes

For GLM-5.3 we split prefill and decode onto different machines with different parallelism. Prefill runs as an eight-stage pipeline, so each layer's all-reduce becomes a point-to-point hand-off between stages. Decode uses tensor parallelism plus context parallelism so a 1M-token KV can be spread over several GPUs. Cold first token at 1M dropped from 710 s to about 195 s (194–200 s across runs), with 8 of 8 needle requests correct.

GLM-5.3 · heterogeneous PD disaggregation · 112 GPUsGatewaysession affinityadmissionPrefill × 8 nodes · PP878 layers cut into 8 stages, one per GPUper-layer all-reduce becomes stage-to-stage P2PDecode × 6 nodesTP8 + DCP4 + MoE-TP8EAGLE speculative decoding · fp8 KVKV over 8 × 400G RDMAProduction deployment, Oct 18: 8 prefill + 6 decode nodes. Weights NVFP4, KV fp8, KV transfer via Mooncake.
Fig. 3 · GLM-5.3 production layout.

One more lesson from that work: a decode worker that waits for a 1M-token KV transfer needs a long enough timeout. We raised it from 300 to 1,800 seconds; with the old value, the longest requests failed even though everything else was correct.

Data & sources

TestObserved resultScope
Kimi-K3 retrieval1,045,368 input tokensThree targets retrieved · 167 s
GLM-5.3 cold first token194–200 s8/8 needle requests correct
Kimi DCP8 KV pool12.4M tokensCapacity, not a single-request length

October 2026 engineering measurements on the stated hardware and workload. They are not a cross-model ranking or a service-level guarantee.

This work runs underneath Zenith Tokens.

Try Zenith Tokens