Skip to content

Conversation

djmmoss
Copy link
Contributor

@djmmoss djmmoss commented Aug 21, 2025

Purpose

This PR adds the cutlass fused moe bf16xmxfp4 for gpt-oss on hopper from flashinfer the blackwell integration will come in a follow up PR soon.

The accuracy looks good, but there is a performance regression compared to triton (you can see in the results section). This is something we actively working on fixing and will push to flashinfer once it is resolved. Please let me know how you want to proceed with backend selection, and I can update accordingly.

Test Plan

Unit Tests:

python3 -m pytest tests/kernels/moe/test_mxfp4_moe.py

Accuracy Tests:

evals from here

low Ref for gpt-oss-20b and gpt-oss-120b are 0.58 and 0.68 respectively.

vllm serve gpt-oss-20b --max-model-len 32768 -tp 2
python3 -m evals --eval gpqa --model /scratch/model/gpt-oss-20b --reasoning-effort low
vllm serve gpt-oss-120b --max-model-len 32768 -tp 8
python3 -m evals --eval gpqa --model /scratch/model/gpt-oss-120b --reasoning-effort low

Performance:

vllm serve gpt-oss-120b --max-model-len 32768 -tp 8
vllm bench serve --backend vllm --model gpt-oss-120b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json
vllm serve gpt-oss-20b --max-model-len 32768 -tp 2
vllm bench serve --backend vllm --model gpt-oss-20b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json

Test Result

Unit Tests:

python3 -m pytest tests/kernels/moe/test_mxfp4_moe.py
================================================================================================================================= test session starts ==================================================================================================================================
platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0
rootdir: /workspace/vllm
configfile: pyproject.toml
plugins: anyio-4.10.0
collected 59 items                                                                                                                                                                                                                                                                     

tests/kernels/moe/test_mxfp4_moe.py sssssssssssssssssssssssssssssssssssssssssssssssssss........                                                                                                                                                                                  [100%]

============================================================================================================================ 8 passed, 51 skipped in 5.15s =============================================================================================================================

Accuracy Tests:

vllm serve gpt-oss-20b --max-model-len 32768 -tp 2

python3 -m evals --eval gpqa --model /scratch/model/gpt-oss-20b --reasoning-effort low
[{'eval_name': 'gpqa', 'model_name': '__scratch__model__gpt-oss-20b-low_temp1.0_20250825_121929', 'metric': 0.5732323232323232}]
vllm serve gpt-oss-120b --max-model-len 32768 -tp 8

python3 -m evals --eval gpqa --model /scratch/model/gpt-oss-120b --reasoning-effort low
[{'eval_name': 'gpqa', 'model_name': '__scratch__model__gpt-oss-120b-low_temp1.0_20250825_123502', 'metric': 0.0.6609848484848485}]

Peformance:
FlashInfer:

vllm serve gpt-oss-120b --max-model-len 32768 -tp 8
vllm bench serve --backend vllm --model gpt-oss-120b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json

============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  26.62     
Total input tokens:                      215312    
Total generated tokens:                  197144    
Request throughput (req/s):              37.56     
Output token throughput (tok/s):         7404.72   
Total Token throughput (tok/s):          15491.84  
---------------Time to First Token----------------
Mean TTFT (ms):                          3449.17   
Median TTFT (ms):                        3229.56   
P99 TTFT (ms):                           6760.19   
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          94.12     
Median TPOT (ms):                        57.07     
P99 TPOT (ms):                           264.21    
---------------Inter-token Latency----------------
Mean ITL (ms):                           45.75     
Median ITL (ms):                         34.61     
P99 ITL (ms):                            220.33    
==================================================
vllm serve gpt-oss-20b --max-model-len 32768 -tp 2
vllm bench serve --backend vllm --model gpt-oss-20b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json

============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  33.94     
Total input tokens:                      215312    
Total generated tokens:                  197922    
Request throughput (req/s):              29.46     
Output token throughput (tok/s):         5831.00   
Total Token throughput (tok/s):          12174.32  
---------------Time to First Token----------------
Mean TTFT (ms):                          6173.79   
Median TTFT (ms):                        5927.93   
P99 TTFT (ms):                           11794.97  
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          149.48    
Median TPOT (ms):                        80.18     
P99 TPOT (ms):                           401.31    
---------------Inter-token Latency----------------
Mean ITL (ms):                           63.93     
Median ITL (ms):                         43.34     
P99 ITL (ms):                            401.32    
==================================================

Triton:

vllm serve gpt-oss-120b --max-model-len 32768 -tp 8
vllm bench serve --backend vllm --model gpt-oss-120b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json

============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  19.40     
Total input tokens:                      215312    
Total generated tokens:                  198101    
Request throughput (req/s):              51.54     
Output token throughput (tok/s):         10210.09  
Total Token throughput (tok/s):          21307.23  
---------------Time to First Token----------------
Mean TTFT (ms):                          4236.52   
Median TTFT (ms):                        4160.78   
P99 TTFT (ms):                           8159.43   
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          81.37     
Median TPOT (ms):                        48.59     
P99 TPOT (ms):                           470.25    
---------------Inter-token Latency----------------
Mean ITL (ms):                           34.87     
Median ITL (ms):                         18.66     
P99 ITL (ms):                            76.82     
==================================================
vllm serve gpt-oss-20b --max-model-len 32768 -tp 2
vllm bench serve --backend vllm --model gpt-oss-20b --dataset-name sharegpt --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json

============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  15.66     
Total input tokens:                      215312    
Total generated tokens:                  197780    
Request throughput (req/s):              63.88     
Output token throughput (tok/s):         12633.59  
Total Token throughput (tok/s):          26387.07  
---------------Time to First Token----------------
Mean TTFT (ms):                          4105.11   
Median TTFT (ms):                        4172.38   
P99 TTFT (ms):                           5828.51   
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          46.94     
Median TPOT (ms):                        29.87     
P99 TPOT (ms):                           133.46    
---------------Inter-token Latency----------------
Mean ITL (ms):                           23.34     
Median ITL (ms):                         17.03     
P99 ITL (ms):                            86.10     
==================================================

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Signed-off-by: Duncan Moss <[email protected]>
Signed-off-by: Duncan Moss <[email protected]>
Signed-off-by: Duncan Moss <[email protected]>
Signed-off-by: Duncan Moss <[email protected]>
Signed-off-by: Duncan Moss <[email protected]>
@djmmoss djmmoss force-pushed the dmoss/cutlass-fused-moe-mxfp4-hopper branch from c215b71 to 927c179 Compare August 24, 2025 16:49
yzh119 pushed a commit to flashinfer-ai/flashinfer that referenced this pull request Aug 24, 2025
…ing in fused moe (#1565)

## 📌 Description

This fixes an OOB issue in the fused MoE and creates a separate sm90 and
sm100 path fp4 quantization.

## 🔍 Related Issues

fix required for vllm-project/vllm#23369

## 🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### ✅ Pre-commit Checks

- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [x] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

## 🧪 Tests

- [x] Tests have been added or updated as needed.
- [x] All tests are passing (`unittest`, etc.).

## Reviewer Notes

---------

Signed-off-by: Duncan Moss <[email protected]>
@djmmoss djmmoss marked this pull request as ready for review August 25, 2025 13:58
Signed-off-by: Duncan Moss <[email protected]>
@djmmoss djmmoss requested a review from WoosukKwon as a code owner August 25, 2025 18:04
Signed-off-by: Duncan Moss <[email protected]>
Signed-off-by: Duncan Moss <[email protected]>
@mergify mergify bot added the ci/build label Aug 25, 2025
Copy link

mergify bot commented Aug 26, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @djmmoss.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Aug 26, 2025
@mergify mergify bot removed the needs-rebase label Aug 26, 2025
@djmmoss
Copy link
Contributor Author

djmmoss commented Aug 27, 2025

closing as #23696 contains these changes include the blackwell changes

@djmmoss djmmoss closed this Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build gpt-oss Related to GPT-OSS models
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant