vLLM-TorchTPU recipes for TPU v7x¶
Use this guide when you serve a model on TPU v7x (Ironwood) and want the configuration the vLLM-TorchTPU project benchmarks in CI. The recipes below follow the vLLM-TorchTPU TPU v7x (Ironwood) Serving Recipes page, which mirrors the repository's PR and nightly performance configurations under scripts/vllm/benchmarking/configs/; each recipe lists every flag and environment variable. Chapter 18 explains the flags, the DP plus EP layout that most of them use, and the token buckets they compile.
v7x provisioning in the public documentation
The public documents differ on how TPU v7x is provisioned. The vLLM-TorchTPU Cloud TPU Setup page generates queued-resource commands for v7x. Google Cloud's TPU queued resources documentation says the Cloud TPU API does not support Ironwood (TPU7x) or later generations, and TorchTPU's VM guide says GKE "is necessary to access recent TPU hardware". Plan on GKE for v7x; chapter 8 explains the choice.
Prerequisites¶
- A v7x host or slice with vLLM-TorchTPU installed: Serve a first model with vLLM-TorchTPU, steps 1 to 3. The vLLM-TorchTPU setup page provisions v7x through queued resources (see the note above).
- The device arithmetic: each v7x chip exposes 2 logical TensorCore devices (192 GB of HBM per chip, 96 GB per device), so a 4-chip host (
tpu7x-8) has 8 devices and 768 GB. Recipes count devices, not chips. - For the multi-host recipes, the launch setup in Serve across several TPU hosts.
- Optional:
code/ch18_vllm/launch_profiles.py(source), which holds the Qwen3.5-397B and Qwen3-Coder-30B recipes as profiles.
Steps¶
1. Pick the recipe¶
| Model checkpoint | Slice | Layout | Quantization and KV | CI config |
|---|---|---|---|---|
Qwen/Qwen3.5-397B-A17B-FP8 |
v7x-8 (1 host) |
TP=1, DP=8 + EP |
fp8 weights, fp8 KV |
qwen3.5-397b-fp8-tp1-dp8-ep.sh |
Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8 |
v7x-8 |
TP=8, DP=1 + EP |
fp8 weights, fp8 KV |
qwen3-coder-480b-fp8-tp8-ep.sh |
Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 |
v7x-8 |
TP=8, DP=1 + EP |
fp8 weights, fp8 KV |
qwen3-coder-30b-fp8-tp8-ep.sh |
Qwen/Qwen3.5-35B-A3B-FP8 |
v7x-8 |
TP=8, DP=1 + EP |
fp8 weights, fp8 KV |
qwen3.5-35b-fp8-tp8-ep.sh |
RedHatAI/gemma-4-31B-it-FP8-Dynamic |
v7x-8 |
TP=2, DP=4 |
compressed-tensors FP8 |
gemma-4-31b-fp8-dp4-tp2-multimodal.sh |
deepseek-ai/DeepSeek-V4-Flash |
v7x-8 |
TP=1, DP=8 + EP |
deepseek_v4_fp8 (W4A8 MoE), fp8_e4m3 KV |
deepseek-v4-flash-dp8-ep.sh |
zai-org/GLM-5.2-FP8 |
v7x-16 (2 hosts) |
TP=1, DP=16 + EP |
fp8 weights, fp8 KV |
glm-5.2-fp8-dp16-ep.sh |
deepseek-ai/DeepSeek-V4-Pro-0813 |
v7x-16 (2 hosts) |
TP=1, DP=16 + EP |
deepseek_v4_fp8 (W4A8 MoE), fp8_e4m3 KV |
deepseek-v4-pro-dp16-ep.sh |
moonshotai/Kimi-K3 |
v7x-32 (4 hosts) |
TP=32, DP=1 + EP |
compressed-tensors FP8, fp8 KV |
kimi-k3-tp32-ep.sh |
The v7x recipes page gives commands for the single-host Qwen3.5-397B, Qwen3-Coder and DeepSeek-V4-Flash rows and for the three multi-host rows. For Qwen3.5-35B-A3B-FP8 and gemma-4-31B, read the CI config file named in the table in the vLLM-TorchTPU repository.
Check: \(DP \times TP\) equals the slice's devices: 8 per host.
2. Start the recipe¶
Export the recipe's environment variables in the shell that runs vllm serve, then run its command. For the multi-host recipes, run it on every host with the multi-host flags from Serve across several TPU hosts (mode B for the DP=16 recipes, mode A for Kimi-K3's TP=32).
Check: the server logs Application startup complete. The single-host recipes with --max-num-batched-tokens 1024 compile 7 token sizes, those with 8192 compile 10; Kimi-K3 compiles only the 3 sizes it lists in compile_sizes.
3. Verify and benchmark¶
python code/ch18_vllm/client.py smoke --model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8
python code/ch18_vllm/launch_profiles.py --bench v7x-8-qwen3-coder-30b-guard --input-len 1024 --output-len 1024 --concurrency 64
The second command prints the benchmarking guide's vllm bench serve client for the model. Check: a coherent reply, then a benchmark JSON to compare against (Benchmark vLLM-TorchTPU). The recipes turn prefix caching off (--no-enable-prefix-caching) because they measure random prompts; turn it back on for multi-turn or agent traffic.
Single-host recipes (v7x-8, 8 devices)¶
Qwen3.5-397B-A17B-FP8 (TP=1, DP=8 + EP)¶
The reference throughput recipe on one v7x host. Builder profile: v7x-8-qwen3.5-397b-dp8-ep.
export USE_MOE_SPARSE_CORE=1
export ONEHOT_MOE_PERMUTE_THRESHOLD=32768
vllm serve Qwen/Qwen3.5-397B-A17B-FP8 \
--tensor-parallel-size 1 \
--data-parallel-size 8 \
--enable-expert-parallel \
--quantization fp8 \
--kv-cache-dtype fp8 \
--attention-backend CUSTOM \
--max-model-len 10240 \
--max-num-batched-tokens 1024 \
--max-num-seqs 64 \
--gpu-memory-utilization 0.92 \
--block-size 256 \
--async-scheduling \
--no-enable-prefix-caching \
--language-model-only \
--limit-mm-per-prompt '{"image":0,"video":0}' \
--default-chat-template-kwargs '{"enable_thinking":false}' \
--port 8000
For lower per-request latency at small concurrency, the v7x recipes page offers --tensor-parallel-size 2 --data-parallel-size 4 (qwen3.5-397b-fp8-tp2-dp4-ep.sh) or --tensor-parallel-size 8 --data-parallel-size 1 (qwen3.5-397b-fp8-tp8-dp1-ep.sh).
Qwen3-Coder-480B-A35B-Instruct-FP8 (TP=8 + EP)¶
Validated nightly.
vllm serve Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8 \
--tensor-parallel-size 8 \
--data-parallel-size 1 \
--enable-expert-parallel \
--quantization fp8 \
--kv-cache-dtype fp8 \
--attention-backend CUSTOM \
--max-model-len 16384 \
--max-num-batched-tokens 8192 \
--max-num-seqs 512 \
--gpu-memory-utilization 0.95 \
--async-scheduling \
--no-enable-prefix-caching \
--port 8000
Qwen3-Coder-30B-A3B-Instruct-FP8 (TP=8 + EP)¶
The PR-time performance guard. Builder profile: v7x-8-qwen3-coder-30b-guard.
vllm serve Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 \
--tensor-parallel-size 8 \
--enable-expert-parallel \
--quantization fp8 \
--kv-cache-dtype fp8 \
--attention-backend CUSTOM \
--max-model-len 16384 \
--max-num-batched-tokens 8192 \
--max-num-seqs 512 \
--gpu-memory-utilization 0.95 \
--async-scheduling \
--no-enable-prefix-caching \
--port 8000
DeepSeek-V4-Flash (TP=1, DP=8 + EP)¶
Validated nightly, with W4A8 MoE requantization at load time.
export MOE_REQUANTIZE_WEIGHT_DTYPE=fp4
export MOE_REQUANTIZE_BLOCK_SIZE=512
export TPU_ROPE_CACHE_ROW_MAJOR=1
export TPU_MOE_HASH_TABLE_ROW_MAJOR=1
vllm serve deepseek-ai/DeepSeek-V4-Flash \
--tensor-parallel-size 1 \
--data-parallel-size 8 \
--enable-expert-parallel \
--quantization deepseek_v4_fp8 \
--kv-cache-dtype fp8_e4m3 \
--trust-remote-code \
--max-model-len 9216 \
--max-num-batched-tokens 1024 \
--max-num-seqs 256 \
--no-enable-prefix-caching \
--gpu-memory-utilization 0.9 \
--async-scheduling \
--generation-config="vllm" \
--override-generation-config='{"do_sample": false, "temperature": 0.0, "model": "deepseek-ai/DeepSeek-V4-Flash"}' \
--port 8000
Benchmark client, 8k input and 1k output:
vllm bench serve \
--backend vllm \
--model deepseek-ai/DeepSeek-V4-Flash \
--dataset-name random \
--random-input-len 8192 \
--random-output-len 1024 \
--num-prompts 2048 \
--ignore-eos \
--skip-chat-template
Multi-host recipes (v7x-16, v7x-32)¶
On multi-host slices without large local disks, stream checkpoints from Cloud Storage with --load-format runai_streamer and pass --enable-ep-weight-filter so each rank downloads only its own MoE expert shard.
DeepSeek-V4-Pro-0813 on v7x-16 (2 hosts, TP=1, DP=16 + EP)¶
Validated nightly on a 2x2x2 topology (16 devices) with fused EP MoE v2 and W4A8 MoE requantization.
export MOE_REQUANTIZE_WEIGHT_DTYPE=fp4
export MOE_REQUANTIZE_BLOCK_SIZE=512
export TPU_ROPE_CACHE_ROW_MAJOR=1
export TPU_MOE_HASH_TABLE_ROW_MAJOR=1
export USE_MOE_FUSED_EP_KERNEL=1
export MOE_FUSED_EP_ENABLE_W4A8=1
export MOE_FUSED_EP_V2_HEIGHT_RUNGS_OVERRIDE=2
export TPU_MOE_SKIP_PADDED_TOKENS=1
export RAGGED_GATHER_REDUCE_VERSION=v3
export LIBTPU_INIT_ARGS="--xla_tpu_use_minor_sharding_for_major_trivial_input=true --xla_tpu_enable_sparse_core_collective_offload_reduce_scatter=false --xla_tpu_ars_combiner_threshold_in_bytes=0 --xla_tpu_enable_async_collective_merger=false --xla_enable_async_all_gather=true --xla_tpu_enable_sparse_core_collective_offload_all_gather=true --xla_tpu_sparse_core_all_gather_offload_min_size_in_bytes=262144"
vllm serve deepseek-ai/DeepSeek-V4-Pro-0813 \
--tensor-parallel-size 1 \
--data-parallel-size 16 \
--enable-expert-parallel \
--enable-ep-weight-filter \
--safetensors-load-strategy prefetch \
--quantization deepseek_v4_fp8 \
--kv-cache-dtype fp8_e4m3 \
--trust-remote-code \
--max-model-len 9216 \
--max-num-batched-tokens 1024 \
--max-num-seqs 256 \
--no-enable-prefix-caching \
--gpu-memory-utilization 0.90 \
--async-scheduling \
--generation-config="vllm" \
--override-generation-config='{"do_sample": false, "temperature": 0.0, "model": "deepseek-ai/DeepSeek-V4-Pro-0813"}' \
--port 8000
With the Ray backend (TPU_MULTIHOST_BACKEND=ray), variables without the VLLM_ prefix are not forwarded to the Ray DP engine actors unless you list them:
export VLLM_RAY_EXTRA_ENV_VARS_TO_COPY="MOE_REQUANTIZE_WEIGHT_DTYPE,MOE_REQUANTIZE_BLOCK_SIZE,TPU_ROPE_CACHE_ROW_MAJOR,TPU_MOE_HASH_TABLE_ROW_MAJOR,USE_MOE_FUSED_EP_KERNEL,MOE_FUSED_EP_ENABLE_W4A8,MOE_FUSED_EP_V2_HEIGHT_RUNGS_OVERRIDE,TPU_MOE_SKIP_PADDED_TOKENS,RAGGED_GATHER_REDUCE_VERSION,LIBTPU_INIT_ARGS"
When streaming the 805 GiB checkpoint from Cloud Storage with --load-format runai_streamer, also pass --model-loader-extra-config '{"memory_limit":4294967296,"concurrency":8}' to cap each rank's host streamer buffers.
Benchmark client, 8k input and 1k output:
vllm bench serve \
--backend vllm \
--model deepseek-ai/DeepSeek-V4-Pro-0813 \
--tokenizer deepseek-ai/DeepSeek-V4-Pro-0813 \
--trust-remote-code \
--dataset-name random \
--random-input-len 8192 \
--random-output-len 1024 \
--num-prompts 2048 \
--random-range-ratio 0 \
--ignore-eos \
--max-concurrency 1024
GLM-5.2-FP8 on v7x-16 (2 hosts, TP=1, DP=16 + EP)¶
Validated nightly.
vllm serve zai-org/GLM-5.2-FP8 \
--tensor-parallel-size 1 \
--data-parallel-size 16 \
--enable-expert-parallel \
--enable-ep-weight-filter \
--safetensors-load-strategy prefetch \
--kv-cache-dtype fp8 \
--max-model-len 9216 \
--max-num-batched-tokens 1024 \
--max-num-seqs 64 \
--gpu-memory-utilization 0.90 \
--tool-call-parser glm47 \
--enable-auto-tool-choice \
--reasoning-parser glm45 \
--port 8000
Kimi-K3 on v7x-32 (4 hosts, TP=32 + EP)¶
Validated nightly. The recipe replaces the token ladder with three compiled sizes.
vllm serve moonshotai/Kimi-K3 \
--tensor-parallel-size 32 \
--enable-expert-parallel \
--enable-ep-weight-filter \
--trust-remote-code \
--language-model-only \
--limit-mm-per-prompt '{"image":0,"video":0}' \
--model-loader-extra-config '{"memory_limit":17179869184}' \
--kv-cache-dtype fp8 \
--block-size 256 \
--max-model-len 10240 \
--max-num-batched-tokens 8192 \
--max-num-seqs 8 \
--gpu-memory-utilization 0.82 \
--compilation-config '{"compile_sizes":[1,8,8192]}' \
--async-scheduling \
--port 8000
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
| Layout refused, or half the host idle | Counted chips instead of devices | 8 devices per v7x host: TP=8, DP=8, TP=1 or DP=4, TP=2 |
| A step after warmup fails or stalls | A step larger than the largest compiled size | Keep --max-num-batched-tokens within the largest compile_sizes entry, as Kimi-K3 does |
| Ray DP engine actors run without the recipe's MoE and kernel settings | Variables without the VLLM_ prefix are not forwarded to Ray actors |
VLLM_RAY_EXTRA_ENV_VARS_TO_COPY as above |
| Host memory exhausted while streaming weights | Streamer buffers per rank | --model-loader-extra-config with memory_limit (and concurrency), as in the recipes |
| Boot disk too small for the checkpoint on a multi-host slice | Full checkpoint downloaded on each host | --load-format runai_streamer with --enable-ep-weight-filter |
| Throughput well below the CI numbers | A different experiment: prefix caching, concurrency or a missing environment variable | Match every flag and variable of the recipe, including --no-enable-prefix-caching |
| Startup takes the better part of an hour | Large models compile many programs per rank | Persist the caches and use peer replay: Keep compiled programs across restarts |