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.
- package/LICENSE +9 -0
- package/README.md +96 -2
- package/bin/quantuminfer.js +61 -0
- package/c27/adapters.py +161 -0
- package/c27/harness27.py +349 -0
- package/data/input.txt +40000 -0
- package/data/wikitext/test.txt +7249 -0
- package/engine/API.txt +208 -0
- package/engine/PLUGINS.txt +4 -0
- package/engine/__init__.py +82 -0
- package/engine/adapter.py +505 -0
- package/engine/blocks.py +1180 -0
- package/engine/c12.py +324 -0
- package/engine/c12cu.py +1074 -0
- package/engine/ctx.py +87 -0
- package/engine/dev.py +11 -0
- package/engine/ds4.py +389 -0
- package/engine/kernels.py +833 -0
- package/engine/model.py +281 -0
- package/engine/record.py +140 -0
- package/engine/server.py +183 -0
- package/engine/spec.py +1030 -0
- package/engine/wcode.py +122 -0
- package/p27/SPEC.txt +66 -0
- package/p27/STATUS.txt +91 -0
- package/p27/bench_glm.py +354 -0
- package/p27/bench_multi.py +76 -0
- package/p27/mkfinal.py +98 -0
- package/p27/modal_comp.py +173 -0
- package/p27/modal_dl.py +63 -0
- package/p27/modal_p27.py +168 -0
- package/p27/modal_probe.py +49 -0
- package/p27/p27rules.py +29 -0
- package/p27/pblocks.py +1242 -0
- package/p27/pmodel.py +402 -0
- package/p27/pref.py +151 -0
- package/p27/prof_glm.py +34 -0
- package/p27/quant.py +850 -0
- package/p27/recipes/vllm_b300_single_node_tep_b300_agentx_ep.md +353 -0
- package/p27/recipes/vllm_b300_single_node_tp_b300_agentx.md +351 -0
- package/p27/recipes/vllm_b300_single_node_tp_baseline.md +250 -0
- package/p27/recipes/vllm_default_gb300.md +281 -0
- package/p27/recipes/vllm_glm53_h200.md +301 -0
- package/p27/run_window1.sh +21 -0
- package/p27/run_window2.sh +13 -0
- package/p27/sweep_glm.py +64 -0
- package/p27/t_align.py +42 -0
- package/p27/t_combine.py +28 -0
- package/p27/t_echo.py +31 -0
- package/p27/t_fp8dense.py +59 -0
- package/p27/t_fp8speed.py +48 -0
- package/p27/t_glm.py +340 -0
- package/p27/t_glu.py +30 -0
- package/p27/t_gsuf.py +23 -0
- package/p27/t_jac.py +22 -0
- package/p27/t_moebm.py +30 -0
- package/p27/t_nccl.py +36 -0
- package/p27/t_online_jac.py +31 -0
- package/p27/t_probe.py +4 -0
- package/p27/t_router.py +28 -0
- package/p27/t_symm.py +50 -0
- package/p27/t_tiny.py +116 -0
- package/package.json +34 -4
- package/results/ANALYSIS.md +160 -0
- package/results/comp_vllm_mtp_k5_b300mtp.json +235 -0
- package/results/glm53_b300x8_opt4.json +624 -0
- package/results/res_glm_c32w3_b300.json +638 -0
- package/results/res_glm_final_c32_b300.json +652 -0
- package/results/res_glm_multi_final_b300.json +1821 -0
- package/results/res_glm_online_b300.json +638 -0
- package/results/res_glm_online_fixed_b300.json +638 -0
- package/results/res_glm_opt4_b300.json +624 -0
- package/results/res_glm_t1_j8_b300.json +340 -0
- package/results/res_glm_text_plain_batch_b300.json +5792 -0
- package/results/res_glm_text_w1_b300.json +1635 -0
- package/results/res_glm_text_w3_b300.json +1639 -0
- package/results/res_sweep_echo_b300.json +129 -0
- package/results/res_sweep_final_b300.json +153 -0
- package/results/res_sweep_glm_b300.json +153 -0
- package/results/res_techo.json +29 -0
- package/results/res_tgsuf.json +21 -0
- package/results/res_tjac.json +17 -0
- package/results/res_tonline_jac.json +13 -0
|
@@ -0,0 +1,281 @@
|
|
|
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 `gb300` (4× GB300 NVL4) · strategy `multi_node_tp` (Multi-Node Tensor Parallel) · 2 nodes · variant `default` (MXFP4) · features `tool_calling`, `reasoning`
|
|
6
|
+
|
|
7
|
+
- Interactive page: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro
|
|
8
|
+
- This configuration as JSON: https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.json?hardware=gb300
|
|
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
|
+
Run one command per node: the head (node rank 0) plus 1 worker. Each node's command differs — don't replay one on every node.
|
|
51
|
+
|
|
52
|
+
### Head (node 0)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export GLOO_SOCKET_IFNAME=$IFACE_NAME
|
|
56
|
+
export NCCL_SOCKET_IFNAME=$IFACE_NAME
|
|
57
|
+
export VLLM_ENGINE_READY_TIMEOUT_S=3600
|
|
58
|
+
vllm serve moonshotai/Kimi-K3.1-Pro \
|
|
59
|
+
--trust-remote-code \
|
|
60
|
+
--override-generation-config '{"temperature":1.0,"top_p":0.95}' \
|
|
61
|
+
--tensor-parallel-size 8 \
|
|
62
|
+
--nnodes 2 \
|
|
63
|
+
--node-rank 0 \
|
|
64
|
+
--master-addr $HEAD_IP \
|
|
65
|
+
--load-format fastsafetensors \
|
|
66
|
+
--enable-auto-tool-choice \
|
|
67
|
+
--tool-call-parser kimi_k3 \
|
|
68
|
+
--reasoning-parser kimi_k3
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Node 1
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export GLOO_SOCKET_IFNAME=$IFACE_NAME
|
|
75
|
+
export NCCL_SOCKET_IFNAME=$IFACE_NAME
|
|
76
|
+
export VLLM_ENGINE_READY_TIMEOUT_S=3600
|
|
77
|
+
vllm serve moonshotai/Kimi-K3.1-Pro \
|
|
78
|
+
--trust-remote-code \
|
|
79
|
+
--override-generation-config '{"temperature":1.0,"top_p":0.95}' \
|
|
80
|
+
--tensor-parallel-size 8 \
|
|
81
|
+
--nnodes 2 \
|
|
82
|
+
--node-rank 1 \
|
|
83
|
+
--master-addr $HEAD_IP \
|
|
84
|
+
--headless \
|
|
85
|
+
--load-format fastsafetensors \
|
|
86
|
+
--enable-auto-tool-choice \
|
|
87
|
+
--tool-call-parser kimi_k3 \
|
|
88
|
+
--reasoning-parser kimi_k3
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Docker equivalent:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Head
|
|
95
|
+
docker run --gpus all \
|
|
96
|
+
--privileged --ipc=host -p 8000:8000 \
|
|
97
|
+
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
|
98
|
+
-e GLOO_SOCKET_IFNAME=$IFACE_NAME \
|
|
99
|
+
-e NCCL_SOCKET_IFNAME=$IFACE_NAME \
|
|
100
|
+
-e VLLM_ENGINE_READY_TIMEOUT_S=3600 \
|
|
101
|
+
vllm/vllm-openai:kimi-k31 moonshotai/Kimi-K3.1-Pro \
|
|
102
|
+
--trust-remote-code \
|
|
103
|
+
--override-generation-config '{"temperature":1.0,"top_p":0.95}' \
|
|
104
|
+
--tensor-parallel-size 8 \
|
|
105
|
+
--nnodes 2 \
|
|
106
|
+
--node-rank 0 \
|
|
107
|
+
--master-addr $HEAD_IP \
|
|
108
|
+
--load-format fastsafetensors \
|
|
109
|
+
--enable-auto-tool-choice \
|
|
110
|
+
--tool-call-parser kimi_k3 \
|
|
111
|
+
--reasoning-parser kimi_k3
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Guide
|
|
115
|
+
|
|
116
|
+
> Background reference. Commands in it are examples and may target another configuration — use the Serve section above.
|
|
117
|
+
|
|
118
|
+
### Overview
|
|
119
|
+
|
|
120
|
+
Kimi-K3.1 keeps the Kimi-K3 layout (Kimi Delta Attention, 896 routed experts with 16 active
|
|
121
|
+
per token, a latent MoE projection and a vision encoder) and adds sparse
|
|
122
|
+
attention (DSA, top-2048 indexer) to 24 of its MLA layers. The checkpoint ships MXFP4
|
|
123
|
+
routed-expert weights; everything else is BF16.
|
|
124
|
+
|
|
125
|
+
The baseline is the simplest working setup on NVIDIA: one tensor-parallel group of 8 GPUs,
|
|
126
|
+
either two GB300 trays or one B300 node. Throughput was not tuned. On B300 it sets
|
|
127
|
+
`--max-num-seqs 128`, since the KV cache can't hold the default 1,024 sequences, and turns
|
|
128
|
+
FlashInfer autotuning off, which would otherwise add about two hours to startup.
|
|
129
|
+
|
|
130
|
+
VR200 (preview) takes the same TP8 layout on two trays, in the `vllm/vllm-openai:kimi-k31-cu134`
|
|
131
|
+
image (CUDA 13.4). It uses the Blackwell flags and hasn't been tuned or verified on Rubin.
|
|
132
|
+
|
|
133
|
+
On one B300 node, three AgentX presets follow InferenceX's B300 vLLM AgentX lane
|
|
134
|
+
(SemiAnalysisAI/InferenceX#4871), all with TP8 + DCP8 attention, the K3.1 DSpark draft, the
|
|
135
|
+
low-latency decode backend and host KV offload:
|
|
136
|
+
[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,
|
|
137
|
+
[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,
|
|
138
|
+
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.
|
|
139
|
+
|
|
140
|
+
On MI355X, one node takes the same TP8 layout with the AMD profile's AITER environment, in the
|
|
141
|
+
`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
|
|
142
|
+
follows InferenceX's MI355X vLLM AgentX lane (SemiAnalysisAI/InferenceX#5196) with one point per
|
|
143
|
+
concurrency, all with the K3.1 DSpark draft: plain TP8 with GPU KV and the low-latency decode
|
|
144
|
+
backend at concurrency 1, DCP8 with GPU KV and the low-latency decode backend at 4, and DCP8
|
|
145
|
+
with host KV offload from 16 to 48. It needs the image the preset pins.
|
|
146
|
+
|
|
147
|
+
On Zhenwu PPUs, the default MXFP4 checkpoint runs without speculative decoding on
|
|
148
|
+
two 16-PPU 810E nodes with TP32 / EP32, or four 8-PPU M890 nodes with TP8 / DP4 / EP32.
|
|
149
|
+
On 810E, `ppu_deep_gemm_w4a16` loads the checkpoint with a W4A16 compute path.
|
|
150
|
+
Use the PPU image specified for each hardware configuration.
|
|
151
|
+
|
|
152
|
+
On TPU, the model is served by [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu),
|
|
153
|
+
text-only: the vision tower is not loaded. The validated layout is TP32 with expert
|
|
154
|
+
parallelism on a 2x2x4 TPU v7x slice (16 chips, 32 devices, on 4 hosts). See [TPU serving](#tpu-serving).
|
|
155
|
+
|
|
156
|
+
### Tensor + expert parallelism
|
|
157
|
+
|
|
158
|
+
On one B300 node, the **Tensor + Expert Parallel** strategy keeps attention at TP8 and runs
|
|
159
|
+
the routed experts with expert parallelism on the MegaMoE kernel. It has the lowest
|
|
160
|
+
long-prompt time to first token of the single-node layouts: a single 340K-token prompt
|
|
161
|
+
prefills in about 10 s, against about 15 s at plain TP8 (8x B300, one request at a time,
|
|
162
|
+
pre-release checkpoint).
|
|
163
|
+
|
|
164
|
+
### Long context: decode context parallelism
|
|
165
|
+
|
|
166
|
+
The **Decode Context Parallelism** row shards the MLA latent and indexer-key caches across
|
|
167
|
+
the 8 GPUs of the TP group instead of replicating them, so DCP8 holds about 7x the KV cache
|
|
168
|
+
tokens of TP8 (about 18.5M vs 2.6M tokens with FP8 KV on 8x B300). Prefill is as fast as
|
|
169
|
+
at TP8. Decode steps are 7–25% slower than TP8 at the same batch, so use DCP when KV
|
|
170
|
+
capacity is the limit: very long contexts or many long-lived agentic sessions.
|
|
171
|
+
|
|
172
|
+
### Low-latency decode
|
|
173
|
+
|
|
174
|
+
The **Low-latency decode** feature switches decode steps to a fused CuTe DSL path tuned for
|
|
175
|
+
small batches; prefill and mixed steps still run the default path. On 8x B300 at TP8 it cuts
|
|
176
|
+
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
|
|
177
|
+
to within 6% of TP8. It requires the V2 model runner and FULL decode CUDA graphs (the
|
|
178
|
+
defaults), and TP8 or TP8 + DCP8. The feature toggle is offered only without expert
|
|
179
|
+
parallelism; the B300 AgentX preset with routed experts EP8 on MegaMoE
|
|
180
|
+
([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
|
|
181
|
+
the same `decode_backend` in its own args.
|
|
182
|
+
|
|
183
|
+
On MI355X the same switch selects fused FlyDSL decode kernels. They cover only pure decode
|
|
184
|
+
steps of up to 16 rows, so among other checks they also need speculative decoding,
|
|
185
|
+
`--max-num-seqs` 1, 2, 4 or 8 with `--max-num-seqs` × (1 + draft tokens) ≤ 16, BF16 KDA
|
|
186
|
+
projections, an FP32 KDA recurrent state (`--mamba-ssm-cache-dtype float32`) and no KV
|
|
187
|
+
offload. Without DCP they serve only 3 or 7 draft tokens at `--max-num-seqs` 1 or 2, so the
|
|
188
|
+
MI355X default of 5 draft tokens needs DCP8. The concurrency-1 (no DCP) and 4 (DCP8) points
|
|
189
|
+
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;
|
|
190
|
+
current vLLM main does not yet run K3.1 on this path without DCP. Its points from
|
|
191
|
+
concurrency 16 do not qualify, so leave the feature off there.
|
|
192
|
+
|
|
193
|
+
### NVFP4 KV cache
|
|
194
|
+
|
|
195
|
+
The **NVFP4 KV cache** feature stores the MLA latent in NVFP4 (352 bytes per token per layer
|
|
196
|
+
instead of 576) and holds about 1.5x the KV cache tokens of FP8. The indexer keys stay FP8,
|
|
197
|
+
so the top-2048 token selection is unchanged. GSM8K matched FP8 on 8x GB300 (96.1% vs 96.2%);
|
|
198
|
+
long-context accuracy has not been measured yet.
|
|
199
|
+
|
|
200
|
+
### TPU serving
|
|
201
|
+
|
|
202
|
+
TPU serving runs through [vLLM torch-TPU](https://github.com/vllm-project/vllm-torchtpu) and
|
|
203
|
+
is text-only: the vision tower is not loaded. K3.1 support is under review as
|
|
204
|
+
[vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775); until it merges,
|
|
205
|
+
the Install tab on TPU builds from the `kimi-k31pro` staging branch (Python 3.12, uv). No
|
|
206
|
+
published image or wheel carries it yet.
|
|
207
|
+
|
|
208
|
+
The generated command uses vllm-torchtpu's default multiprocessing multi-host backend: run the
|
|
209
|
+
head command on the slice's first host and the worker commands on the remaining hosts (the
|
|
210
|
+
builder renders both). The **Multi-Node TEP** strategy at 4 nodes matches the validated flags of
|
|
211
|
+
[vllm-torchtpu#2775](https://github.com/vllm-project/vllm-torchtpu/pull/2775) with two
|
|
212
|
+
differences: #2775 ran one driver over a Ray cluster (`TPU_MULTIHOST_BACKEND=ray`), and its
|
|
213
|
+
GSM8K validation used the completions API, so the default-on chat and tool-call parsers were not
|
|
214
|
+
exercised on TPU. Validated on a 2x2x4 TPU v7x slice with an FP8 latent KV cache, the unified
|
|
215
|
+
block pool and prefix caching: the complete GSM8K split scored 97.50% (TP32) and 97.42%
|
|
216
|
+
(TP32 + DCP8), prefix-cache hits returned identical tokens and logprobs, and the BEAM-1M
|
|
217
|
+
long-context benchmark matched the GPU reference. The run-specific sizing of that validation
|
|
218
|
+
(10K context, 16 sequences, compile sizes) is not the TPU default — it lives in the two
|
|
219
|
+
**Validated** presets: [TEP32](https://recipes.vllm.ai/moonshotai/Kimi-K3.1-Pro.md?hardware=ironwood&strategy=multi_node_tep&preset=v7x_validated) and
|
|
220
|
+
[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.
|
|
221
|
+
|
|
222
|
+
**Spec decoding is gated off on TPU for now**: DSpark with `--async-scheduling` (always on in
|
|
223
|
+
this configuration) needs [vllm-torchtpu#2770](https://github.com/vllm-project/vllm-torchtpu/pull/2770),
|
|
224
|
+
still open. #2775 validated DSpark with 7 draft tokens once that fix is in.
|
|
225
|
+
|
|
226
|
+
### Prefill/decode disaggregation
|
|
227
|
+
|
|
228
|
+
The **Prefill/Decode Disaggregation** strategy runs one TP8 prefill pool (with expert
|
|
229
|
+
parallelism) and one DEP16 decode pool (TP1 x DP16 with expert parallelism), and decode
|
|
230
|
+
pulls each request's KV from prefill over NIXL. Every PD worker sets
|
|
231
|
+
`VLLM_SSM_CONV_STATE_LAYOUT=DS`: NIXL transfers the Kimi Delta Attention conv state in three
|
|
232
|
+
reads, which needs that layout, and the NIXL connector refuses to start without it.
|
|
233
|
+
|
|
234
|
+
### KV cache offloading
|
|
235
|
+
|
|
236
|
+
The **Simple** option on the KV Offload row adds `SimpleCPUOffloadConnector`, a host-DRAM
|
|
237
|
+
prefix tier for each GPU. Under Prefill/Decode Disaggregation it is added to the prefill pool
|
|
238
|
+
only, next to NIXL in a MultiConnector; decode keeps plain NIXL. The tier pins
|
|
239
|
+
`cpu_bytes_to_use_per_rank` of host memory for every GPU, so size it from the host DRAM that
|
|
240
|
+
is free after the engines are up. The tested GB300 prefill workers used 128 GiB per GPU
|
|
241
|
+
(512 GiB per tray).
|
|
242
|
+
|
|
243
|
+
### Strict tool calls
|
|
244
|
+
|
|
245
|
+
Without a grammar, K3.1 sometimes calls a tool with empty or placeholder arguments. The opt-in
|
|
246
|
+
**Strict tool calls** feature adds `--tool-strict-level parameter`, which constrains every
|
|
247
|
+
tool call to a declared tool and to that tool's declared argument names and types, as if each
|
|
248
|
+
tool had set `strict: true`. On the
|
|
249
|
+
[Kimi Vendor Verifier](https://github.com/MoonshotAI/Kimi-Vendor-Verifier) Tool Call benchmark
|
|
250
|
+
(70 samples x 5 epochs, 8x MI355X, single-node TP8, Python frontend) K3.1 Pro scored 0.786
|
|
251
|
+
without the flag and 0.980 with it. The Rust frontend builds its own grammar and was not
|
|
252
|
+
measured. The limits are those in the
|
|
253
|
+
[Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)'s Tool calling note: a tool
|
|
254
|
+
schema the grammar cannot compile fails the whole request, and arguments still need
|
|
255
|
+
validating on the client. The feature is not offered for prefill/decode disaggregation:
|
|
256
|
+
Dynamo workers do not accept the flag and constrain tool calls through their own
|
|
257
|
+
`--dyn-enable-structural-tag`, which the AgentX PD presets set.
|
|
258
|
+
|
|
259
|
+
### Client usage
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
curl http://localhost:8000/v1/chat/completions \
|
|
263
|
+
-H "Content-Type: application/json" \
|
|
264
|
+
-d '{
|
|
265
|
+
"model": "moonshotai/Kimi-K3.1-Pro",
|
|
266
|
+
"messages": [{"role": "user", "content": "Explain sparse attention in two sentences."}]
|
|
267
|
+
}'
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The model card reports its results at `temperature = 1.0` and `top-p = 0.95`, but the
|
|
271
|
+
checkpoint's `generation_config.json` sets no sampling defaults, so the command passes them
|
|
272
|
+
as server defaults with `--override-generation-config`. They apply only to the parameters a
|
|
273
|
+
request omits; a value sent by the client still wins. Without the flag vLLM serves such a
|
|
274
|
+
request at `top_p = 1.0`: on DeepSWE (113 tasks, 8x MI355X, one run each) a coding agent that
|
|
275
|
+
sends neither parameter resolved 75 tasks at that fallback and 88 with `temperature = 1.0`
|
|
276
|
+
and `top_p = 0.95` set in the agent.
|
|
277
|
+
|
|
278
|
+
### References
|
|
279
|
+
|
|
280
|
+
- [Model card](https://huggingface.co/moonshotai/Kimi-K3.1-Pro)
|
|
281
|
+
- [Kimi-K3 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K3)
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# zai-org/GLM-5.3 — vLLM serving recipe
|
|
2
|
+
|
|
3
|
+
> GLM-5.3 — Frontier Coding with Emergent Cyber Capabilities
|
|
4
|
+
|
|
5
|
+
Configuration: hardware `h200` (8× H200) · strategy `single_node_tp` (Tensor Parallel) · variant `default` (FP8) · features `tool_calling`, `reasoning` · frontend `rust`
|
|
6
|
+
|
|
7
|
+
- Interactive page: https://recipes.vllm.ai/zai-org/GLM-5.3?hardware=h200
|
|
8
|
+
- This configuration as JSON: https://recipes.vllm.ai/zai-org/GLM-5.3.json?hardware=h200
|
|
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`: `h100`, `h200`, `b200`, `gb200`, `b300`, `gb300`, `dgx_station_gb300`, `mi300x`, `mi325x`, `mi350x`, `mi355x`, `ascend_910b`, `ascend_950pr_8x`
|
|
17
|
+
- `variant`: `default`, `nvfp4`, `w4a8`, `bf16`, `ascend_w8a8c8`
|
|
18
|
+
- `strategy`: `single_node_tp`, `single_node_tep`, `multi_node_tp`, `multi_node_tp_pp`, `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` (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
|
+
- `ascend_a2_w8a8c8_pd` — W8A8C8 PD (1P + 1D) (ascend_910b · PD · Prefill/decode disaggregation, 1M context, 8 nodes x 8 Ascend 910B · opt-in): `hardware=ascend_910b&variant=ascend_w8a8c8&strategy=pd_cluster&preset=ascend_a2_w8a8c8_pd`
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
Requires vLLM >= 0.29.0.
|
|
31
|
+
|
|
32
|
+
Native GLM5Next rendering requires a build containing vllm-project/vllm#62424, including its Rust binary. The minimum version alone does not include this support.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv venv
|
|
36
|
+
source .venv/bin/activate
|
|
37
|
+
uv pip install -U vllm --torch-backend auto
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Docker image: `vllm/vllm-openai:latest`
|
|
41
|
+
|
|
42
|
+
## Serve
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export VLLM_USE_RUST_FRONTEND=1
|
|
46
|
+
vllm serve zai-org/GLM-5.3 \
|
|
47
|
+
--tokenizer-mode glm5_next \
|
|
48
|
+
--max-model-len 262144 \
|
|
49
|
+
--tensor-parallel-size 8 \
|
|
50
|
+
--kv-cache-dtype fp8 \
|
|
51
|
+
--tool-call-parser glm47 \
|
|
52
|
+
--enable-auto-tool-choice \
|
|
53
|
+
--reasoning-parser glm47
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Docker equivalent:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
docker run --gpus all \
|
|
60
|
+
--privileged --ipc=host -p 8000:8000 \
|
|
61
|
+
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
|
62
|
+
-e VLLM_USE_RUST_FRONTEND=1 \
|
|
63
|
+
vllm/vllm-openai:latest zai-org/GLM-5.3 \
|
|
64
|
+
--tokenizer-mode glm5_next \
|
|
65
|
+
--max-model-len 262144 \
|
|
66
|
+
--tensor-parallel-size 8 \
|
|
67
|
+
--kv-cache-dtype fp8 \
|
|
68
|
+
--tool-call-parser glm47 \
|
|
69
|
+
--enable-auto-tool-choice \
|
|
70
|
+
--reasoning-parser glm47
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Guide
|
|
74
|
+
|
|
75
|
+
> Background reference. Commands in it are examples and may target another configuration — use the Serve section above.
|
|
76
|
+
|
|
77
|
+
### Overview
|
|
78
|
+
|
|
79
|
+
**GLM-5.3** is the newest model in the GLM-5 series — a ~743B-parameter MoE (39B active) from **Z-AI**.
|
|
80
|
+
The **default `zai-org/GLM-5.3` checkpoint is native FP8** — BF16 weights live under the suffixed `zai-org/GLM-5.3-BF16` repo.
|
|
81
|
+
|
|
82
|
+
The FP8 checkpoint fits on a single 8xH200 / 8xH20 node and — with FP8 KV cache — reaches the full 1M-token context on 8xB200.
|
|
83
|
+
An NVFP4 checkpoint for Blackwell is published by Inferact (`Inferact/GLM-5.3-NVFP4`).
|
|
84
|
+
|
|
85
|
+
### Prerequisites
|
|
86
|
+
|
|
87
|
+
- **vLLM:** a build containing [native GLM5Next support (#62424)](https://github.com/vllm-project/vllm/pull/62424), including the matching Rust frontend binary.
|
|
88
|
+
- **Transformers:** 5.15.0 or newer.
|
|
89
|
+
- **GPU:** 8xH200 or 8xH20 (141 GB each) for single-node FP8; 8xB200 (180 GB each) for the full 1M context.
|
|
90
|
+
|
|
91
|
+
### Installation
|
|
92
|
+
|
|
93
|
+
Use a wheel or container built with #62424 for the Rust commands below.
|
|
94
|
+
The older release and hardware-specific image pins record prior model validation;
|
|
95
|
+
they need an updated build to use `--tokenizer-mode glm5_next`.
|
|
96
|
+
|
|
97
|
+
### Frontends
|
|
98
|
+
|
|
99
|
+
The command builder defaults to **Rust** and adds `--tokenizer-mode glm5_next`.
|
|
100
|
+
With `VLLM_USE_RUST_FRONTEND=1`, this selects native GLM5Next chat rendering for
|
|
101
|
+
GLM-5.3, including tool calls and reasoning options.
|
|
102
|
+
|
|
103
|
+
Select **Python** in the command builder, or set `VLLM_USE_RUST_FRONTEND=0`,
|
|
104
|
+
to use the Hugging Face renderer on the same build. On older builds that do not
|
|
105
|
+
recognize `glm5_next`, also replace `--tokenizer-mode glm5_next` with
|
|
106
|
+
`--tokenizer-mode auto`.
|
|
107
|
+
|
|
108
|
+
### Launching the server
|
|
109
|
+
|
|
110
|
+
#### FP8 on 8xH200 (standard)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
VLLM_USE_RUST_FRONTEND=1 vllm serve zai-org/GLM-5.3 \
|
|
114
|
+
--tokenizer-mode glm5_next \
|
|
115
|
+
--kv-cache-dtype fp8 \
|
|
116
|
+
--tensor-parallel-size 8 \
|
|
117
|
+
--speculative-config.method mtp \
|
|
118
|
+
--speculative-config.num_speculative_tokens 5 \
|
|
119
|
+
--tool-call-parser glm47 \
|
|
120
|
+
--reasoning-parser glm47 \
|
|
121
|
+
--enable-auto-tool-choice \
|
|
122
|
+
--served-model-name glm-5.3
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### FP8 on AMD MI300X/MI325X/MI350X/MI355X
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
VLLM_ROCM_USE_AITER=1 \
|
|
129
|
+
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
|
|
130
|
+
VLLM_USE_RUST_FRONTEND=1 \
|
|
131
|
+
vllm serve zai-org/GLM-5.3 \
|
|
132
|
+
--tokenizer-mode glm5_next \
|
|
133
|
+
--kv-cache-dtype fp8_e4m3 \
|
|
134
|
+
--tensor-parallel-size 8 \
|
|
135
|
+
--speculative-config.method mtp \
|
|
136
|
+
--speculative-config.num_speculative_tokens 5 \
|
|
137
|
+
--tool-call-parser glm47 \
|
|
138
|
+
--enable-auto-tool-choice \
|
|
139
|
+
--reasoning-parser glm47 \
|
|
140
|
+
--gpu-memory-utilization 0.80 \
|
|
141
|
+
--max-model-len 524288 \
|
|
142
|
+
--max-num-seqs 32 \
|
|
143
|
+
--linear-backend aiter \
|
|
144
|
+
--moe-backend aiter
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Earlier validation on 8x MI325X with `vllm/vllm-openai-rocm:v0.29.0` served
|
|
148
|
+
`--max-model-len 524288` at `--gpu-memory-utilization 0.80`, reporting a 1,477,168-token
|
|
149
|
+
KV cache and 2.82x maximum concurrency. MTP is healthy there: a mean acceptance length of
|
|
150
|
+
2.77 with 5 tokens drafted per step on a ~500-token greedy generation.
|
|
151
|
+
|
|
152
|
+
On 8x MI350X with the same image and settings, it reports a 2,013,072-token KV cache and
|
|
153
|
+
3.84x maximum concurrency, and MTP's mean acceptance length is 3.19 with 5 tokens drafted
|
|
154
|
+
per step on a 512-token greedy generation.
|
|
155
|
+
|
|
156
|
+
#### FP8 on 8xB200 (full 1M context)
|
|
157
|
+
|
|
158
|
+
GLM-5.3 has a native 1M-token window. Whether the full window fits is a KV-cache VRAM
|
|
159
|
+
question, so the lever is `--max-num-seqs` — it bounds how many sequences share the KV
|
|
160
|
+
budget at once. **Start at 32** and scale with your node's VRAM. FP8 KV cache
|
|
161
|
+
(`--kv-cache-dtype fp8_e4m3`, already in the base flags) roughly halves that budget.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
VLLM_USE_RUST_FRONTEND=1 vllm serve zai-org/GLM-5.3 \
|
|
165
|
+
--tokenizer-mode glm5_next \
|
|
166
|
+
--kv-cache-dtype fp8_e4m3 \
|
|
167
|
+
--tensor-parallel-size 8 \
|
|
168
|
+
--speculative-config.method mtp \
|
|
169
|
+
--speculative-config.num_speculative_tokens 5 \
|
|
170
|
+
--max-num-seqs 32 \
|
|
171
|
+
--tool-call-parser glm47 \
|
|
172
|
+
--reasoning-parser glm47 \
|
|
173
|
+
--enable-auto-tool-choice \
|
|
174
|
+
--served-model-name glm-5.3
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
- **`--max-num-seqs 32`** — the single knob for fitting 1M context; start at 32 and tune it
|
|
178
|
+
to your VRAM (up on headroom, down on OOM).
|
|
179
|
+
- **BF16** weights are served from `zai-org/GLM-5.3-BF16` and need multi-node deployment.
|
|
180
|
+
|
|
181
|
+
#### NVFP4 on Blackwell (B200/B300)
|
|
182
|
+
|
|
183
|
+
The `Inferact/GLM-5.3-NVFP4` variant is Inferact's NVFP4 re-quantization : only the MoE expert linears drop to NVFP4 while shared experts,
|
|
184
|
+
attention, embeddings, and the early dense layers stay BF16. The ~465 GB checkpoint fits comfortably on Blackwell
|
|
185
|
+
Select the **NVFP4** variant above (Blackwell-only) or run:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
VLLM_USE_RUST_FRONTEND=1 vllm serve Inferact/GLM-5.3-NVFP4 \
|
|
189
|
+
--tokenizer-mode glm5_next \
|
|
190
|
+
--tensor-parallel-size 8 \
|
|
191
|
+
--enable-expert-parallel \
|
|
192
|
+
--reasoning-parser glm47 \
|
|
193
|
+
--tool-call-parser glm47 \
|
|
194
|
+
--enable-auto-tool-choice \
|
|
195
|
+
--kv-cache-dtype fp8_e4m3 \
|
|
196
|
+
--served-model-name glm-5.3-nvfp4
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### DSpark (opt-in)
|
|
200
|
+
|
|
201
|
+
DSpark is an external confidence-scheduled drafter. Serve `zai-org/GLM-5.3` and attach
|
|
202
|
+
[RedHatAI/GLM-5.3-speculator.dspark](https://huggingface.co/RedHatAI/GLM-5.3-speculator.dspark)
|
|
203
|
+
with eight speculative tokens:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
VLLM_USE_RUST_FRONTEND=1 vllm serve zai-org/GLM-5.3 \
|
|
207
|
+
--tokenizer-mode glm5_next \
|
|
208
|
+
--tensor-parallel-size 8 \
|
|
209
|
+
--speculative-config '{"method":"dspark","model":"RedHatAI/GLM-5.3-speculator.dspark","num_speculative_tokens":8}'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Reasoning modes
|
|
213
|
+
|
|
214
|
+
Thinking is always on — the generation prompt opens a `<think>` block unconditionally.
|
|
215
|
+
GLM-5.3 offers **three reasoning effort levels** driven by the `reasoning_effort`
|
|
216
|
+
field; the default is **`max`**:
|
|
217
|
+
|
|
218
|
+
| Mode | How to request | Behavior |
|
|
219
|
+
|------|----------------|----------|
|
|
220
|
+
| **Think Max** (default) | omit `reasoning_effort`, or set `"max"` | Deepest reasoning — hard math, multi-step planning, agentic tasks. Highest token cost. |
|
|
221
|
+
| **Think High** | `"reasoning_effort": "high"` | Balanced depth and latency. |
|
|
222
|
+
| **Think Low** | `"reasoning_effort": "low"` | Lightest reasoning — simple Q&A, lowest latency and token cost. |
|
|
223
|
+
|
|
224
|
+
The chat template resolves effort to **`max` unless `reasoning_effort` is explicitly
|
|
225
|
+
`"low"` or `"high"`** (any other value falls back to `max`), then injects
|
|
226
|
+
`Reasoning Effort: Low|High|Max` into the system prompt. Pass it through
|
|
227
|
+
`chat_template_kwargs` or the top-level OpenAI `reasoning_effort` field.
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
from openai import OpenAI
|
|
231
|
+
|
|
232
|
+
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
|
233
|
+
msgs = [{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}]
|
|
234
|
+
|
|
235
|
+
# Think Max (default) — just omit reasoning_effort
|
|
236
|
+
client.chat.completions.create(model="glm-5.3", messages=msgs, max_tokens=4096)
|
|
237
|
+
|
|
238
|
+
# Think High / Think Low — explicitly request the effort level
|
|
239
|
+
client.chat.completions.create(
|
|
240
|
+
model="glm-5.3",
|
|
241
|
+
messages=msgs,
|
|
242
|
+
max_tokens=4096,
|
|
243
|
+
extra_body={"chat_template_kwargs": {"reasoning_effort": "low"}},
|
|
244
|
+
)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
curl http://localhost:8000/v1/chat/completions \
|
|
249
|
+
-H "Content-Type: application/json" \
|
|
250
|
+
-d '{
|
|
251
|
+
"model": "glm-5.3",
|
|
252
|
+
"messages": [{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}],
|
|
253
|
+
"temperature": 1,
|
|
254
|
+
"max_tokens": 4096,
|
|
255
|
+
"chat_template_kwargs": {"reasoning_effort": "high"}
|
|
256
|
+
}'
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Client usage
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
from openai import OpenAI
|
|
263
|
+
|
|
264
|
+
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
|
265
|
+
response = client.chat.completions.create(
|
|
266
|
+
model="glm-5.3",
|
|
267
|
+
messages=[{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}],
|
|
268
|
+
temperature=1.0,
|
|
269
|
+
max_tokens=256,
|
|
270
|
+
)
|
|
271
|
+
print(response.choices[0].message.content)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Benchmarking
|
|
275
|
+
|
|
276
|
+
Add `--no-enable-prefix-caching` to the server command for a clean measurement.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
vllm bench serve \
|
|
280
|
+
--model zai-org/GLM-5.3 \
|
|
281
|
+
--dataset-name random \
|
|
282
|
+
--random-input-len 8000 \
|
|
283
|
+
--random-output-len 1024 \
|
|
284
|
+
--request-rate 10 \
|
|
285
|
+
--num-prompts 32 \
|
|
286
|
+
--ignore-eos
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
> **Note:** pure throughput benchmarks tend to under-report real speed, because MTP's
|
|
290
|
+
> acceptance rate is usually low in synthetic runs.
|
|
291
|
+
|
|
292
|
+
### Troubleshooting
|
|
293
|
+
|
|
294
|
+
- **FP8 performance:** DeepGEMM is required — it is bundled in vLLM wheels, so no separate install is needed.
|
|
295
|
+
|
|
296
|
+
### References
|
|
297
|
+
|
|
298
|
+
- [Model card](https://huggingface.co/zai-org/GLM-5.3)
|
|
299
|
+
- [BF16 checkpoint](https://huggingface.co/zai-org/GLM-5.3-BF16)
|
|
300
|
+
- [NVFP4 checkpoint (Inferact)](https://huggingface.co/Inferact/GLM-5.3-NVFP4)
|
|
301
|
+
- [DSpark draft](https://huggingface.co/RedHatAI/GLM-5.3-speculator.dspark)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# P27 GPU window 10:15-11:30 UTC (8xH200): competitor baselines on GLM-5.3, one 8-GPU container at a time.
|
|
3
|
+
# Each run gets a harness deadline so it stops itself before the window ends; a run is not started with < 20 min left.
|
|
4
|
+
cd "$(dirname "$0")"
|
|
5
|
+
END=$(date -u -d "11:27" +%s)
|
|
6
|
+
PLAN='{"single":["code","chat","wikitext@512"],"single_t1":["chat","heldout"],"batched":[1,8,32,64,128],"shared":[32,128],"ttft":[8192,32768],"reps":2,"ttft_reps":5}'
|
|
7
|
+
run() { # engine mode tag
|
|
8
|
+
now=$(date -u +%s)
|
|
9
|
+
if [ $((END - now)) -lt 1200 ]; then echo "$(date -u +%T) skip $1 $2: <20 min left"; return; fi
|
|
10
|
+
dl=$((END - 60))
|
|
11
|
+
echo "$(date -u +%T) start $1 $2"
|
|
12
|
+
timeout $((END - now + 120)) env P27_GPU=B200:8 modal run modal_comp.py::main --engine $1 --mode $2 --tag $3 --plan "$PLAN" \
|
|
13
|
+
--opts "{\"deadline\": $dl, \"max_len\": 40960, \"max_seqs\": 128}" > logs/comp_$1_$2_$3.log 2>&1
|
|
14
|
+
echo "$(date -u +%T) done $1 $2 rc=$?"
|
|
15
|
+
}
|
|
16
|
+
: echo "skip (reduced depth, real checkpoint, 8 ranks)"
|
|
17
|
+
: timeout 900 modal run modal_p27.py --job t_glm:main_real --arg '{"nl": 4, "shard": "ep_tp"}' --gpus b200x8 > logs/real4_w1.log 2>&1
|
|
18
|
+
: echo " rc=$?"
|
|
19
|
+
run vllm mtp w1
|
|
20
|
+
run sglang mtp w1
|
|
21
|
+
run vllm plain w1
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# P27 GPU window 12:15-14:30 UTC (8 GPUs): our engine on GLM-5.3, same 8xB200 node type as the competitors.
|
|
3
|
+
cd "$(dirname "$0")"
|
|
4
|
+
until [ $(date -u +%H%M) -ge 1215 ]; do sleep 5; done
|
|
5
|
+
echo "$(date -u +%T) dev unit tests (1 GPU): fp8 GEMMs, Triton dispatch == torch dispatch, tiny GLM vs HF fp32"
|
|
6
|
+
timeout 400 modal run modal_p27.py --job t_glm --arg '{"n_gen": 16, "fast": true}' --gpus dev > logs/w2_tglm.log 2>&1
|
|
7
|
+
python3 -c "import json;R=json.load(open('out/res_t_glm.json'));print({k:v for k,v in R['unit'].items() if 'align' in k})"
|
|
8
|
+
ALIGN=$(python3 -c "import json;R=json.load(open('out/res_t_glm.json'));print('true' if all(v for k,v in R['unit'].items() if 'align' in k) else 'false')")
|
|
9
|
+
echo "$(date -u +%T) align_triton=$ALIGN; start bench (8xB200)"
|
|
10
|
+
PLAN='{"single":["code","chat","wikitext@512"],"single_t1":["chat","heldout"],"batched":[1,8,32,64,128],"shared":[32,128],"ttft":[8192,32768],"ttft_reps":5}'
|
|
11
|
+
timeout 7800 modal run modal_p27.py --job bench_glm --gpus b200x8 --out out/res_bench_w2a.json \
|
|
12
|
+
--arg "{\"plan\": $PLAN, \"tag\": \"w2a\", \"align_triton\": $ALIGN}" > logs/w2_bench_a.log 2>&1
|
|
13
|
+
echo "$(date -u +%T) bench done rc=$?"
|