quantuminfer 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +96 -2
  3. package/bin/quantuminfer.js +61 -0
  4. package/c27/adapters.py +161 -0
  5. package/c27/harness27.py +349 -0
  6. package/data/input.txt +40000 -0
  7. package/data/wikitext/test.txt +7249 -0
  8. package/engine/API.txt +208 -0
  9. package/engine/PLUGINS.txt +4 -0
  10. package/engine/__init__.py +82 -0
  11. package/engine/adapter.py +505 -0
  12. package/engine/blocks.py +1180 -0
  13. package/engine/c12.py +324 -0
  14. package/engine/c12cu.py +1074 -0
  15. package/engine/ctx.py +87 -0
  16. package/engine/dev.py +11 -0
  17. package/engine/ds4.py +389 -0
  18. package/engine/kernels.py +833 -0
  19. package/engine/model.py +281 -0
  20. package/engine/record.py +140 -0
  21. package/engine/server.py +183 -0
  22. package/engine/spec.py +1030 -0
  23. package/engine/wcode.py +122 -0
  24. package/p27/SPEC.txt +66 -0
  25. package/p27/STATUS.txt +91 -0
  26. package/p27/bench_glm.py +354 -0
  27. package/p27/bench_multi.py +76 -0
  28. package/p27/mkfinal.py +98 -0
  29. package/p27/modal_comp.py +173 -0
  30. package/p27/modal_dl.py +63 -0
  31. package/p27/modal_p27.py +168 -0
  32. package/p27/modal_probe.py +49 -0
  33. package/p27/p27rules.py +29 -0
  34. package/p27/pblocks.py +1242 -0
  35. package/p27/pmodel.py +402 -0
  36. package/p27/pref.py +151 -0
  37. package/p27/prof_glm.py +34 -0
  38. package/p27/quant.py +850 -0
  39. package/p27/recipes/vllm_b300_single_node_tep_b300_agentx_ep.md +353 -0
  40. package/p27/recipes/vllm_b300_single_node_tp_b300_agentx.md +351 -0
  41. package/p27/recipes/vllm_b300_single_node_tp_baseline.md +250 -0
  42. package/p27/recipes/vllm_default_gb300.md +281 -0
  43. package/p27/recipes/vllm_glm53_h200.md +301 -0
  44. package/p27/run_window1.sh +21 -0
  45. package/p27/run_window2.sh +13 -0
  46. package/p27/sweep_glm.py +64 -0
  47. package/p27/t_align.py +42 -0
  48. package/p27/t_combine.py +28 -0
  49. package/p27/t_echo.py +31 -0
  50. package/p27/t_fp8dense.py +59 -0
  51. package/p27/t_fp8speed.py +48 -0
  52. package/p27/t_glm.py +340 -0
  53. package/p27/t_glu.py +30 -0
  54. package/p27/t_gsuf.py +23 -0
  55. package/p27/t_jac.py +22 -0
  56. package/p27/t_moebm.py +30 -0
  57. package/p27/t_nccl.py +36 -0
  58. package/p27/t_online_jac.py +31 -0
  59. package/p27/t_probe.py +4 -0
  60. package/p27/t_router.py +28 -0
  61. package/p27/t_symm.py +50 -0
  62. package/p27/t_tiny.py +116 -0
  63. package/package.json +34 -4
  64. package/results/ANALYSIS.md +160 -0
  65. package/results/comp_vllm_mtp_k5_b300mtp.json +235 -0
  66. package/results/glm53_b300x8_opt4.json +624 -0
  67. package/results/res_glm_c32w3_b300.json +638 -0
  68. package/results/res_glm_final_c32_b300.json +652 -0
  69. package/results/res_glm_multi_final_b300.json +1821 -0
  70. package/results/res_glm_online_b300.json +638 -0
  71. package/results/res_glm_online_fixed_b300.json +638 -0
  72. package/results/res_glm_opt4_b300.json +624 -0
  73. package/results/res_glm_t1_j8_b300.json +340 -0
  74. package/results/res_glm_text_plain_batch_b300.json +5792 -0
  75. package/results/res_glm_text_w1_b300.json +1635 -0
  76. package/results/res_glm_text_w3_b300.json +1639 -0
  77. package/results/res_sweep_echo_b300.json +129 -0
  78. package/results/res_sweep_final_b300.json +153 -0
  79. package/results/res_sweep_glm_b300.json +153 -0
  80. package/results/res_techo.json +29 -0
  81. package/results/res_tgsuf.json +21 -0
  82. package/results/res_tjac.json +17 -0
  83. package/results/res_tonline_jac.json +13 -0
@@ -0,0 +1,351 @@
1
+ # moonshotai/Kimi-K3.1-Pro — vLLM serving recipe
2
+
3
+ > 2.8T-parameter native multimodal MoE with Kimi Delta Attention, sparse MLA, and a 1M-token context window
4
+
5
+ Configuration: hardware `b300` (8× B300) · strategy `single_node_tp` (Tensor Parallel) · variant `default` (MXFP4) · features `tool_calling`, `reasoning`, `spec_decoding`, `text_only`, `low_latency_decode` · KV offload `simple` · preset `b300_agentx` at point `c1`
6
+
7
+ - Interactive page: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro?hardware=b300&strategy=single_node_tp&preset=b300_agentx
8
+ - This configuration as JSON: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.json?hardware=b300&strategy=single_node_tp&preset=b300_agentx
9
+
10
+ The commands below were rendered for exactly this configuration and take precedence over any example in the guide.
11
+
12
+ ## Other configurations
13
+
14
+ Change the query string (the same parameters as the page URL) and fetch this URL again. Unknown or incompatible values fall back to the recipe default, so check the Configuration line.
15
+
16
+ - `hardware`: `gb200`, `b300`, `gb300`, `vr200`, `mi355x`, `ironwood`, `810e`, `m890`
17
+ - `variant`: `default`
18
+ - `strategy`: `single_node_tp`, `single_node_tep`, `multi_node_tp`, `multi_node_tep`, `multi_node_dep`, `pd_cluster` (multi-node strategies also need `nodes=<n>`)
19
+ - `features`: comma-separated list of `tool_calling`, `reasoning`, `spec_decoding`, `text_only`, `low_latency_decode`, `nvfp4_kv_cache`, `strict_tool_calls` (default: `tool_calling`, `reasoning`). Use `features=none` to turn them all off.
20
+ - `prefill_nodes`, `decode_nodes`: dedicated node counts for each pool under `strategy=pd_cluster`.
21
+ - `prefill_mode`, `decode_mode`: `tp`, `tep`, `dep`.
22
+ - `prefill_rank`, `decode_rank`: zero-based node indices (`0` to the pool's node count minus one). These select the singular command; `node_commands[]` always includes every node.
23
+ - `pd_router`: `vllm`, `dynamo`, `smg`, `ascend`. Hardware and pool compatibility applies.
24
+ - `pd_connector`: `nixl`, `mooncake`, `mooncake_ascend`, `moriio`. Select independently of the router; catalog hardware/router compatibility still applies.
25
+ - `preset`: a tuned, evidence-backed configuration (`baseline` opts out of a default one). Each sets its own hardware and strategy:
26
+ - `mi355x_agentx` — AgentX TP8 (mi355x · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx`
27
+ - `b300_agentx` — AgentX TP8 + DCP8 (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx`
28
+ - `b300_agentx_mixed_graphs` — AgentX TP8 + DCP8, mixed-step graphs (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx_mixed_graphs`
29
+ - `b300_agentx_ep` — AgentX TP8 + DCP8 + EP8 (b300 · TEP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep`
30
+ - `b300_agentx_pd` — AgentX xPyD TP8 + DCP8 (b300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=pd_cluster&preset=b300_agentx_pd`
31
+ - `v7x_validated` — Validated TEP32 (v7x) (ironwood · Multi-node TEP · Accuracy validation (GSM8K) · opt-in): `hardware=ironwood&strategy=multi_node_tep&preset=v7x_validated`
32
+ - `v7x_dcp8` — Validated TEP32 + DCP8 (v7x) (ironwood · Multi-node TEP · Accuracy validation (GSM8K) · opt-in): `hardware=ironwood&strategy=multi_node_tep&preset=v7x_dcp8`
33
+ - `gb300_agentx_pd` — AgentX 1P5D TP8 + DCP8 (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd`
34
+ - `gb300_agentx_pd_hybrid` — AgentX xP1D, DP4 x TP8 decode (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_hybrid`
35
+ - `gb300_agentx_pd_dep16` — AgentX 1P1D DEP16 (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_dep16`
36
+ - `gb300_agentx_pd_dep32` — AgentX 1P1D DEP32 prefill, DEP32 decode (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_dep32`
37
+ - `gb300_agentx_c1` — AgentX TP16 + DCP16, concurrency 1 (gb300 · Multi-node TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=multi_node_tp&preset=gb300_agentx_c1`
38
+ - `gb200_agentx_tp16` — AgentX TP16 + DCP16 (gb200 · Multi-node TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=multi_node_tp&preset=gb200_agentx_tp16`
39
+ - `gb200_agentx_pd_tp16` — AgentX 1P1D TP16 + DCP16 (gb200 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=pd_cluster&preset=gb200_agentx_pd_tp16`
40
+ - `gb200_agentx_pd_pp2` — AgentX 1P1D, TP8 x PP2 prefill (gb200 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=pd_cluster&preset=gb200_agentx_pd_pp2`
41
+
42
+ ## Install
43
+
44
+ Requires vLLM >= 0.35.0 (not released yet — nightly wheel).
45
+
46
+ Docker image: `vllm/vllm-openai:kimi-k31-mc@sha256:f81998764e8594d71b40788c5285ae112acf9230129d5d0d238b5df83da5acf6`
47
+
48
+ ## Serve
49
+
50
+ ```bash
51
+ export VLLM_ENGINE_READY_TIMEOUT_S=7200
52
+ export VLLM_HTTP_TIMEOUT_KEEP_ALIVE=900
53
+ export VLLM_USE_V2_MODEL_RUNNER=1
54
+ export VLLM_USE_DIRECT_DCP_A2A=1
55
+ export VLLM_USE_DIRECT_DCP_Q_GATHER=1
56
+ export VLLM_USE_DIRECT_DCP_KV_GATHER=1
57
+ export VLLM_ALLREDUCE_USE_FLASHINFER=1
58
+ export VLLM_KIMI_K3_SHARD_SP_SHARED_EXPERT=0
59
+ export VLLM_USE_NCCL_SYMM_MEM=0
60
+ export VLLM_ENABLE_GEMM_RS=0
61
+ export TOKENSPEED_MLA_FP16_PARTIALS=0
62
+ vllm serve moonshotai/Kimi-K3.1-Pro \
63
+ --trust-remote-code \
64
+ --override-generation-config '{"temperature":1.0,"top_p":0.95}' \
65
+ --tensor-parallel-size 8 \
66
+ --load-format fastsafetensors \
67
+ --decode-context-parallel-size 8 \
68
+ --dcp-comm-backend a2a \
69
+ --cp-kv-cache-interleave-size 1 \
70
+ --enable-prefix-caching \
71
+ --kv-cache-dtype fp8 \
72
+ --mamba-ssm-cache-dtype float32 \
73
+ --use-replayssm \
74
+ --no-enable-flashinfer-autotune \
75
+ --max-num-batched-tokens 16384 \
76
+ --gpu-memory-utilization 0.9 \
77
+ --stream-interval 10 \
78
+ --disable-uvicorn-access-log \
79
+ --attention-config '{"indexer_kv_dtype":"mxfp4"}' \
80
+ --max-num-seqs 2 \
81
+ --enable-auto-tool-choice \
82
+ --tool-call-parser kimi_k3 \
83
+ --reasoning-parser kimi_k3 \
84
+ --speculative-config '{"model":"Inferact/Kimi-K3.1-Pro-DSpark","num_speculative_tokens":4,"method":"dspark","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' \
85
+ --language-model-only \
86
+ --additional-config '{"decode_backend":"latency_specialized"}' \
87
+ --kv-transfer-config '{"kv_connector":"SimpleCPUOffloadConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use_per_rank":281125000000,"lazy_offload":false}}' \
88
+ --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY","cudagraph_capture_sizes":[5,10]}'
89
+ ```
90
+
91
+ Docker equivalent:
92
+
93
+ ```bash
94
+ docker run --gpus all \
95
+ --privileged --ipc=host -p 8000:8000 \
96
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
97
+ -e VLLM_ENGINE_READY_TIMEOUT_S=7200 \
98
+ -e VLLM_HTTP_TIMEOUT_KEEP_ALIVE=900 \
99
+ -e VLLM_USE_V2_MODEL_RUNNER=1 \
100
+ -e VLLM_USE_DIRECT_DCP_A2A=1 \
101
+ -e VLLM_USE_DIRECT_DCP_Q_GATHER=1 \
102
+ -e VLLM_USE_DIRECT_DCP_KV_GATHER=1 \
103
+ -e VLLM_ALLREDUCE_USE_FLASHINFER=1 \
104
+ -e VLLM_KIMI_K3_SHARD_SP_SHARED_EXPERT=0 \
105
+ -e VLLM_USE_NCCL_SYMM_MEM=0 \
106
+ -e VLLM_ENABLE_GEMM_RS=0 \
107
+ -e TOKENSPEED_MLA_FP16_PARTIALS=0 \
108
+ vllm/vllm-openai:kimi-k31-mc@sha256:f81998764e8594d71b40788c5285ae112acf9230129d5d0d238b5df83da5acf6 moonshotai/Kimi-K3.1-Pro \
109
+ --trust-remote-code \
110
+ --override-generation-config '{"temperature":1.0,"top_p":0.95}' \
111
+ --tensor-parallel-size 8 \
112
+ --load-format fastsafetensors \
113
+ --decode-context-parallel-size 8 \
114
+ --dcp-comm-backend a2a \
115
+ --cp-kv-cache-interleave-size 1 \
116
+ --enable-prefix-caching \
117
+ --kv-cache-dtype fp8 \
118
+ --mamba-ssm-cache-dtype float32 \
119
+ --use-replayssm \
120
+ --no-enable-flashinfer-autotune \
121
+ --max-num-batched-tokens 16384 \
122
+ --gpu-memory-utilization 0.9 \
123
+ --stream-interval 10 \
124
+ --disable-uvicorn-access-log \
125
+ --attention-config '{"indexer_kv_dtype":"mxfp4"}' \
126
+ --max-num-seqs 2 \
127
+ --enable-auto-tool-choice \
128
+ --tool-call-parser kimi_k3 \
129
+ --reasoning-parser kimi_k3 \
130
+ --speculative-config '{"model":"Inferact/Kimi-K3.1-Pro-DSpark","num_speculative_tokens":4,"method":"dspark","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' \
131
+ --language-model-only \
132
+ --additional-config '{"decode_backend":"latency_specialized"}' \
133
+ --kv-transfer-config '{"kv_connector":"SimpleCPUOffloadConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use_per_rank":281125000000,"lazy_offload":false}}' \
134
+ --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY","cudagraph_capture_sizes":[5,10]}'
135
+ ```
136
+
137
+ ## Tuned preset: AgentX TP8 + DCP8
138
+
139
+ Concurrency 1 and 6 on one B300 node: TP8 with DCP8, the low-latency decode backend on FULL decode CUDA graphs, the K3.1 DSpark draft with 4 tokens, and host KV offload.
140
+
141
+ - Key: `b300_agentx` · opt-in
142
+ - Qualified on: hardware `b300` · strategy `single_node_tp` (Tensor Parallel)
143
+ - Workload: Agentic (InferenceX AgentX)
144
+ - Source: [InferenceX #4871](https://github.com/SemiAnalysisAI/InferenceX/pull/4871) (lane `kimik3.1-fp4-b300-vllm-agentic-dspark`, revision `75b1a3c7b745`)
145
+ - vLLM image: `vllm/vllm-openai:kimi-k31-mc@sha256:f81998764e8594d71b40788c5285ae112acf9230129d5d0d238b5df83da5acf6` (the Docker command above uses it)
146
+ - Builder choices it implies (already in the command above): `frontend=python`, `tool_calling` on, `reasoning` on, `spec_decoding` on, `text_only` on, `low_latency_decode` on, `nvfp4_kv_cache` off, `dcp=8`, `kv_offload=simple`
147
+ - Every point rendered as JSON: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro/presets/b300_agentx.json
148
+
149
+ ### Concurrency points
150
+
151
+ Each point is a delta on the preset; select one with `point=<key>`.
152
+
153
+ | Point | Concurrency | Select |
154
+ |---|---|---|
155
+ | 1 (**in use**, default) | 1 | `point=c1` |
156
+ | 6 | 6 | `point=c6` |
157
+
158
+ ### Runbook
159
+
160
+ The single-node B300 TP8 + DCP8 AgentX configuration at concurrency 1 and 6. It follows the `agentic.yaml` points of InferenceX's B300 vLLM AgentX lane (SemiAnalysisAI/InferenceX#4871) and has been measured only on the image digest the preset pins, with the preview draft `Inferact/Kimi-K3.1-Pro-DSpark-preview`. It serves text with tool-call and reasoning parsers.
161
+
162
+ **Serving config.**
163
+ - **TP8 with DCP8.** DCP8 shards the MLA latent and indexer-key caches across the TP group, with the A2A DCP backend, `--cp-kv-cache-interleave-size 1` and the direct DCP all-to-all and gather paths (`VLLM_USE_DIRECT_DCP_*`). The MLA KV cache is FP8 and the indexer key cache MXFP4 (`indexer_kv_dtype`).
164
+ - **Low-latency decode** (the Low-latency decode feature, on in this preset) runs every pure decode step on the fused CuTe DSL path, on the V2 model runner, in FULL_DECODE_ONLY CUDA graphs. Each point captures 5, 10, 15, … rows (1 + 4 draft tokens per request) up to its largest planned decode batch; a decode step above the largest captured size runs eager.
165
+ - **Spec decoding** (on in this preset) uses the K3.1 DSpark draft [`Inferact/Kimi-K3.1-Pro-DSpark`](https://huggingface.co/Inferact/Kimi-K3.1-Pro-DSpark) with 4 tokens, probabilistic drafting and block rejection. `TOKENSPEED_MLA_FP16_PARTIALS=0` turns off TokenSpeed MLA's FP16 partials.
166
+ - **`--use-replayssm`.** With speculative decoding it turns on the KDA layers' RecoverSSM path: verification replays the accepted prefix instead of keeping one recurrent state per draft token. The KDA recurrent state is FP32 (`--mamba-ssm-cache-dtype float32`), as the K3.1 precision policy requires.
167
+ - **Collectives.** FlashInfer all-reduce stays on (`VLLM_ALLREDUCE_USE_FLASHINFER=1`); NCCL symmetric memory, the fused GEMM + reduce-scatter and the sharded sequence-parallel shared expert stay off (`VLLM_USE_NCCL_SYMM_MEM=0`, `VLLM_ENABLE_GEMM_RS=0`, `VLLM_KIMI_K3_SHARD_SP_SHARED_EXPERT=0`).
168
+ - **Points.** `--max-num-seqs` is 2 at concurrency 1 and 6 at concurrency 6. The capture sizes cover 5 rows per admitted request. Size both to your own concurrency.
169
+ - The **Simple** KV-offload option gets 281,125,000,000 bytes of host DRAM per rank. Size `cpu_bytes_to_use_per_rank` to your host.
170
+ - `--no-enable-flashinfer-autotune`, `--max-num-batched-tokens 16384`, `--gpu-memory-utilization 0.9`, `--stream-interval 10` and `--disable-uvicorn-access-log` as in the lane. `VLLM_ENGINE_READY_TIMEOUT_S=7200` leaves time for the weight load and the specialized decode's JIT; `VLLM_HTTP_TIMEOUT_KEEP_ALIVE=900` keeps pooled client connections open between agent turns.
171
+
172
+ **Benchmark-only settings left out.** The lane also sets `PYTHONHASHSEED=42`, so that identical prefixes hash to the same block keys from run to run, and `PYTHONUNBUFFERED=1` for its logs; neither changes serving. Its `--served-model-name` equals the model ID.
173
+
174
+ ##### Throughput measurement only (synthetic acceptance)
175
+
176
+ To measure throughput the AgentX way, replace real verification with synthetic acceptance at InferenceX's K3.1 DSpark golden acceptance length for 4 draft tokens, 3.19. Only `--speculative-config` changes:
177
+
178
+ ```bash
179
+ --speculative-config '{"model":"Inferact/Kimi-K3.1-Pro-DSpark","num_speculative_tokens":4,"method":"dspark","draft_sample_method":"probabilistic","rejection_sample_method":"synthetic","synthetic_acceptance_length":3.19}'
180
+ ```
181
+
182
+ Synthetic acceptance skips real verification. Never use it to serve users or to evaluate accuracy.
183
+
184
+ ## Guide
185
+
186
+ > Background reference. Commands in it are examples and may target another configuration — use the Serve section above.
187
+
188
+ ### Overview
189
+
190
+ Kimi-K3.1 keeps the Kimi-K3 layout (Kimi Delta Attention, 896 routed experts with 16 active
191
+ per token, a latent MoE projection and a vision encoder) and adds sparse
192
+ attention (DSA, top-2048 indexer) to 24 of its MLA layers. The checkpoint ships MXFP4
193
+ routed-expert weights; everything else is BF16.
194
+
195
+ The baseline is the simplest working setup on NVIDIA: one tensor-parallel group of 8 GPUs,
196
+ either two GB300 trays or one B300 node. Throughput was not tuned. On B300 it sets
197
+ `--max-num-seqs 128`, since the KV cache can't hold the default 1,024 sequences, and turns
198
+ FlashInfer autotuning off, which would otherwise add about two hours to startup.
199
+
200
+ VR200 (preview) takes the same TP8 layout on two trays, in the `vllm/vllm-openai:kimi-k31-cu134`
201
+ image (CUDA 13.4). It uses the Blackwell flags and hasn't been tuned or verified on Rubin.
202
+
203
+ On one B300 node, three AgentX presets follow InferenceX's B300 vLLM AgentX lane
204
+ (SemiAnalysisAI/InferenceX#4871), all with TP8 + DCP8 attention, the K3.1 DSpark draft, the
205
+ low-latency decode backend and host KV offload:
206
+ [AgentX TP8 + DCP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tp&preset=b300_agentx) at concurrency 1 and 6,
207
+ [concurrency 12 and 24](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tp&preset=b300_agentx_mixed_graphs) with CUDA graphs for prefill and mixed steps, and,
208
+ with routed experts EP8 on MegaMoE, [AgentX TP8 + DCP8 + EP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep) at concurrency 48 and 64.
209
+
210
+ On MI355X, one node takes the same TP8 layout with the AMD profile's AITER environment, in the
211
+ `vllm/vllm-openai-rocm:kimi-k31-020490a` image. The [AgentX TP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx) preset
212
+ follows InferenceX's MI355X vLLM AgentX lane (SemiAnalysisAI/InferenceX#5196) with one point per
213
+ concurrency, all with the K3.1 DSpark draft: plain TP8 with GPU KV and the low-latency decode
214
+ backend at concurrency 1, DCP8 with GPU KV and the low-latency decode backend at 4, and DCP8
215
+ with host KV offload from 16 to 48. It needs the image the preset pins.
216
+
217
+ On Zhenwu PPUs, the default MXFP4 checkpoint runs without speculative decoding on
218
+ two 16-PPU 810E nodes with TP32 / EP32, or four 8-PPU M890 nodes with TP8 / DP4 / EP32.
219
+ On 810E, `ppu_deep_gemm_w4a16` loads the checkpoint with a W4A16 compute path.
220
+ Use the PPU image specified for each hardware configuration.
221
+
222
+ On TPU, the model is served by [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu),
223
+ text-only: the vision tower is not loaded. The validated layout is TP32 with expert
224
+ parallelism on a 2x2x4 TPU v7x slice (16 chips, 32 devices, on 4 hosts). See [TPU serving](#tpu-serving).
225
+
226
+ ### Tensor + expert parallelism
227
+
228
+ On one B300 node, the **Tensor + Expert Parallel** strategy keeps attention at TP8 and runs
229
+ the routed experts with expert parallelism on the MegaMoE kernel. It has the lowest
230
+ long-prompt time to first token of the single-node layouts: a single 340K-token prompt
231
+ prefills in about 10 s, against about 15 s at plain TP8 (8x B300, one request at a time,
232
+ pre-release checkpoint).
233
+
234
+ ### Long context: decode context parallelism
235
+
236
+ The **Decode Context Parallelism** row shards the MLA latent and indexer-key caches across
237
+ the 8 GPUs of the TP group instead of replicating them, so DCP8 holds about 7x the KV cache
238
+ tokens of TP8 (about 18.5M vs 2.6M tokens with FP8 KV on 8x B300). Prefill is as fast as
239
+ at TP8. Decode steps are 7–25% slower than TP8 at the same batch, so use DCP when KV
240
+ capacity is the limit: very long contexts or many long-lived agentic sessions.
241
+
242
+ ### Low-latency decode
243
+
244
+ The **Low-latency decode** feature switches decode steps to a fused CuTe DSL path tuned for
245
+ small batches; prefill and mixed steps still run the default path. On 8x B300 at TP8 it cuts
246
+ the decode step by 1.6–1.7x at batch 1 and 1.2–1.3x at batch 32–64. Under DCP8 it brings decode
247
+ to within 6% of TP8. It requires the V2 model runner and FULL decode CUDA graphs (the
248
+ defaults), and TP8 or TP8 + DCP8. The feature toggle is offered only without expert
249
+ parallelism; the B300 AgentX preset with routed experts EP8 on MegaMoE
250
+ ([concurrency 48 and 64](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep)) sets
251
+ the same `decode_backend` in its own args.
252
+
253
+ On MI355X the same switch selects fused FlyDSL decode kernels. They cover only pure decode
254
+ steps of up to 16 rows, so among other checks they also need speculative decoding,
255
+ `--max-num-seqs` 1, 2, 4 or 8 with `--max-num-seqs` × (1 + draft tokens) ≤ 16, BF16 KDA
256
+ projections, an FP32 KDA recurrent state (`--mamba-ssm-cache-dtype float32`) and no KV
257
+ offload. Without DCP they serve only 3 or 7 draft tokens at `--max-num-seqs` 1 or 2, so the
258
+ MI355X default of 5 draft tokens needs DCP8. The concurrency-1 (no DCP) and 4 (DCP8) points
259
+ of the [AgentX TP8 preset](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx) show working setups, on the image it pins;
260
+ current vLLM main does not yet run K3.1 on this path without DCP. Its points from
261
+ concurrency 16 do not qualify, so leave the feature off there.
262
+
263
+ ### NVFP4 KV cache
264
+
265
+ The **NVFP4 KV cache** feature stores the MLA latent in NVFP4 (352 bytes per token per layer
266
+ instead of 576) and holds about 1.5x the KV cache tokens of FP8. The indexer keys stay FP8,
267
+ so the top-2048 token selection is unchanged. GSM8K matched FP8 on 8x GB300 (96.1% vs 96.2%);
268
+ long-context accuracy has not been measured yet.
269
+
270
+ ### TPU serving
271
+
272
+ TPU serving runs through [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu) and
273
+ is text-only: the vision tower is not loaded. K3.1 support is under review as
274
+ [vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775); until it merges,
275
+ the Install tab on TPU builds from the `kimi-k31pro` staging branch (Python 3.12, uv). No
276
+ published image or wheel carries it yet.
277
+
278
+ The generated command uses vllm-torchtpu's default multiprocessing multi-host backend: run the
279
+ head command on the slice's first host and the worker commands on the remaining hosts (the
280
+ builder renders both). The **Multi-Node TEP** strategy at 4 nodes matches the validated flags of
281
+ [vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775) with two
282
+ differences: #2775 ran one driver over a Ray cluster (`TPU_MULTIHOST_BACKEND=ray`), and its
283
+ GSM8K validation used the completions API, so the default-on chat and tool-call parsers were not
284
+ exercised on TPU. Validated on a 2x2x4 TPU v7x slice with an FP8 latent KV cache, the unified
285
+ block pool and prefix caching: the complete GSM8K split scored 97.50% (TP32) and 97.42%
286
+ (TP32 + DCP8), prefix-cache hits returned identical tokens and logprobs, and the BEAM-1M
287
+ long-context benchmark matched the GPU reference. The run-specific sizing of that validation
288
+ (10K context, 16 sequences, compile sizes) is not the TPU default — it lives in the two
289
+ **Validated** presets: [TEP32](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=ironwood&strategy=multi_node_tep&preset=v7x_validated) and
290
+ [TEP32 + DCP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=ironwood&strategy=multi_node_tep&preset=v7x_dcp8) for KV-capacity-bound workloads.
291
+
292
+ **Spec decoding is gated off on TPU for now**: DSpark with `--async-scheduling` (always on in
293
+ this configuration) needs [vllm-torchtpu#2770](https://github.com/vllm-project/vllm-torchtpu/pull/2770),
294
+ still open. #2775 validated DSpark with 7 draft tokens once that fix is in.
295
+
296
+ ### Prefill/decode disaggregation
297
+
298
+ The **Prefill/Decode Disaggregation** strategy runs one TP8 prefill pool (with expert
299
+ parallelism) and one DEP16 decode pool (TP1 x DP16 with expert parallelism), and decode
300
+ pulls each request's KV from prefill over NIXL. Every PD worker sets
301
+ `VLLM_SSM_CONV_STATE_LAYOUT=DS`: NIXL transfers the Kimi Delta Attention conv state in three
302
+ reads, which needs that layout, and the NIXL connector refuses to start without it.
303
+
304
+ ### KV cache offloading
305
+
306
+ The **Simple** option on the KV Offload row adds `SimpleCPUOffloadConnector`, a host-DRAM
307
+ prefix tier for each GPU. Under Prefill/Decode Disaggregation it is added to the prefill pool
308
+ only, next to NIXL in a MultiConnector; decode keeps plain NIXL. The tier pins
309
+ `cpu_bytes_to_use_per_rank` of host memory for every GPU, so size it from the host DRAM that
310
+ is free after the engines are up. The tested GB300 prefill workers used 128 GiB per GPU
311
+ (512 GiB per tray).
312
+
313
+ ### Strict tool calls
314
+
315
+ Without a grammar, K3.1 sometimes calls a tool with empty or placeholder arguments. The opt-in
316
+ **Strict tool calls** feature adds `--tool-strict-level parameter`, which constrains every
317
+ tool call to a declared tool and to that tool's declared argument names and types, as if each
318
+ tool had set `strict: true`. On the
319
+ [Kimi Vendor Verifier](https://github.com/MoonshotAI/Kimi-Vendor-Verifier) Tool Call benchmark
320
+ (70 samples x 5 epochs, 8x MI355X, single-node TP8, Python frontend) K3.1 Pro scored 0.786
321
+ without the flag and 0.980 with it. The Rust frontend builds its own grammar and was not
322
+ measured. The limits are those in the
323
+ [Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)'s Tool calling note: a tool
324
+ schema the grammar cannot compile fails the whole request, and arguments still need
325
+ validating on the client. The feature is not offered for prefill/decode disaggregation:
326
+ Dynamo workers do not accept the flag and constrain tool calls through their own
327
+ `--dyn-enable-structural-tag`, which the AgentX PD presets set.
328
+
329
+ ### Client usage
330
+
331
+ ```bash
332
+ curl http://localhost:8000/v1/chat/completions \
333
+ -H "Content-Type: application/json" \
334
+ -d '{
335
+ "model": "moonshotai/Kimi-K3.1-Pro",
336
+ "messages": [{"role": "user", "content": "Explain sparse attention in two sentences."}]
337
+ }'
338
+ ```
339
+
340
+ The model card reports its results at `temperature = 1.0` and `top-p = 0.95`, but the
341
+ checkpoint's `generation_config.json` sets no sampling defaults, so the command passes them
342
+ as server defaults with `--override-generation-config`. They apply only to the parameters a
343
+ request omits; a value sent by the client still wins. Without the flag vLLM serves such a
344
+ request at `top_p = 1.0`: on DeepSWE (113 tasks, 8x MI355X, one run each) a coding agent that
345
+ sends neither parameter resolved 75 tasks at that fallback and 88 with `temperature = 1.0`
346
+ and `top_p = 0.95` set in the agent.
347
+
348
+ ### References
349
+
350
+ - [Model card](https://huggingface.co/moonshotai/Kimi-K3.1-Pro)
351
+ - [Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)
@@ -0,0 +1,250 @@
1
+ # moonshotai/Kimi-K3.1-Pro — vLLM serving recipe
2
+
3
+ > 2.8T-parameter native multimodal MoE with Kimi Delta Attention, sparse MLA, and a 1M-token context window
4
+
5
+ Configuration: hardware `b300` (8× B300) · strategy `single_node_tp` (Tensor Parallel) · variant `default` (MXFP4) · features `tool_calling`, `reasoning`
6
+
7
+ - Interactive page: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro?hardware=b300&strategy=single_node_tp
8
+ - This configuration as JSON: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.json?hardware=b300&strategy=single_node_tp
9
+
10
+ The commands below were rendered for exactly this configuration and take precedence over any example in the guide.
11
+
12
+ ## Other configurations
13
+
14
+ Change the query string (the same parameters as the page URL) and fetch this URL again. Unknown or incompatible values fall back to the recipe default, so check the Configuration line.
15
+
16
+ - `hardware`: `gb200`, `b300`, `gb300`, `vr200`, `mi355x`, `ironwood`, `810e`, `m890`
17
+ - `variant`: `default`
18
+ - `strategy`: `single_node_tp`, `single_node_tep`, `multi_node_tp`, `multi_node_tep`, `multi_node_dep`, `pd_cluster` (multi-node strategies also need `nodes=<n>`)
19
+ - `features`: comma-separated list of `tool_calling`, `reasoning`, `spec_decoding`, `text_only`, `low_latency_decode`, `nvfp4_kv_cache`, `strict_tool_calls` (default: `tool_calling`, `reasoning`). Use `features=none` to turn them all off.
20
+ - `prefill_nodes`, `decode_nodes`: dedicated node counts for each pool under `strategy=pd_cluster`.
21
+ - `prefill_mode`, `decode_mode`: `tp`, `tep`, `dep`.
22
+ - `prefill_rank`, `decode_rank`: zero-based node indices (`0` to the pool's node count minus one). These select the singular command; `node_commands[]` always includes every node.
23
+ - `pd_router`: `vllm`, `dynamo`, `smg`, `ascend`. Hardware and pool compatibility applies.
24
+ - `pd_connector`: `nixl`, `mooncake`, `mooncake_ascend`, `moriio`. Select independently of the router; catalog hardware/router compatibility still applies.
25
+ - `preset`: a tuned, evidence-backed configuration (`baseline` opts out of a default one). Each sets its own hardware and strategy:
26
+ - `mi355x_agentx` — AgentX TP8 (mi355x · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx`
27
+ - `b300_agentx` — AgentX TP8 + DCP8 (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx`
28
+ - `b300_agentx_mixed_graphs` — AgentX TP8 + DCP8, mixed-step graphs (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx_mixed_graphs`
29
+ - `b300_agentx_ep` — AgentX TP8 + DCP8 + EP8 (b300 · TEP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep`
30
+ - `b300_agentx_pd` — AgentX xPyD TP8 + DCP8 (b300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=pd_cluster&preset=b300_agentx_pd`
31
+ - `v7x_validated` — Validated TEP32 (v7x) (ironwood · Multi-node TEP · Accuracy validation (GSM8K) · opt-in): `hardware=ironwood&strategy=multi_node_tep&preset=v7x_validated`
32
+ - `v7x_dcp8` — Validated TEP32 + DCP8 (v7x) (ironwood · Multi-node TEP · Accuracy validation (GSM8K) · opt-in): `hardware=ironwood&strategy=multi_node_tep&preset=v7x_dcp8`
33
+ - `gb300_agentx_pd` — AgentX 1P5D TP8 + DCP8 (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd`
34
+ - `gb300_agentx_pd_hybrid` — AgentX xP1D, DP4 x TP8 decode (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_hybrid`
35
+ - `gb300_agentx_pd_dep16` — AgentX 1P1D DEP16 (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_dep16`
36
+ - `gb300_agentx_pd_dep32` — AgentX 1P1D DEP32 prefill, DEP32 decode (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd_dep32`
37
+ - `gb300_agentx_c1` — AgentX TP16 + DCP16, concurrency 1 (gb300 · Multi-node TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=multi_node_tp&preset=gb300_agentx_c1`
38
+ - `gb200_agentx_tp16` — AgentX TP16 + DCP16 (gb200 · Multi-node TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=multi_node_tp&preset=gb200_agentx_tp16`
39
+ - `gb200_agentx_pd_tp16` — AgentX 1P1D TP16 + DCP16 (gb200 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=pd_cluster&preset=gb200_agentx_pd_tp16`
40
+ - `gb200_agentx_pd_pp2` — AgentX 1P1D, TP8 x PP2 prefill (gb200 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=pd_cluster&preset=gb200_agentx_pd_pp2`
41
+
42
+ ## Install
43
+
44
+ Requires vLLM >= 0.35.0 (not released yet — nightly wheel).
45
+
46
+ Docker image: `vllm/vllm-openai:kimi-k31`
47
+
48
+ ## Serve
49
+
50
+ ```bash
51
+ export VLLM_ENGINE_READY_TIMEOUT_S=3600
52
+ vllm serve moonshotai/Kimi-K3.1-Pro \
53
+ --trust-remote-code \
54
+ --override-generation-config '{"temperature":1.0,"top_p":0.95}' \
55
+ --tensor-parallel-size 8 \
56
+ --load-format fastsafetensors \
57
+ --max-num-seqs 128 \
58
+ --no-enable-flashinfer-autotune \
59
+ --enable-auto-tool-choice \
60
+ --tool-call-parser kimi_k3 \
61
+ --reasoning-parser kimi_k3
62
+ ```
63
+
64
+ Docker equivalent:
65
+
66
+ ```bash
67
+ docker run --gpus all \
68
+ --privileged --ipc=host -p 8000:8000 \
69
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
70
+ -e VLLM_ENGINE_READY_TIMEOUT_S=3600 \
71
+ vllm/vllm-openai:kimi-k31 moonshotai/Kimi-K3.1-Pro \
72
+ --trust-remote-code \
73
+ --override-generation-config '{"temperature":1.0,"top_p":0.95}' \
74
+ --tensor-parallel-size 8 \
75
+ --load-format fastsafetensors \
76
+ --max-num-seqs 128 \
77
+ --no-enable-flashinfer-autotune \
78
+ --enable-auto-tool-choice \
79
+ --tool-call-parser kimi_k3 \
80
+ --reasoning-parser kimi_k3
81
+ ```
82
+
83
+ ## Guide
84
+
85
+ > Background reference. Commands in it are examples and may target another configuration — use the Serve section above.
86
+
87
+ ### Overview
88
+
89
+ Kimi-K3.1 keeps the Kimi-K3 layout (Kimi Delta Attention, 896 routed experts with 16 active
90
+ per token, a latent MoE projection and a vision encoder) and adds sparse
91
+ attention (DSA, top-2048 indexer) to 24 of its MLA layers. The checkpoint ships MXFP4
92
+ routed-expert weights; everything else is BF16.
93
+
94
+ The baseline is the simplest working setup on NVIDIA: one tensor-parallel group of 8 GPUs,
95
+ either two GB300 trays or one B300 node. Throughput was not tuned. On B300 it sets
96
+ `--max-num-seqs 128`, since the KV cache can't hold the default 1,024 sequences, and turns
97
+ FlashInfer autotuning off, which would otherwise add about two hours to startup.
98
+
99
+ VR200 (preview) takes the same TP8 layout on two trays, in the `vllm/vllm-openai:kimi-k31-cu134`
100
+ image (CUDA 13.4). It uses the Blackwell flags and hasn't been tuned or verified on Rubin.
101
+
102
+ On one B300 node, three AgentX presets follow InferenceX's B300 vLLM AgentX lane
103
+ (SemiAnalysisAI/InferenceX#4871), all with TP8 + DCP8 attention, the K3.1 DSpark draft, the
104
+ low-latency decode backend and host KV offload:
105
+ [AgentX TP8 + DCP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tp&preset=b300_agentx) at concurrency 1 and 6,
106
+ [concurrency 12 and 24](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tp&preset=b300_agentx_mixed_graphs) with CUDA graphs for prefill and mixed steps, and,
107
+ with routed experts EP8 on MegaMoE, [AgentX TP8 + DCP8 + EP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep) at concurrency 48 and 64.
108
+
109
+ On MI355X, one node takes the same TP8 layout with the AMD profile's AITER environment, in the
110
+ `vllm/vllm-openai-rocm:kimi-k31-020490a` image. The [AgentX TP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx) preset
111
+ follows InferenceX's MI355X vLLM AgentX lane (SemiAnalysisAI/InferenceX#5196) with one point per
112
+ concurrency, all with the K3.1 DSpark draft: plain TP8 with GPU KV and the low-latency decode
113
+ backend at concurrency 1, DCP8 with GPU KV and the low-latency decode backend at 4, and DCP8
114
+ with host KV offload from 16 to 48. It needs the image the preset pins.
115
+
116
+ On Zhenwu PPUs, the default MXFP4 checkpoint runs without speculative decoding on
117
+ two 16-PPU 810E nodes with TP32 / EP32, or four 8-PPU M890 nodes with TP8 / DP4 / EP32.
118
+ On 810E, `ppu_deep_gemm_w4a16` loads the checkpoint with a W4A16 compute path.
119
+ Use the PPU image specified for each hardware configuration.
120
+
121
+ On TPU, the model is served by [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu),
122
+ text-only: the vision tower is not loaded. The validated layout is TP32 with expert
123
+ parallelism on a 2x2x4 TPU v7x slice (16 chips, 32 devices, on 4 hosts). See [TPU serving](#tpu-serving).
124
+
125
+ ### Tensor + expert parallelism
126
+
127
+ On one B300 node, the **Tensor + Expert Parallel** strategy keeps attention at TP8 and runs
128
+ the routed experts with expert parallelism on the MegaMoE kernel. It has the lowest
129
+ long-prompt time to first token of the single-node layouts: a single 340K-token prompt
130
+ prefills in about 10 s, against about 15 s at plain TP8 (8x B300, one request at a time,
131
+ pre-release checkpoint).
132
+
133
+ ### Long context: decode context parallelism
134
+
135
+ The **Decode Context Parallelism** row shards the MLA latent and indexer-key caches across
136
+ the 8 GPUs of the TP group instead of replicating them, so DCP8 holds about 7x the KV cache
137
+ tokens of TP8 (about 18.5M vs 2.6M tokens with FP8 KV on 8x B300). Prefill is as fast as
138
+ at TP8. Decode steps are 7–25% slower than TP8 at the same batch, so use DCP when KV
139
+ capacity is the limit: very long contexts or many long-lived agentic sessions.
140
+
141
+ ### Low-latency decode
142
+
143
+ The **Low-latency decode** feature switches decode steps to a fused CuTe DSL path tuned for
144
+ small batches; prefill and mixed steps still run the default path. On 8x B300 at TP8 it cuts
145
+ the decode step by 1.6–1.7x at batch 1 and 1.2–1.3x at batch 32–64. Under DCP8 it brings decode
146
+ to within 6% of TP8. It requires the V2 model runner and FULL decode CUDA graphs (the
147
+ defaults), and TP8 or TP8 + DCP8. The feature toggle is offered only without expert
148
+ parallelism; the B300 AgentX preset with routed experts EP8 on MegaMoE
149
+ ([concurrency 48 and 64](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=b300&strategy=single_node_tep&preset=b300_agentx_ep)) sets
150
+ the same `decode_backend` in its own args.
151
+
152
+ On MI355X the same switch selects fused FlyDSL decode kernels. They cover only pure decode
153
+ steps of up to 16 rows, so among other checks they also need speculative decoding,
154
+ `--max-num-seqs` 1, 2, 4 or 8 with `--max-num-seqs` × (1 + draft tokens) ≤ 16, BF16 KDA
155
+ projections, an FP32 KDA recurrent state (`--mamba-ssm-cache-dtype float32`) and no KV
156
+ offload. Without DCP they serve only 3 or 7 draft tokens at `--max-num-seqs` 1 or 2, so the
157
+ MI355X default of 5 draft tokens needs DCP8. The concurrency-1 (no DCP) and 4 (DCP8) points
158
+ of the [AgentX TP8 preset](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=mi355x&strategy=single_node_tp&preset=mi355x_agentx) show working setups, on the image it pins;
159
+ current vLLM main does not yet run K3.1 on this path without DCP. Its points from
160
+ concurrency 16 do not qualify, so leave the feature off there.
161
+
162
+ ### NVFP4 KV cache
163
+
164
+ The **NVFP4 KV cache** feature stores the MLA latent in NVFP4 (352 bytes per token per layer
165
+ instead of 576) and holds about 1.5x the KV cache tokens of FP8. The indexer keys stay FP8,
166
+ so the top-2048 token selection is unchanged. GSM8K matched FP8 on 8x GB300 (96.1% vs 96.2%);
167
+ long-context accuracy has not been measured yet.
168
+
169
+ ### TPU serving
170
+
171
+ TPU serving runs through [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu) and
172
+ is text-only: the vision tower is not loaded. K3.1 support is under review as
173
+ [vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775); until it merges,
174
+ the Install tab on TPU builds from the `kimi-k31pro` staging branch (Python 3.12, uv). No
175
+ published image or wheel carries it yet.
176
+
177
+ The generated command uses vllm-torchtpu's default multiprocessing multi-host backend: run the
178
+ head command on the slice's first host and the worker commands on the remaining hosts (the
179
+ builder renders both). The **Multi-Node TEP** strategy at 4 nodes matches the validated flags of
180
+ [vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775) with two
181
+ differences: #2775 ran one driver over a Ray cluster (`TPU_MULTIHOST_BACKEND=ray`), and its
182
+ GSM8K validation used the completions API, so the default-on chat and tool-call parsers were not
183
+ exercised on TPU. Validated on a 2x2x4 TPU v7x slice with an FP8 latent KV cache, the unified
184
+ block pool and prefix caching: the complete GSM8K split scored 97.50% (TP32) and 97.42%
185
+ (TP32 + DCP8), prefix-cache hits returned identical tokens and logprobs, and the BEAM-1M
186
+ long-context benchmark matched the GPU reference. The run-specific sizing of that validation
187
+ (10K context, 16 sequences, compile sizes) is not the TPU default — it lives in the two
188
+ **Validated** presets: [TEP32](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=ironwood&strategy=multi_node_tep&preset=v7x_validated) and
189
+ [TEP32 + DCP8](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=ironwood&strategy=multi_node_tep&preset=v7x_dcp8) for KV-capacity-bound workloads.
190
+
191
+ **Spec decoding is gated off on TPU for now**: DSpark with `--async-scheduling` (always on in
192
+ this configuration) needs [vllm-torchtpu#2770](https://github.com/vllm-project/vllm-torchtpu/pull/2770),
193
+ still open. #2775 validated DSpark with 7 draft tokens once that fix is in.
194
+
195
+ ### Prefill/decode disaggregation
196
+
197
+ The **Prefill/Decode Disaggregation** strategy runs one TP8 prefill pool (with expert
198
+ parallelism) and one DEP16 decode pool (TP1 x DP16 with expert parallelism), and decode
199
+ pulls each request's KV from prefill over NIXL. Every PD worker sets
200
+ `VLLM_SSM_CONV_STATE_LAYOUT=DS`: NIXL transfers the Kimi Delta Attention conv state in three
201
+ reads, which needs that layout, and the NIXL connector refuses to start without it.
202
+
203
+ ### KV cache offloading
204
+
205
+ The **Simple** option on the KV Offload row adds `SimpleCPUOffloadConnector`, a host-DRAM
206
+ prefix tier for each GPU. Under Prefill/Decode Disaggregation it is added to the prefill pool
207
+ only, next to NIXL in a MultiConnector; decode keeps plain NIXL. The tier pins
208
+ `cpu_bytes_to_use_per_rank` of host memory for every GPU, so size it from the host DRAM that
209
+ is free after the engines are up. The tested GB300 prefill workers used 128 GiB per GPU
210
+ (512 GiB per tray).
211
+
212
+ ### Strict tool calls
213
+
214
+ Without a grammar, K3.1 sometimes calls a tool with empty or placeholder arguments. The opt-in
215
+ **Strict tool calls** feature adds `--tool-strict-level parameter`, which constrains every
216
+ tool call to a declared tool and to that tool's declared argument names and types, as if each
217
+ tool had set `strict: true`. On the
218
+ [Kimi Vendor Verifier](https://github.com/MoonshotAI/Kimi-Vendor-Verifier) Tool Call benchmark
219
+ (70 samples x 5 epochs, 8x MI355X, single-node TP8, Python frontend) K3.1 Pro scored 0.786
220
+ without the flag and 0.980 with it. The Rust frontend builds its own grammar and was not
221
+ measured. The limits are those in the
222
+ [Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)'s Tool calling note: a tool
223
+ schema the grammar cannot compile fails the whole request, and arguments still need
224
+ validating on the client. The feature is not offered for prefill/decode disaggregation:
225
+ Dynamo workers do not accept the flag and constrain tool calls through their own
226
+ `--dyn-enable-structural-tag`, which the AgentX PD presets set.
227
+
228
+ ### Client usage
229
+
230
+ ```bash
231
+ curl http://localhost:8000/v1/chat/completions \
232
+ -H "Content-Type: application/json" \
233
+ -d '{
234
+ "model": "moonshotai/Kimi-K3.1-Pro",
235
+ "messages": [{"role": "user", "content": "Explain sparse attention in two sentences."}]
236
+ }'
237
+ ```
238
+
239
+ The model card reports its results at `temperature = 1.0` and `top-p = 0.95`, but the
240
+ checkpoint's `generation_config.json` sets no sampling defaults, so the command passes them
241
+ as server defaults with `--override-generation-config`. They apply only to the parameters a
242
+ request omits; a value sent by the client still wins. Without the flag vLLM serves such a
243
+ request at `top_p = 1.0`: on DeepSWE (113 tasks, 8x MI355X, one run each) a coding agent that
244
+ sends neither parameter resolved 75 tasks at that fallback and 88 with `temperature = 1.0`
245
+ and `top_p = 0.95` set in the agent.
246
+
247
+ ### References
248
+
249
+ - [Model card](https://huggingface.co/moonshotai/Kimi-K3.1-Pro)
250
+ - [Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)