Skip to content

Conversation

@samanamp
Copy link
Contributor

@samanamp samanamp commented Sep 10, 2025

Purpose

Optimize Kimi K2 Fused MoE kernels Optimization configs

Execution improvement: We see 17.8% in Output token throughput (tok/s). The bulk of improvement is in Inter-token Latency.

Test Plan

  1. Single benchmark
python benchmarks/kernels/benchmark_moe_old.py --model $MODEL --dtype "fp8_w8a8" --tp 4
  1. Model E2E
    Server side:
MODEL=moonshotai/Kimi-K2-Instruct
python -m vllm.entrypoints.openai.api_server --model $MODEL --enable-expert-parallel --max-model-len=65000 -tp 4 --port 8101 --gpu_memory_utilization=0.95

Bench:

python benchmarks/benchmark_serving.py --backend vllm --model $MODEL --dataset-name random --random-input-len 7500 --random-output-len 7500 --max-concurrency 128 --num-prompts 512 --port 8101`

Test Result

  1. Single benchmark
Screenshot 2025-09-10 at 9 18 12 AM Screenshot 2025-09-10 at 9 18 31 AM Screenshot 2025-09-10 at 9 20 20 AM
  1. Model E2E

BEFORE:

============ Serving Benchmark Result ============
Successful requests:                     200       
Maximum request concurrency:             64        
Benchmark duration (s):                  499.10    
Total input tokens:                      1499747   
Total generated tokens:                  276363    
Request throughput (req/s):              0.40      
Output token throughput (tok/s):         553.73    
Total Token throughput (tok/s):          3558.65   
---------------Time to First Token----------------
Mean TTFT (ms):                          12740.87  
Median TTFT (ms):                        13355.67  
P99 TTFT (ms):                           21087.93  
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          272.12    
Median TPOT (ms):                        360.46    
P99 TPOT (ms):                           387.18    
---------------Inter-token Latency----------------
Mean ITL (ms):                           62.89     
Median ITL (ms):                         57.45     
P99 ITL (ms):                            363.68    
==================================================

AFTER:

============ Serving Benchmark Result ============
Successful requests:                     200       
Maximum request concurrency:             64        
Benchmark duration (s):                  424.97    
Total input tokens:                      1499747   
Total generated tokens:                  277351    
Request throughput (req/s):              0.47      
Output token throughput (tok/s):         652.64    
Total Token throughput (tok/s):          4181.70   
---------------Time to First Token----------------
Mean TTFT (ms):                          13136.72  
Median TTFT (ms):                        13603.26  
P99 TTFT (ms):                           22379.70  
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          269.90    
Median TPOT (ms):                        359.65    
P99 TPOT (ms):                           386.72    
---------------Inter-token Latency----------------
Mean ITL (ms):                           52.96     
Median ITL (ms):                         47.41     
P99 ITL (ms):                            363.21    
==================================================

We see 17.8% in Output token throughput (tok/s). The bulk of improvement is in Inter-token Latency.


  • [x ] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • [x ] The test plan, such as providing test command.
  • [x ] The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces optimized configurations for Fused MoE kernels for the Kimi K2 model on various NVIDIA GPUs (B200, GB200, H200). The changes consist of adding new JSON configuration files with tuned parameters for different batch sizes, which results in a significant performance improvement of 17.8% in output token throughput, primarily by reducing inter-token latency, as demonstrated by the provided benchmark results. The changes are well-documented and appear to be correct. I have reviewed the new configuration files and found no issues.

Signed-off-by: Saman Keon <[email protected]>
@samanamp samanamp force-pushed the kimik2-kernel-configs branch from e4e5971 to 3211895 Compare September 10, 2025 16:27
@houseroad houseroad added ready ONLY add when PR is ready to merge/full CI is needed performance Performance-related issues labels Sep 10, 2025
@houseroad houseroad enabled auto-merge (squash) September 10, 2025 16:27
@vllm-bot vllm-bot merged commit 3d1393f into vllm-project:main Sep 11, 2025
49 of 51 checks passed
@samanamp samanamp deleted the kimik2-kernel-configs branch September 11, 2025 15:51
skyloevil pushed a commit to skyloevil/vllm that referenced this pull request Sep 13, 2025
dsxsteven pushed a commit to dsxsteven/vllm_splitPR that referenced this pull request Sep 15, 2025
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 10, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants