In this series / On this page· 5 of 18
Serving in Production
  1. 1. Disaggregated Serving: Dynamo, llm-d, and When Splitting Prefill from Decode Pays
  2. 2. TTFT, ITL, Goodput: Measuring What Users Feel
  3. 3. Benchmark an Inference Server Without Lying to Yourself
  4. 4. Expert Parallelism, and What DeepEP Does for It
  5. 5. Serving Kimi K3.1 Pro: The State per Request, the Indexer's Cost, and Where 1M Tokens Fit
  6. 6. Other Users' Data in the KV Cache: What Cloudflare's GLM-5.3 Incident Teaches Operators
  7. 7. Flow Control in the Serving Stack: What llm-d, Dynamo and AIBrix Do When the Fleet Is Full
  8. 8. Context Parallelism for Long-Context Serving: PCP and DCP in vLLM and SGLang
  9. 9. Several Models, One GPU: Time-Slicing, MPS, MIG, and What CUDA 13.4's Memory Caps Change
  10. 10. Serving Mistral Large 4: What Its Cache Costs and Where It Fits
  11. 11. Prefix-Aware Routing Across Replicas: Kubernetes Service, Dynamo's KV Router, the llm-d EPP and Kinference
  12. 12. Serving Ripple-65B: What a Dense Model with 1M Context Costs, and When It Beats an MoE
  13. 13. Cost per Million Tokens, Computed: GPU-Hours, Utilization, and the Cache
  14. 14. Kinference at alpha.7: What Buoyant's Inference Control Plane Does, and What It Reuses
  15. 15. Splitting Off the Vision Encoder: When Encoder Disaggregation Pays in vLLM
  16. 16. The Cache Hit That Changed the Answer
  17. 17. Prefix Caches That Collapse Under Bursts, and the Session Cap That Prevents It
  18. 18. MLPerf Endpoints v1.0: How to Read an Agentic Inference Benchmark
5 of 18

Serving Kimi K3.1 Pro: The State per Request, the Indexer's Cost, and Where 1M Tokens Fit

Kimi K3.1 Pro's cache per token, its fixed delta-rule state per request, what the indexer costs, and when TP8, DCP8 or a P/D split pays.

21 min readUpdated
A blueprint drawing of a gantry riding along a long cache bed and shining a gold light onto a row of small index keys, while the full cache rows of a few chosen tokens float above the bed in gold over their empty slots.
Kimi K3.1 Pro's indexer scans every token's small key, then reads the full cache of only the tokens it picks. Kimi and its logo are trademarks of Moonshot AI.

The Model Library card gives Kimi K3.1 Pro 34 KB of cache per token; vLLM stores 16,992 bytes and SGLang 18,912. Neither number decides how many agents fit on eight GPUs. A fixed delta-rule state of 56 MB per request per GPU does, as much as the cache of a 3,300-token request, so the arithmetic that sizes this model has two terms, and the second one is the one most guides forget.

What the server holds

The release at 6d0a020 is 1,561 GB in 96 shards: routed experts in MXFP4, everything else in BF16. Its 93 layers keep K3's split, drawn on the Kimi K3.1 Pro card: 69 Kimi Delta Attention (KDA) layers that carry a fixed recurrent state, and 24 MLA layers that keep a growing cache. The new part is dsa_config: each of the 24 MLA layers now has a DeepSeek Sparse Attention indexer (32 heads of 128, top 2,048 tokens, no RoPE, a LayerNorm on the key). With index_topk_freq: 1, every layer selects its own tokens; our first piece on K3.1 Pro covers the release. num_nextn_predict_layers is 0: no draft layer ships, and the drafts both engines use are third-party previews. The license is K3's with the name changed in two lines.

vLLM's port keeps the query and latent down-projections, the indexer, the latent-MoE projections, the router and the vision tower whole on every rank (dsa.py, model.py). Read from the safetensors headers, they add up to 12.75 GB, so TP8 puts 206.3 GB on each GPU, not 195. That fits only 288 GB parts: B300, GB300, MI355X. H200s need TP16 (109.5 GB per GPU), H100s TP32 (61.1 GB).

Bytes per token, per engine

Per token, each of the 24 DSA layers stores one MLA latent row and one index key. The key is 128 FP8 values and one FP32 scale, 132 bytes, in both engines. The latent row depends on the engine:

Layout Latent + key Per token At 1,048,576 tokens Where
Per-tensor FP8 576 + 132 16,992 B 17.8 GB vLLM default on B200 / B300 / GB300
fp8_ds_mla 656 + 132 18,912 B 19.8 GB SGLang on main (CUDA and ROCm); vLLM on MI355X and other non-FlashInfer paths
NVFP4 latent 352 + 132 11,616 B 12.2 GB vLLM --kv-cache-dtype nvfp4_ds_mla
NVFP4 latent, MXFP4 keys 352 + 68 10,080 B 10.6 GB vLLM, plus indexer_kv_dtype: mxfp4
BF16 latent, FP8 keys 1,152 + 132 30,816 B 32.3 GB not a default anywhere
BF16 latent and key (the card's figure) 1,152 + 256 33,792 B 35.4 GB stored by no engine

vLLM picks per-tensor FP8 because FlashInfer's sparse MLA kernel, its default on Blackwell, reads plain FP8 rows; anywhere else the port turns auto or fp8 into fp8_ds_mla (config.py). SGLang's main pins K3.1 to flashmla_kv on CUDA and triton on ROCm, both reading DeepSeek V3.2's scaled row: 512 FP8 values, four FP32 scales and 64 BF16 RoPE values (overrides.py, dsa_quant_k_cache.py). Only the kimi-k3.1-day-0 branch adds TRT-LLM and Prims-TS paths with 576-byte rows.

K3 cached 13,824 bytes per token in FP8. The index keys add 23% in FP8 (22% in BF16, the card's figure). Under TP both rows are copied on every GPU; DCP divides them, index keys included, as in Serving Mistral Large 4. SGLang needs its day-0 branch for it.

kimi_k31_kv.py reads config.json and the safetensors headers at the pinned revision (HTTP range requests, standard library, about a minute) and prints every number in this piece:

$ python3 kimi_k31_kv.py
# … (excerpt)
  vLLM FP8 (per-tensor, SM100)       24 x (576 + 132) = 16,992 B (16.59 KiB; 17.8 GB per 1,048,576 tokens)
  SGLang FP8 (fp8_ds_mla, FlashMLA)  24 x (656 + 132) = 18,912 B (18.47 KiB; 19.8 GB per 1,048,576 tokens)
# …
KDA state per request: 69 x 96 x 128 x 128 x 4 B = 414.0 MiB recurrent (FP32; 207.0 MiB in BF16) + 14.55 MiB conv (BF16) = 449.4 MB
  per GPU at TP8: 56.17 MB (51.75 MiB recurrent); unchanged by DCP
# …
checkpoint 1561.2 GB, replicated under TP 12.75 GB
  TP8: weights per GPU 206.3 GB (192.1 GiB)

The state per request

Each KDA layer keeps a 128 × 128 recurrent state per head for every request, whatever its length, plus the last three positions of its q, k and v short convolutions. Both engines hold the recurrent part in FP32 by default: 69 × 96 × 128 × 128 × 4 bytes is 414 MiB, and the conv windows add 14.6 MiB, 428.6 MiB or 449 MB per request. The card's 232 MB is the BF16 figure. Tensor parallelism splits it by head, 56 MB (53.6 MiB) per GPU at TP8; SGLang's "~52 MB per request per rank" is the 51.75 MiB recurrent part. DCP divides tokens, and the state has none, so DCP8 leaves it at 56 MB (When Most Layers Stop Caching covers the mechanism). These figures are without speculation: vLLM's conv windows grow by a position per speculative token (mamba_utils.py), so the five-token DSpark launch below makes it 474.8 MB, 59.4 MB per GPU at TP8, before any ReplaySSM ring.

At TP8 one more token costs each GPU 16,992 bytes, so the state weighs as much as 3,306 tokens of context (2,970 with SGLang's rows; 3,493 with DSpark). At DCP8 a token costs 2,124 bytes per GPU and the crossover moves to 26,446 tokens.

Bytes per GPU for one session of Kimi K3.1 Pro against context length, log axes from 1K to 1M tokens. Two rising cache lines, TP8 (solid) at 16,992 bytes per token and DCP8 (dashed) at 2,124, cross a flat gold floor of 56 MB for the delta-rule state, the same under both. The crossings are marked at 3,306 and 26,446 tokens, and the regions to their left are shaded and bracketed "state-bound at TP8" and "state-bound at DCP8"Bytes per GPU for one session of Kimi K3.1 Pro against context length, log axes from 1K to 1M tokens. Two rising cache lines, TP8 (solid) at 16,992 bytes per token and DCP8 (dashed) at 2,124, cross a flat gold floor of 56 MB for the delta-rule state, the same under both. The crossings are marked at 3,306 and 26,446 tokens, and the regions to their left are shaded and bracketed "state-bound at TP8" and "state-bound at DCP8" Figure 1: below about 3K tokens at TP8, and 26K at DCP8, a session's fixed state outweighs its cache.

The widget sizes both terms. It opens on 256 sessions of 8K at TP8 with vLLM's pool; switch DCP to 8 and the pool to 43 GiB, and the state takes three quarters of each session:

Interactive widget: cp-kv-sizer. Open this page in a browser with JavaScript to use it.

vLLM packs everything into one block pool: a row holds the latent and index-key pages of all 24 DSA layers for a block of tokens, or 23 KDA states, so a request's 69 states take three rows (dsa_cache.py). Block sizes are rounded so a TP8 prefill and a TP1 decode pair blocks for P/D transfer. SGLang sizes a separate KDA pool (--mamba-full-memory-ratio, or a slot count on decode servers). In both, prefix caching keeps a state per cached prefix, so host offload holds states too: on MI355X the cookbook found host KDA slots bound the hit rate before host KV did (SGLANG_HICACHE_MAMBA_HOST_RATIO sizes them).

What the indexer costs

In decode the indexer pays for itself early. Dense MLA reads every token's 576-byte latent per layer per step. DSA scans every token's 132-byte key, then reads the full latent of 2,048 selected tokens: 132 × L + 576 × 2,048 bytes. The two meet at 2,657 tokens. Above that, the ratio falls toward 132 / 576: 24.5% of dense at 128K, 23.1% at 1M, which is vLLM's "about 23%".

Bytes read per DSA layer per decode step against context length, log axes from 1K to 1M tokens. Dense MLA rises as 576 bytes per token. The highlighted DSA curve, 132 bytes per token plus 1.18 MB, starts just above a dashed 1.18 MB floor (2,048 selected rows of 576 bytes). The two cross at a break-even of 2,657 tokens; labels give DSA at 47.9% of dense at 8K, 24.5% at 128K and 23.1% at 1MBytes read per DSA layer per decode step against context length, log axes from 1K to 1M tokens. Dense MLA rises as 576 bytes per token. The highlighted DSA curve, 132 bytes per token plus 1.18 MB, starts just above a dashed 1.18 MB floor (2,048 selected rows of 576 bytes). The two cross at a break-even of 2,657 tokens; labels give DSA at 47.9% of dense at 8K, 24.5% at 128K and 23.1% at 1M Figure 2: the indexer reads fewer bytes than dense MLA from 2,657 tokens on, and settles at 23% of them.

At long context the scan is most of that read, and K3.1 repeats it in every layer. Mistral Large 4's indexers share their top-k across layers; index_topk_freq: 1 shares none, so a 1M-token session scans 132 bytes × 1,048,576 tokens × 24 layers, 3.3 GB per decode step. Under TP8 every GPU holds all the keys and reads all 3.3 GB; under DCP8 each reads its eighth, 0.42 GB. That is how vLLM can report K3.1's sparse attention under DCP8 faster than K3's dense MLA from batch 32 at 128K.

Prefill is where the indexer costs: it scores every earlier token for every query, 32 × 128 × 2 = 8,192 FLOPs per pair per layer. Sparse MLA over the 2,048 selected tokens is 96 heads × 2 × (576 + 512) × 2,048 = 428 MFLOPs per query, whatever the context. The indexer's share grows with L and passes MLA's at 52K tokens. Under TP8 each GPU runs 12 of the 96 MLA heads but the whole indexer, so the indexer passes MLA on each rank from about 6,500 tokens, and its quadratic scan runs eight times.

So vLLM shards prefill attention by token instead of by head: an all-to-all gives each GPU 1/8 of the tokens with all 96 heads. On 8x GB300 at TP8 the vLLM team reports TTFT 1.16x faster at 27K tokens and 1.69x at 340K (15.89 s to 9.42 s), for about 0.8 GiB of exchange buffers per GPU taken from the KV cache. The opt-in MXFP4 index keys (68 bytes) fit 11% more tokens and make the indexer 10–20% faster, by the same team's numbers.

The pool, and where 1M fits

The pool is what the engine leaves after weights, workspaces and graphs. vLLM published four capacities on 8x GB300; multiplied by their bytes per token, they give the pool per GPU:

Configuration Tokens (vLLM) Pool per GPU Weights + pool
FP8, TP8 3.04M 51.7 GB 258.0 GB
NVFP4 latent, TP8 4.49M 52.2 GB 258.5 GB
FP8, TP8 + DCP8 21.8M 46.3 GB 252.6 GB
NVFP4 latent, TP8 + DCP8 32.1M 46.6 GB 252.9 GB

Take 52 GB per GB300 at TP8 as the working pool. The blog doesn't give its memory setting. At PR #65685's head, --gpu-memory-utilization defaults to 1.0 when the extensible KV cache is on, as it is with the V2 model runner that K3.1 with DSpark selects, and to 0.92 otherwise, as in v0.33.0 (cache.py, L491-L497). The Mistral Large 4 capacities came from another PR at an explicit 0.85: its 250 GB budget and this 258 GB measure different settings. In the extensible mode vLLM sizes the pool after warmup, so read Memory after warmup: … GiB committed to the KV cache and Extended KV cache to N blocks; Available KV cache memory is only the profiling estimate.

DCP8 gives 7.2x, not 8x, because the pool shrinks by 5.4 GB per GPU; Mistral Large 4 lost 0.9 GB and got 7.93x. The state is identical under both. One DCP allocation we can size is the symmetric-memory workspace that gathers a prefill's context, about 0.7 GB per GPU at a 1M --max-model-len (context.py). We couldn't attribute the other 4.7 GB from the source alone. The recipe's 8x B300 numbers give the same ratio (18.5M vs 2.6M, 7.1x). Plan on 7x.

Full 1M-token contexts per eight GPUs follow: 2.9 at TP8 with FP8, 20 at DCP8, and about 36 at DCP8 with NVFP4 latents and MXFP4 keys (vLLM's figure). Eight GPUs do serve a million tokens.

Choosing the shape

The Mistral piece's inequality needs the state as a second term:

sessions × (context × bytes per token / DCP + state per GPU)  ≤  pool per GPU

Take the K3 technical report's coding turn: a 400K-token prefix and a 4K increment. At TP8 a session costs each GPU 404,000 × 16,992 bytes plus 56 MB, 6.9 GB: seven sessions in 52 GB. At DCP8 it costs 0.91 GB: 50 sessions in 46 GB. Now short agent turns of 8K: TP8 holds 264 sessions, DCP8 629. Counting the KV alone, DCP8 would promise 2,661; the state takes 76% of each session and cuts that by four.

Grouped bars, on a log scale, of Kimi K3.1 Pro sessions that fit on 8x GB300 with vLLM's FP8 rows, at contexts of 8K, 100K, 404K and 1M tokens, TP8 and TP8 + DCP8 side by side. Solid bars include the 56 MB state per GPU; dashed outlines count the KV alone. TP8: 264, 29, 7, 2. DCP8: 629, 172, 50, 20, a gain of 2.4x, 5.9x, 6.8x and 7.0x. At 8K a gold segment fills the DCP8 bar up to the 2,661 sessions the KV alone would allow, labelled "state: 76% of each session"Grouped bars, on a log scale, of Kimi K3.1 Pro sessions that fit on 8x GB300 with vLLM's FP8 rows, at contexts of 8K, 100K, 404K and 1M tokens, TP8 and TP8 + DCP8 side by side. Solid bars include the 56 MB state per GPU; dashed outlines count the KV alone. TP8: 264, 29, 7, 2. DCP8: 629, 172, 50, 20, a gain of 2.4x, 5.9x, 6.8x and 7.0x. At 8K a gold segment fills the DCP8 bar up to the 2,661 sessions the KV alone would allow, labelled "state: 76% of each session" Figure 3: DCP8 multiplies sessions by seven at long contexts and by 2.4 at 8K, where the state, not the cache, fills the pool. Pools from vLLM's capacities on 8x GB300.

DCP costs decode time on the default path: at concurrency 1 on 8x GB300 with 32K of context, vLLM reports a TPOT of 9.35 ms at TP8 and 11.48 ms at DCP8, 23% higher (the post states neither speculation nor output length), and the recipe puts DCP steps 7–25% slower at the same batch. The fused CuTe DSL path (--additional-config '{"decode_backend":"latency_specialized"}') brings DCP8 to 5.96 ms; on 8x B300 the recipe measures it 1.6–1.7x faster at batch 1, with DCP8 within 6% of TP8.

Prefill under DCP8 also runs token-sharded, and the blog finds it as fast as "TP8" (14.61 vs 14.50 s at 340K), but that baseline isn't its token-sharded table's 9.42 s, and the post doesn't reconcile the two. Budget up to 1.5x the best TP8 TTFT for a long prompt. So turn DCP8 on when the inequality fails at TP8, which for this model happens early: eight sessions of 400K, or about 260 short turns.

A prefill/decode split answers another problem (Disaggregated Serving): a 340K prefill takes 9 to 15 s, and on a shared pool short agent turns wait behind it. Split when that happens, and size the decode side with the same inequality. vLLM's recipe pairs a TP8 prefill pool using expert parallelism with a DEP16 decode pool (TP1 × DP16, two B300 nodes) over NIXL. The blog says each packed block moves in one RDMA read; the recipe adds three NIXL reads for the KDA conv state, and every worker needs VLLM_SSM_CONV_STATE_LAYOUT=DS. Under DP attention a decode GPU holds whole sessions: each token's 16,992 bytes once and the full 449 MB state. Per session that is the same as DCP8, with the same crossover at about 26K tokens; both store the cache once, where TP8 stores it eight times.

The smallest shapes the engines publish:

Engine Shape Weights per GPU Status
vLLM 8x GB300 (two trays), TP8 206.3 GB verified
vLLM 8x B300, 8x MI355X or 8x VR200, TP8 206.3 GB supported; MI355X ran the AgentX preset; VR200 untuned
vLLM 32 Zhenwu PPUs (810E TP32 · EP32, M890 TP8 · DP4 · EP32) verified
vLLM TPU v7x, 16 chips, TP32 · EP32 validated (vllm-torchtpu)
SGLang B300, GB300 or MI350X / MI355X, TP8 or TP8 · DCP8 206.3 GB cells verified or "final verification in progress"
SGLang H200 TP16 · EP16, B200 / GB200 TP16 · DCP16 109.5 GB at TP16 placeholder shapes, not verified
SGLang H100 TP32 · EP32 61.1 GB at TP32 placeholder shape, not verified

Sources: the vLLM recipe, the vLLM blog and the SGLang cookbook; weights per GPU are ours, for plain TP. A 141 GB H200 reports 143,771 MiB (150.8 GB), so TP16 leaves at most 41 GB per GPU for cache, activations and graphs; each 10 GB of pool is about 590K tokens, six sessions of 100K. Nobody has published an H200 capacity: read the warmup line first.

What "day 0" means in the engines

vLLM ships vllm/vllm-openai:kimi-k31 (CUDA 13; -cu134 for Rubin) and vllm/vllm-openai-rocm:kimi-k31 (ROCm 10). The code is PR #65685, open at 4414f47 (280 files); v0.33.0 (tag of 1 November, commit 4ba787e) has none of its DSA files, and the recipe marks pip install unsupported and names min_vllm_version: 0.34.0, "the first release after v0.33.0, which K3.1 missed". The launch line, from the vLLM blog:

$ vllm serve moonshotai/Kimi-K3.1-Pro \
    --tensor-parallel-size 8 \
    --trust-remote-code \
    --load-format fastsafetensors \
    --enable-auto-tool-choice \
    --tool-call-parser kimi_k3 \
    --reasoning-parser kimi_k3 \
    --speculative-config '{"model":"Inferact/Kimi-K3.1-Pro-DSpark-preview","num_speculative_tokens":5,"method":"dspark","draft_sample_method":"probabilistic"}'

--decode-context-parallel-size 8 is the DCP switch; --language-model-only frees the vision tower's memory for cache in text-only serving.

SGLang merged basic support on main on 4 November (#48415, 61a3c7f), after v0.5.23 (released 2 November), and main still rejects --dcp-size > 1 for this model (kimi_k3.py). DCP, P/D and DFlash come from the kimi-k3.1-day-0 branch, #48414, open at 0ec7cb2, and the image lmsysorg/sglang:dev-kimi-k31-pro (-mi35x for AMD). The cookbook's measured runs used an image built from commit 9ab3c28176 plus one unmerged change, not the public image.

Pin by digest as in the Mistral piece, and re-read the new version's startup log before you roll it out: the packed block layout and the DCP workspaces are still moving.

Gotchas

The draft caches too. In vLLM the DSpark preview's five dense MLA layers share the packed row (dsa_cache.py): five more 576-byte latents, 19,872 bytes per token instead of 16,992, 17% more bytes per token and 14.5% fewer tokens. SGLang's cookbook says its DFlash draft ring adds about 15% of the target KV.

SGLang P/D under DCP needs Mooncake, and a restart order. DCP rejects other transfer backends, and prefill keeps the old decode's Mooncake mapping: restart prefill whenever decode restarts.

FP8 draft on MI355X needs an FP8 target. The recipe adds --kv-cache-dtype fp8 to the target on MI355X, because the draft's FP8 KV assumes it; on ROCm the port stores that as the 656-byte fp8_ds_mla row.

Fewer states per prefix, fewer hits. In SGLang, --mamba-max-states-per-path 1 saves state slots but lowered the prefix hit rate on agentic replay. The cookbook's MI350X / MI355X recipes keep every state per path; its NVIDIA HiCache overlay sets 1.

It always thinks. Pass the complete assistant message back in multi-turn and tool calls, reasoning_content and tool_calls included, as SGLang's cookbook instructs; reasoning_effort sets the depth (low, high, max, default max).

Verdict

Compute sessions × (context × bytes per token + 56 MB) against a 52 GB pool per GPU at TP8 on GB300, and stay on TP8 while it fits. When it doesn't (more than seven 400K sessions, or about 260 short turns), switch to DCP8: about 7x the long sessions, 2.4x the 8K ones because the state doesn't shard, and a per-token cost that is 23% on the default decode path but within 6% with latency_specialized (recipe, 8x B300). Split prefill from decode when long prefills stall short turns, and size the decode pool with the same inequality. The smallest deployment is eight 288 GB GPUs at TP8 in either engine, GB300 being vLLM's only verified one; H200 at TP16 and H100 at TP32 are placeholders. Pin the images: neither engine has released this support.

The DSpark preview's five draft layers cost 2,880 bytes per token and triple batch-1 decode in vLLM's measurement; Speculative Decoding from First Principles shows why that gain shrinks once the state, not the batch, sets your concurrency.

Sources

  1. How an LLM Request Becomes TokensSpeculative Decoding from First Principles
  2. Inference EnginesvLLM 0.34: Three Changes to Re-check Before You Upgrade
  3. The GPU for Inference EngineersMegakernels for Decode: What a Kernel Boundary Costs, and When Fusing a Layer Pays

Inference Notes

Once a week: what changed in serving AI models, and what it means if you build, run or pay for them, in about five minutes.

Read past issues