# Optimizing Qwen3-32B Throughput on NVIDIA H100 GPUs ## Conclusion ![qwen3-32b-h100](../../assets/performance-lab/qwen3-32b-h100.png) Recommended configuration for optimizing throughput of Qwen3-32B on H100 GPUs: ???+ tip "Serving Command" ```bash trtllm-serve Qwen/Qwen3-32B-FP8 --max_seq_len=40960 --enable_chunked_prefill ``` Comparison of benchmark results before and after optimization: | Benchmark Case | baseline (vLLM without any optimizations) | Optimized | |----------|-------------------------------------------|-----------| | **ShareGPT** | Total TPS: 2352.82
Mean TPOT(ms): 88.09 | Total TPS: 4284.68 (+82.1%)
Mean TPOT(ms): 158.64 | | **Short Prompt** | Total TPS: 4005.62
Mean TPOT(ms): 1169.72 | Total TPS: 6826.33 (+70.4%)
Mean TPOT(ms): 890.11 | | **Medium Prompt** | Total TPS: 3195.30
Mean TPOT(ms): 86.62 | Total TPS: 5901.95 (+84.7%)
Mean TPOT(ms): 223.40 | | **Long Prompt** | Total TPS: 2148.69
Mean TPOT(ms): 66.61 | Total TPS: 4929.16 (+129.4%)
Mean TPOT(ms): 138.75 | | **Very Long Prompt** | Total TPS: 2771.81
Mean TPOT(ms): 43.42 | Total TPS: 4068.16 (+10.7%)
Mean TPOT(ms): 286.97 | !!! note 1. 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. 2. There are other optimization methods that depend on specific user scenarios, including max batch size, schedule configuration, extended KV cache, CUDA graph, Torch Compile, etc. The conclusions in this document can serve as a starting point for more targeted optimizations. 3. The tests are conducted on specific hardware and software setups. Advances in the inference engine may lead to new conclusions. 4. Although using quantization may impact accuracy. FP8 quantization can achieves less than 1% accuracy drop for most models. See the [evaluation results](https://github.com/Tencent/AngelSlim/blob/main/README_en.md#-benchmark) 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](https://github.com/gpustack/gpustack/issues/new/choose). ## Optimization Objective Achieve high throughput under high-concurrency request scenarios. ## Experimental Setup ### Model Qwen3-32B ### Hardware A single NVIDIA H100 SXM GPU. ### Engine Version - vLLM: v0.11.0 - SGLang: v0.5.5.post1 - TensorRT-LLM: v1.2.0rc1 ### Benchmark Dataset 1. ShareGPT 2. 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: ```bash # 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 Qwen/Qwen3-32B --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 Qwen/Qwen3-32B --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 ??? info "Serving script" ```bash vllm serve Qwen/Qwen3-32B ``` ??? info "Benchmark result" ``` ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 178.01 Total input tokens: 217393 Total generated tokens: 201422 Request throughput (req/s): 5.62 Output token throughput (tok/s): 1131.55 Peak output token throughput (tok/s): 2360.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 2352.82 ---------------Time to First Token---------------- Mean TTFT (ms): 78118.74 Median TTFT (ms): 77291.46 P99 TTFT (ms): 153161.51 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 88.09 Median TPOT (ms): 70.72 P99 TPOT (ms): 378.18 ---------------Inter-token Latency---------------- Mean ITL (ms): 69.76 Median ITL (ms): 50.20 P99 ITL (ms): 277.93 ================================================== ``` SGLang ??? info "Serving script" ```bash python3 -m sglang.launch_server --model-path Qwen/Qwen3-32B ``` ??? info "Benchmark result" ``` ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 247.94 Total input tokens: 217393 Total generated tokens: 201826 Request throughput (req/s): 4.03 Output token throughput (tok/s): 814.03 Peak output token throughput (tok/s): 1329.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 1690.84 ---------------Time to First Token---------------- Mean TTFT (ms): 115690.30 Median TTFT (ms): 117738.49 P99 TTFT (ms): 230503.32 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 57.86 Median TPOT (ms): 54.19 P99 TPOT (ms): 95.84 ---------------Inter-token Latency---------------- Mean ITL (ms): 56.25 Median ITL (ms): 43.94 P99 ITL (ms): 207.79 ================================================== ``` TensorRT-LLM ??? info "Serving script" ```bash trtllm-serve Qwen/Qwen3-32B ``` ??? info "Benchmark result" ``` ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 157.59 Total input tokens: 217393 Total generated tokens: 201723 Request throughput (req/s): 6.35 Output token throughput (tok/s): 1280.04 Peak output token throughput (tok/s): 1958.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 2659.50 ---------------Time to First Token---------------- Mean TTFT (ms): 65281.52 Median TTFT (ms): 65325.76 P99 TTFT (ms): 133106.50 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 61.90 Median TPOT (ms): 59.59 P99 TPOT (ms): 121.97 ---------------Inter-token Latency---------------- Mean ITL (ms): 59.22 Median ITL (ms): 47.89 P99 ITL (ms): 214.01 ================================================== ``` Result: TensorRT-LLM (2659.50 tok/s) > vLLM (2352.82 tok/s) > SGLang (1690.84 tok/s) ### 2. Quantization in TensorRT-LLM FP8 ??? info "Serving script" ```bash python3 -m sglang.launch_server --model-path Qwen/Qwen3-32B-FP8 ``` ??? info "Benchmark result" ``` ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 104.55 Total input tokens: 217393 Total generated tokens: 201376 Request throughput (req/s): 9.56 Output token throughput (tok/s): 1926.06 Peak output token throughput (tok/s): 4391.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 4005.32 ---------------Time to First Token---------------- Mean TTFT (ms): 35510.55 Median TTFT (ms): 31577.26 P99 TTFT (ms): 79653.82 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 205.13 Median TPOT (ms): 119.96 P99 TPOT (ms): 1141.98 ---------------Inter-token Latency---------------- Mean ITL (ms): 118.32 Median ITL (ms): 86.53 P99 ITL (ms): 1195.28 ================================================== ``` ### 3. Enable Chunked Prefill in TensorRT-LLM ??? info "Serving script" ```bash trtllm-serve Qwen/Qwen3-32B-FP8 --max_seq_len=40960 --enable_chunked_prefill ``` ??? info "Benchmark result" ``` ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 97.74 Total input tokens: 217393 Total generated tokens: 201376 Request throughput (req/s): 10.23 Output token throughput (tok/s): 2060.40 Peak output token throughput (tok/s): 4371.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 4284.68 ---------------Time to First Token---------------- Mean TTFT (ms): 31208.75 Median TTFT (ms): 25003.73 P99 TTFT (ms): 72827.99 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 158.64 Median TPOT (ms): 115.67 P99 TPOT (ms): 993.03 ---------------Inter-token Latency---------------- Mean ITL (ms): 107.04 Median ITL (ms): 85.28 P99 ITL (ms): 569.95 ================================================== ``` ### Summary of Optimization Options | Optimization Option | Throughput Improvement | |-----------------------------|-------------------------------------| | Engine Selection | +13.0% | | Quantization | +50.6% | | Enable Chunked Prefill | +7.0% | ### Other Benchmark Cases We further benchmarked the optimized configuration to evaluate its generalization under various workloads. ??? info "Baseline serving script" ```bash vllm serve Qwen/Qwen3-32B ``` ??? info "Baseline benchmark results" ```bash # random 32K input ============ Serving Benchmark Result ============ Successful requests: 100 Benchmark duration (s): 1157.25 Total input tokens: 3200000 Total generated tokens: 7681 Request throughput (req/s): 0.09 Output token throughput (tok/s): 6.64 Peak output token throughput (tok/s): 24.00 Peak concurrent requests: 100.00 Total Token throughput (tok/s): 2771.81 ---------------Time to First Token---------------- Mean TTFT (ms): 585981.22 Median TTFT (ms): 582757.65 P99 TTFT (ms): 1144686.57 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 43.42 Median TPOT (ms): 43.36 P99 TPOT (ms): 44.34 ---------------Inter-token Latency---------------- Mean ITL (ms): 42.86 Median ITL (ms): 43.30 P99 ITL (ms): 46.54 ================================================== # random 4K input ============ Serving Benchmark Result ============ Successful requests: 500 Benchmark duration (s): 976.29 Total input tokens: 1997942 Total generated tokens: 99790 Request throughput (req/s): 0.51 Output token throughput (tok/s): 102.21 Peak output token throughput (tok/s): 186.00 Peak concurrent requests: 500.00 Total Token throughput (tok/s): 2148.69 ---------------Time to First Token---------------- Mean TTFT (ms): 482284.21 Median TTFT (ms): 483375.28 P99 TTFT (ms): 956141.26 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 66.61 Median TPOT (ms): 62.08 P99 TPOT (ms): 100.86 ---------------Inter-token Latency---------------- Mean ITL (ms): 66.29 Median ITL (ms): 43.38 P99 ITL (ms): 1395.23 ================================================== # random 2K input ============ Serving Benchmark Result ============ Successful requests: 500 Benchmark duration (s): 328.04 Total input tokens: 998175 Total generated tokens: 50000 Request throughput (req/s): 1.52 Output token throughput (tok/s): 152.42 Peak output token throughput (tok/s): 359.00 Peak concurrent requests: 500.00 Total Token throughput (tok/s): 3195.30 ---------------Time to First Token---------------- Mean TTFT (ms): 163909.40 Median TTFT (ms): 164148.38 P99 TTFT (ms): 322980.86 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 86.62 Median TPOT (ms): 84.24 P99 TPOT (ms): 131.41 ---------------Inter-token Latency---------------- Mean ITL (ms): 85.97 Median ITL (ms): 44.80 P99 ITL (ms): 1462.05 ================================================== # random 128 input ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 32.88 Total input tokens: 127698 Total generated tokens: 4000 Request throughput (req/s): 30.42 Output token throughput (tok/s): 121.66 Peak output token throughput (tok/s): 522.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 4005.62 ---------------Time to First Token---------------- Mean TTFT (ms): 21648.67 Median TTFT (ms): 21342.36 P99 TTFT (ms): 32678.31 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 1169.72 Median TPOT (ms): 1292.78 P99 TPOT (ms): 1417.05 ---------------Inter-token Latency---------------- Mean ITL (ms): 877.29 Median ITL (ms): 1141.11 P99 ITL (ms): 1435.80 ================================================== ``` ??? info "Optimized serving script" ```bash trtllm-serve Qwen/Qwen3-32B-FP8 --max_seq_len=40960 --enable_chunked_prefill ``` ??? info "Optimized benchmark results" ```bash # random 32K input ============ Serving Benchmark Result ============ Successful requests: 100 Benchmark duration (s): 788.52 Total input tokens: 3200000 Total generated tokens: 7832 Request throughput (req/s): 0.13 Output token throughput (tok/s): 9.93 Peak output token throughput (tok/s): 104.00 Peak concurrent requests: 100.00 Total Token throughput (tok/s): 4068.16 ---------------Time to First Token---------------- Mean TTFT (ms): 396294.90 Median TTFT (ms): 397717.15 P99 TTFT (ms): 778540.06 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 286.97 Median TPOT (ms): 255.80 P99 TPOT (ms): 581.09 ---------------Inter-token Latency---------------- Mean ITL (ms): 284.98 Median ITL (ms): 39.76 P99 ITL (ms): 2105.62 ================================================== # random 4K input ============ Serving Benchmark Result ============ Successful requests: 500 Benchmark duration (s): 425.60 Total input tokens: 1997942 Total generated tokens: 99888 Request throughput (req/s): 1.17 Output token throughput (tok/s): 234.70 Peak output token throughput (tok/s): 828.00 Peak concurrent requests: 500.00 Total Token throughput (tok/s): 4929.16 ---------------Time to First Token---------------- Mean TTFT (ms): 208082.20 Median TTFT (ms): 204136.20 P99 TTFT (ms): 415000.76 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 138.75 Median TPOT (ms): 141.52 P99 TPOT (ms): 151.74 ---------------Inter-token Latency---------------- Mean ITL (ms): 138.01 Median ITL (ms): 45.37 P99 ITL (ms): 1254.20 ================================================== # random 2K input ============ Serving Benchmark Result ============ Successful requests: 500 Benchmark duration (s): 177.60 Total input tokens: 998175 Total generated tokens: 50000 Request throughput (req/s): 2.82 Output token throughput (tok/s): 281.53 Peak output token throughput (tok/s): 1529.00 Peak concurrent requests: 500.00 Total Token throughput (tok/s): 5901.95 ---------------Time to First Token---------------- Mean TTFT (ms): 86596.60 Median TTFT (ms): 86629.72 P99 TTFT (ms): 171842.84 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 223.40 Median TPOT (ms): 237.63 P99 TPOT (ms): 249.66 ---------------Inter-token Latency---------------- Mean ITL (ms): 221.16 Median ITL (ms): 49.40 P99 ITL (ms): 1216.32 ================================================== # random 128 input ============ Serving Benchmark Result ============ Successful requests: 1000 Benchmark duration (s): 19.29 Total input tokens: 127698 Total generated tokens: 4000 Request throughput (req/s): 51.83 Output token throughput (tok/s): 207.33 Peak output token throughput (tok/s): 860.00 Peak concurrent requests: 1000.00 Total Token throughput (tok/s): 6826.33 ---------------Time to First Token---------------- Mean TTFT (ms): 10718.84 Median TTFT (ms): 10511.60 P99 TTFT (ms): 19055.52 -----Time per Output Token (excl. 1st token)------ Mean TPOT (ms): 890.11 Median TPOT (ms): 949.23 P99 TPOT (ms): 1351.38 ---------------Inter-token Latency---------------- Mean ITL (ms): 667.57 Median ITL (ms): 925.89 P99 ITL (ms): 1854.09 ================================================== ```