Optimizing GLM-4.6/GLM-4.5 Throughput on NVIDIA H200 GPUs
Conclusion
Recommended configuration for optimizing throughput of GLM-4.6 on H200 GPUs:
Serving Command
python3 -m sglang.launch_server --model zai-org/GLM-4.6-FP8 --tp 4 --tool-call-parser glm --reasoning-parser glm45
Comparison of benchmark results before and after optimization:
| Benchmark Case | baseline (vLLM without any optimizations) | Optimized (scaled to same GPU count) |
|---|---|---|
| ShareGPT | Total TPS: 6030.90 Mean TPOT(ms): 197.85 |
Total TPS: 7081.34x2 (+134.8%) Mean TPOT(ms): 256.43 |
| Short Prompt | Total TPS: 9497.19 Mean TPOT(ms): 351.26 |
Total TPS: 21234.81x2 (+347.2%) Mean TPOT(ms): 800.25 |
| Medium Prompt | Total TPS: 17214.85 Mean TPOT(ms): 269.75 |
Total TPS: 17363.22x2 (+101.7%) Mean TPOT(ms): 144.82 |
| Long Prompt | Total TPS: 16714.91 Mean TPOT(ms): 205.69 |
Total TPS: 14979.90x2 (+79.2%) Mean TPOT(ms): 97.74 |
| Very Long Prompt | Total TPS: 15066.09 Mean TPOT(ms): 479.17 |
Total TPS: 12223.53x2 (+62.3%) Mean TPOT(ms): 191.61 |
Note
- Our benchmark tests do not cover all possible optimization combinations. For example, we select the inference engine that performs best under its default configuration as the starting point for further tuning. This pruning approach yields a local optimum, which may not be the global optimum.
- There are other optimization methods that depend on specific user scenarios, including max batch size, schedule configuration, extended KV cache, CUDA graph, etc. The conclusions in this document can serve as a starting point for more targeted optimizations.
- The tests are conducted on specific hardware and software setups. Advances in the inference engine may lead to new conclusions.
- Although using quantization may impact accuracy. FP8 quantization can achieves less than 1% accuracy drop for most models. See the evaluation results for more details. Therefore, it is highly recommended to use FP8 quantization for high-throughput serving scenarios.
If there are any missing points or updates reflecting new changes, please let us know.
Optimization Objective
Achieve high throughput under high-concurrency request scenarios.
Experimental Setup
Model
zai-org/GLM-4.6
Hardware
NVIDIA H200 GPUs
Engine Version
- vLLM: v0.11.0
- SGLang: v0.5.3
- TensorRT-LLM: v1.0.0
Benchmark Dataset
- ShareGPT
- Random dataset with varying sequence lengths:
- Very long prompt: 32000 input tokens, 100 output tokens
- Long prompt: 4000 input tokens, 200 output tokens
- Medium prompt: 2000 input tokens, 100 output tokens
- Short prompt: 128 input tokens, 4 output tokens
Benchmark Script
We use the vLLM bench CLI tool to benchmark the model performance. The following command is used to run the benchmark:
# Prepare the ShareGPT dataset
wget https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
# Benchmark on ShareGPT dataset
vllm bench serve --model zai-org/GLM-4.6 --backend openai-chat --endpoint /v1/chat/completions --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json --num-prompts 1000
# Benchmark on random dataset (fixed seed for reproducibility)
vllm bench serve --model zai-org/GLM-4.6 --backend openai-chat --endpoint /v1/chat/completions --dataset-name random --random-input-len 4000 --random-output-len 200 --num-prompts 500 --seed 42
Experiment Results
1. Choosing the Inference Engine
vLLM
Serving script
vllm serve zai-org/GLM-4.6 -tp 8
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 68.67
Total input tokens: 214465
Total generated tokens: 199702
Request throughput (req/s): 14.56
Output token throughput (tok/s): 2907.97
Peak output token throughput (tok/s): 7158.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 6030.90
---------------Time to First Token----------------
Mean TTFT (ms): 15339.53
Median TTFT (ms): 15377.50
P99 TTFT (ms): 21078.26
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 197.85
Median TPOT (ms): 145.75
P99 TPOT (ms): 411.50
---------------Inter-token Latency----------------
Mean ITL (ms): 109.47
Median ITL (ms): 68.98
P99 ITL (ms): 413.20
==================================================
SGLang
Serving script
python3 -m sglang.launch_server --model-path zai-org/GLM-4.6 --host 0.0.0.0 --port 8000 --tp-size 8
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 59.37
Total input tokens: 214465
Total generated tokens: 199904
Request throughput (req/s): 16.84
Output token throughput (tok/s): 3366.90
Peak output token throughput (tok/s): 7570.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 6979.05
---------------Time to First Token----------------
Mean TTFT (ms): 6044.62
Median TTFT (ms): 5851.20
P99 TTFT (ms): 10817.86
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 282.87
Median TPOT (ms): 148.97
P99 TPOT (ms): 1610.70
---------------Inter-token Latency----------------
Mean ITL (ms): 113.29
Median ITL (ms): 64.03
P99 ITL (ms): 369.42
==================================================
Result: SGLang(6979.05 tok/s) > vLLM (6030.90 tok/s) > TensorRT-LLM (Not supported)
2. Quantization in SGLang
FP8
Serving script
python3 -m sglang.launch_server --model-path zai-org/GLM-4.6-FP8 --host 0.0.0.0 --port 8000 --tp-size 8
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 52.72
Total input tokens: 214465
Total generated tokens: 199904
Request throughput (req/s): 18.97
Output token throughput (tok/s): 3791.55
Peak output token throughput (tok/s): 8987.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 7859.29
---------------Time to First Token----------------
Mean TTFT (ms): 5085.56
Median TTFT (ms): 4847.02
P99 TTFT (ms): 10068.82
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 271.63
Median TPOT (ms): 144.47
P99 TPOT (ms): 1542.73
---------------Inter-token Latency----------------
Mean ITL (ms): 105.34
Median ITL (ms): 52.76
P99 ITL (ms): 321.65
==================================================
3. Parallelism in SGLang
TP8
Serving script
python3 -m sglang.launch_server --model-path zai-org/GLM-4.6-FP8 --host 0.0.0.0 --port 8000 --tp-size 8
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 52.72
Total input tokens: 214465
Total generated tokens: 199904
Request throughput (req/s): 18.97
Output token throughput (tok/s): 3791.55
Peak output token throughput (tok/s): 8987.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 7859.29
---------------Time to First Token----------------
Mean TTFT (ms): 5085.56
Median TTFT (ms): 4847.02
P99 TTFT (ms): 10068.82
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 271.63
Median TPOT (ms): 144.47
P99 TPOT (ms): 1542.73
---------------Inter-token Latency----------------
Mean ITL (ms): 105.34
Median ITL (ms): 52.76
P99 ITL (ms): 321.65
==================================================
TP4
Serving script
python3 -m sglang.launch_server --model-path zai-org/GLM-4.6-FP8 --host 0.0.0.0 --port 8000 --tp-size 4
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 58.52
Total input tokens: 214465
Total generated tokens: 199904
Request throughput (req/s): 17.09
Output token throughput (tok/s): 3416.25
Peak output token throughput (tok/s): 7602.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 7081.34
---------------Time to First Token----------------
Mean TTFT (ms): 5786.78
Median TTFT (ms): 5769.81
P99 TTFT (ms): 10134.80
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 256.43
Median TPOT (ms): 144.11
P99 TPOT (ms): 1451.02
---------------Inter-token Latency----------------
Mean ITL (ms): 109.76
Median ITL (ms): 62.64
P99 ITL (ms): 330.68
==================================================
TP4+EP4
Serving script
python3 -m sglang.launch_server --model-path zai-org/GLM-4.6-FP8 --host 0.0.0.0 --port 8000 --tp-size 4 --ep-size 4
Benchmark result
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 62.06
Total input tokens: 214465
Total generated tokens: 199904
Request throughput (req/s): 16.11
Output token throughput (tok/s): 3221.11
Peak output token throughput (tok/s): 8209.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 6676.84
---------------Time to First Token----------------
Mean TTFT (ms): 6632.87
Median TTFT (ms): 6433.53
P99 TTFT (ms): 11461.66
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 284.20
Median TPOT (ms): 157.89
P99 TPOT (ms): 1629.92
---------------Inter-token Latency----------------
Mean ITL (ms): 117.77
Median ITL (ms): 61.25
P99 ITL (ms): 406.32
==================================================
Summary of Optimization Options
| Optimization Option | Throughput Improvement |
|---|---|
| Engine Selection | +15.7% |
| Quantization | +12.6% |
| Parallelism | +80.2% |
Other Benchmark Cases
We further benchmarked the optimized configuration to evaluate its generalization under various workloads.
Baseline serving script
vllm serve zai-org/GLM-4.6 -tp 8
Baseline benchmark results
# random 32K input
============ Serving Benchmark Result ============
Successful requests: 100
Benchmark duration (s): 213.02
Total input tokens: 3200000
Total generated tokens: 9406
Request throughput (req/s): 0.47
Output token throughput (tok/s): 44.16
Peak output token throughput (tok/s): 489.00
Peak concurrent requests: 100.00
Total Token throughput (tok/s): 15066.09
---------------Time to First Token----------------
Mean TTFT (ms): 105089.84
Median TTFT (ms): 104737.57
P99 TTFT (ms): 208225.57
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 479.17
Median TPOT (ms): 541.92
P99 TPOT (ms): 544.17
---------------Inter-token Latency----------------
Mean ITL (ms): 474.58
Median ITL (ms): 529.63
P99 ITL (ms): 637.86
==================================================
# random 4K input
============ Serving Benchmark Result ============
Successful requests: 500
Benchmark duration (s): 125.61
Total input tokens: 1999787
Total generated tokens: 99801
Request throughput (req/s): 3.98
Output token throughput (tok/s): 794.52
Peak output token throughput (tok/s): 3810.00
Peak concurrent requests: 500.00
Total Token throughput (tok/s): 16714.91
---------------Time to First Token----------------
Mean TTFT (ms): 57737.75
Median TTFT (ms): 59379.10
P99 TTFT (ms): 116713.01
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 205.69
Median TPOT (ms): 241.12
P99 TPOT (ms): 260.89
---------------Inter-token Latency----------------
Mean ITL (ms): 205.05
Median ITL (ms): 59.67
P99 ITL (ms): 424.92
==================================================
# random 2K input
============ Serving Benchmark Result ============
Successful requests: 500
Benchmark duration (s): 60.96
Total input tokens: 999429
Total generated tokens: 50000
Request throughput (req/s): 8.20
Output token throughput (tok/s): 820.20
Peak output token throughput (tok/s): 5415.00
Peak concurrent requests: 500.00
Total Token throughput (tok/s): 17214.85
---------------Time to First Token----------------
Mean TTFT (ms): 30215.66
Median TTFT (ms): 29924.42
P99 TTFT (ms): 55334.09
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 269.75
Median TPOT (ms): 283.63
P99 TPOT (ms): 407.32
---------------Inter-token Latency----------------
Mean ITL (ms): 267.55
Median ITL (ms): 402.36
P99 ITL (ms): 417.66
==================================================
# random 128 input
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 13.89
Total input tokens: 127881
Total generated tokens: 4000
Request throughput (req/s): 72.01
Output token throughput (tok/s): 288.05
Peak output token throughput (tok/s): 2063.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 9497.19
---------------Time to First Token----------------
Mean TTFT (ms): 11467.27
Median TTFT (ms): 10707.53
P99 TTFT (ms): 13722.66
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 351.26
Median TPOT (ms): 397.14
P99 TPOT (ms): 409.34
---------------Inter-token Latency----------------
Mean ITL (ms): 263.45
Median ITL (ms): 389.46
P99 ITL (ms): 443.88
==================================================
# ShareGPT batch size 4
============ Serving Benchmark Result ============
Successful requests: 100
Maximum request concurrency: 4
Benchmark duration (s): 103.11
Total input tokens: 22992
Total generated tokens: 21794
Request throughput (req/s): 0.97
Output token throughput (tok/s): 211.38
Peak output token throughput (tok/s): 232.00
Peak concurrent requests: 9.00
Total Token throughput (tok/s): 434.37
---------------Time to First Token----------------
Mean TTFT (ms): 70.16
Median TTFT (ms): 62.63
P99 TTFT (ms): 148.47
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 18.11
Median TPOT (ms): 17.80
P99 TPOT (ms): 23.44
---------------Inter-token Latency----------------
Mean ITL (ms): 17.85
Median ITL (ms): 17.55
P99 ITL (ms): 26.92
==================================================
Optimized serving script
python3 -m sglang.launch_server --model zai-org/GLM-4.6-FP8 --tp 4 \
--tool-call-parser glm --reasoning-parser glm45
Optimized benchmark results
# random 32K input
============ Serving Benchmark Result ============
Successful requests: 100
Benchmark duration (s): 262.58
Total input tokens: 3200000
Total generated tokens: 9703
Request throughput (req/s): 0.38
Output token throughput (tok/s): 36.95
Peak output token throughput (tok/s): 390.00
Peak concurrent requests: 100.00
Total Token throughput (tok/s): 12223.53
---------------Time to First Token----------------
Mean TTFT (ms): 129699.21
Median TTFT (ms): 129839.73
P99 TTFT (ms): 257123.03
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 191.61
Median TPOT (ms): 181.54
P99 TPOT (ms): 350.40
---------------Inter-token Latency----------------
Mean ITL (ms): 189.68
Median ITL (ms): 40.53
P99 ITL (ms): 71.16
==================================================
# random 4K input
============ Serving Benchmark Result ============
Successful requests: 500
Benchmark duration (s): 140.16
Total input tokens: 1999787
Total generated tokens: 99801
Request throughput (req/s): 3.57
Output token throughput (tok/s): 712.05
Peak output token throughput (tok/s): 2688.00
Peak concurrent requests: 500.00
Total Token throughput (tok/s): 14979.90
---------------Time to First Token----------------
Mean TTFT (ms): 65196.25
Median TTFT (ms): 67840.59
P99 TTFT (ms): 131861.02
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 97.74
Median TPOT (ms): 94.74
P99 TPOT (ms): 149.34
---------------Inter-token Latency----------------
Mean ITL (ms): 97.55
Median ITL (ms): 47.60
P99 ITL (ms): 314.57
==================================================
# random 2K input
============ Serving Benchmark Result ============
Successful requests: 500
Benchmark duration (s): 60.44
Total input tokens: 999429
Total generated tokens: 50000
Request throughput (req/s): 8.27
Output token throughput (tok/s): 827.27
Peak output token throughput (tok/s): 4460.00
Peak concurrent requests: 500.00
Total Token throughput (tok/s): 17363.22
---------------Time to First Token----------------
Mean TTFT (ms): 27600.49
Median TTFT (ms): 29627.26
P99 TTFT (ms): 56644.81
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 144.82
Median TPOT (ms): 142.76
P99 TPOT (ms): 250.18
---------------Inter-token Latency----------------
Mean ITL (ms): 143.46
Median ITL (ms): 57.80
P99 ITL (ms): 145.06
==================================================
# random 128 input
============ Serving Benchmark Result ============
Successful requests: 1000
Benchmark duration (s): 6.21
Total input tokens: 127881
Total generated tokens: 4000
Request throughput (req/s): 161.01
Output token throughput (tok/s): 644.06
Peak output token throughput (tok/s): 1924.00
Peak concurrent requests: 1000.00
Total Token throughput (tok/s): 21234.81
---------------Time to First Token----------------
Mean TTFT (ms): 3551.50
Median TTFT (ms): 3313.50
P99 TTFT (ms): 5528.41
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 800.25
Median TPOT (ms): 936.39
P99 TPOT (ms): 1413.56
---------------Inter-token Latency----------------
Mean ITL (ms): 600.19
Median ITL (ms): 0.01
P99 ITL (ms): 3985.12
==================================================
