Skip to content

Serving flags

The same knob in both engines

Knob vLLM-TorchTPU (vllm serve, port 8000) SGLang-TorchTPU (python -m sglang.launch_server, port 30000)
Longest sequence --max-model-len --context-length
Tokens per step / prefill chunk --max-num-batched-tokens (top of the compiled ladder) --chunked-prefill-size
Decode batch --max-num-seqs --max-running-requests
HBM share for weights plus KV --gpu-memory-utilization (0.82 to 0.95 in recipes) --mem-fraction-static (default 0.40; 0.6, 0.75 in recipes)
KV dtype --kv-cache-dtype fp8 (always on v6e) --kv-cache-dtype fp8_e4m3 (default for RPA)
KV page --block-size (256 in recipes) --page-size (default 64; at least 256 for batched RPA)
Attention default RPA v3; --attention-backend CUSTOM in recipes --attention-backend pallas_tpu_rpa_v3 (default) or pallas_tpu_rpa_batched
Compiled shapes sizes double from 16 to --max-num-batched-tokens; or --compilation-config '{"compile_sizes": [...]}' --enable-torch-compile with --tpu-compile-tokens (prefill) and --tpu-compile-bs (decode)
Tensor parallel --tensor-parallel-size (logical devices: 2 per v7x chip) --tp-size (TensorCores: 8 on a 4-chip TPU7x host)
Data and expert parallel --data-parallel-size, --enable-expert-parallel --attn-dp-size, --ep-size
Prefix cache --enable-prefix-caching / --no-enable-prefix-caching on; --disable-radix-cache turns it off
Speculative decoding --speculative-config '{"method": "eagle3", ...}' --speculative-algorithm EAGLE3 (also NEXTN, DFLASH, DSPARK)
Disaggregation --kv-transfer-config with TPURaidenConnector --disaggregation-mode prefill or decode, --disaggregation-transfer-backend raiden

Environment

Variable Engine Effect
VLLM_XLA_CACHE_PATH, VLLM_CACHE_ROOT vLLM XLA cache and vLLM's Python artifacts; persist both
TORCH_TPU_TIER3_COMPILATION_CACHE_ROOT both persistent TorchTPU executables; restarts load instead of compile
TPU_PARALLEL_PRECOMPILE=1, TPU_PRECOMPILE_PEER_REPLAY=1 vLLM parallel warmup; one rank per host compiles each size
VLLM_XLA_CHECK_RECOMPILATION=1 vLLM log graphs compiled after warmup (CI only)
SGLANG_PLATFORM=tpu_oot or tpu SGLang which platform class loads
SGLANG_TPU_CHECK_RECOMPILATION=1 SGLang log programs compiled after warmup; fail_on_recompile is set after warmup anyway
SGLANG_TPU_USE_SEQ_ALONG_LANE_KV=1 SGLang tokens on the lane axis with batched RPA, page at least 256

Rules

  1. Count devices first. vLLM uses DP × TP × PP × PCP logical devices: 8 per v7x host (two per chip), one per v6e chip.
  2. Do the KV arithmetic before starting. Sequences at full length = (HBM × utilization − weights − working memory) / (2 × layers × KV heads per device × head dim × bytes × max length). Below --max-num-seqs means preemption under load.
  3. Every compiled size is a warmup compile and resident HBM. A step just past a size pays up to half its work in padding. Warm every size before you take traffic or time anything.
  4. Persist the caches on a disk that survives restarts; a second start that is not faster means the server does not find them.
  5. TP for dense models; DP plus EP for large MoE (for example DP=8, TP=1 with EP on one v7x host).
  6. Benchmark like the recipe: same prefix-cache setting, --ignore-eos, fixed input and output lengths, closed-loop concurrency, recompilation checks off.
  7. Gate a rollout on a smoke request, a TPOT above the bandwidth floor you predicted, and greedy parity with a trusted build.
Symptom Check
startup takes many minutes every time cache roots not persisted; too many compiled sizes
a step takes seconds after warmup shape never warmed: recompilation check in CI
preemption or aborts under load KV budget: lower length or batch, fp8 KV, more devices
TPOT spikes when long prompts arrive smaller prefill chunk; PCP; disaggregate prefill and decode
layout refused, or half the slice idle device count in logical devices, not chips