Skip to content

[Rebase] Add Qwen3.8 & Qwen3.5 support and evaluation guide on qwen4_v0.5.21 - #54

Merged
apinge merged 10 commits into
qwen4_v0.5.21from
qwen4-model-support-eval
Oct 22, 2026
Merged

apinge merged 10 commits into
qwen4_v0.5.21from
qwen4-model-support-eval

Conversation

@sammysun0711

@sammysun0711 sammysun0711 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

This PR aim to address #50 to enable Qwen3.5 & Qwen3.8 functional support on qwen4_v0.5.21

Modifications

Accuracy Tests

Speed Tests and Profiling

1. Qwen3.8-next-flash target model only, TP2, disable radix cache
./launch_qwen38_flash_next_fp8_mi308x_pure_tp_4_or_8_or_2.sh
./run_qwen38_pure_text_bench.sh

============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     32        
Benchmark duration (s):                  246.68    
Total input tokens:                      384000    
Total input text tokens:                 384000    
Total generated tokens:                  11200     
Total generated tokens (retokenized):    11165     
Request throughput (req/s):              0.13      
Input token throughput (tok/s):          1556.68   
Output token throughput (tok/s):         45.40     
Peak output token throughput (tok/s):    53.00     
Peak concurrent requests:                2         
Total token throughput (tok/s):          1602.09   
Concurrency:                             1.00      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   7707.09   
Median E2E Latency (ms):                 7701.55   
P90 E2E Latency (ms):                    7748.27   
P95 E2E Latency (ms):                    7769.78   
P99 E2E Latency (ms):                    7810.77   
---------------Time to First Token----------------
Mean TTFT (ms):                          1079.70   
Median TTFT (ms):                        1076.09   
P90 TTFT (ms):                           1100.98   
P95 TTFT (ms):                           1103.91   
P99 TTFT (ms):                           1138.80   
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          18.99     
Median TPOT (ms):                        18.97     
P90 TPOT (ms):                           19.11     
P95 TPOT (ms):                           19.13     
P99 TPOT (ms):                           19.14     
---------------Inter-Token Latency----------------
Mean ITL (ms):                           18.99     
Median ITL (ms):                         18.88     
P90 ITL (ms):                            18.92     
P95 ITL (ms):                            18.99     
P99 ITL (ms):                            25.69     
Max ITL (ms):                            36.68     
==================================================

./run_gsm8k.sh

100%|██████████████████████████████████████████████████████████████████| 1314/1314 [23:22<00:00,  1.07s/it]
Total latency: 1403.260 s
Score: 0.976
Output throughput: 452.730 token/s

2. Qwen3.8-next-flash + MTP, TP=2, disable radix cache
./launch_qwen38_flash_next_fp8_mi308x_pure_tp_4_or_8_or_2.sh
./run_qwen38_pure_text_bench.sh

--speculative-moe-runner-backend triton
--speculative-algorithm EAGLE
--speculative-num-steps 3
--speculative-eagle-topk 1
--speculative-num-draft-tokens 4
============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     128       
Benchmark duration (s):                  607.54    
Total input tokens:                      1536000   
Total input text tokens:                 1536000   
Total generated tokens:                  44800     
Total generated tokens (retokenized):    44737     
Request throughput (req/s):              0.21      
Input token throughput (tok/s):          2528.22   
Output token throughput (tok/s):         73.74     
Peak output token throughput (tok/s):    113.00    
Peak concurrent requests:                2         
Total token throughput (tok/s):          2601.96   
Concurrency:                             1.00      
Accept length:                           3.51      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   4745.73   
Median E2E Latency (ms):                 4411.92   
P90 E2E Latency (ms):                    5610.92   
P95 E2E Latency (ms):                    5969.09   
P99 E2E Latency (ms):                    6191.18   
---------------Time to First Token----------------
Mean TTFT (ms):                          1156.16   
Median TTFT (ms):                        1155.25   
P90 TTFT (ms):                           1175.55   
P95 TTFT (ms):                           1187.77   
P99 TTFT (ms):                           1210.21   
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          10.29     
Median TPOT (ms):                        9.34      
P90 TPOT (ms):                           12.74     
P95 TPOT (ms):                           13.79     
P99 TPOT (ms):                           14.40     
---------------Inter-Token Latency----------------
Mean ITL (ms):                           10.29     
Median ITL (ms):                         8.90      
P90 ITL (ms):                            11.79     
P95 ITL (ms):                            17.71     
P99 ITL (ms):                            35.56     
Max ITL (ms):                            88.31     
==================================================

./run_gsm8k.sh

[21:26<03:100%|███████████████████████████████████████████████████████████████████| 1314/1314 [21:26<00:00,  1.02it/s]
Total latency: 1316.566 s
Score: 0.978
Output throughput: 488.483 token/s

3. Qwen3.5 397B target model only TP8, disable radix cache
./launch_qwen3.5-397B-fp8_tp8_disable_prefix_cache.sh
./run_qwen35_pure_text_bench.sh

============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     128       
Benchmark duration (s):                  437.20    
Total input tokens:                      1024000   
Total input text tokens:                 1024000   
Total generated tokens:                  64000     
Total generated tokens (retokenized):    63852     
Request throughput (req/s):              0.29      
Input token throughput (tok/s):          2342.18   
Output token throughput (tok/s):         146.39    
Peak output token throughput (tok/s):    168.00    
Peak concurrent requests:                2         
Total token throughput (tok/s):          2488.57   
Concurrency:                             1.00      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   3414.80   
Median E2E Latency (ms):                 3398.16   
P90 E2E Latency (ms):                    3500.76   
P95 E2E Latency (ms):                    3519.99   
P99 E2E Latency (ms):                    3552.89   
---------------Time to First Token----------------
Mean TTFT (ms):                          352.66    
Median TTFT (ms):                        350.84    
P90 TTFT (ms):                           365.77    
P95 TTFT (ms):                           376.62    
P99 TTFT (ms):                           388.50    
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          6.14      
Median TPOT (ms):                        6.11      
P90 TPOT (ms):                           6.30      
P95 TPOT (ms):                           6.34      
P99 TPOT (ms):                           6.41      
---------------Inter-Token Latency----------------
Mean ITL (ms):                           6.14      
Median ITL (ms):                         5.97      
P90 ITL (ms):                            6.00      
P95 ITL (ms):                            6.05      
P99 ITL (ms):                            17.14     
Max ITL (ms):                            58.31     
==================================================

./run_gsm8k.sh

███████████████████████████████████████████████████████████▍      100%|██████████████████████████████████████████████████████████████████████████| 1314/1314 [20:41<00:00,  1.06it/s]
Total latency: 1242.107 s
Score: 0.976
Output throughput: 2884.101 token/s

4. Qwen3.5 397B target +dflash TP8, enable radix cache
./launch_qwen3.5-397B-fp8_tp8_dflash_with_prefix_cache.sh
./run_qwen35_pure_text_bench.sh

============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     128       
Benchmark duration (s):                  229.96    
Total input tokens:                      1024000   
Total input text tokens:                 1024000   
Total generated tokens:                  64000     
Total generated tokens (retokenized):    63843     
Request throughput (req/s):              0.56      
Input token throughput (tok/s):          4452.95   
Output token throughput (tok/s):         278.31    
Peak output token throughput (tok/s):    500.00    
Peak concurrent requests:                2         
Total token throughput (tok/s):          4731.26   
Concurrency:                             1.00      
Accept length:                           6.70      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   1795.69   
Median E2E Latency (ms):                 1126.82   
P90 E2E Latency (ms):                    3163.39   
P95 E2E Latency (ms):                    3338.90   
P99 E2E Latency (ms):                    3755.20   
---------------Time to First Token----------------
Mean TTFT (ms):                          363.99    
Median TTFT (ms):                        364.49    
P90 TTFT (ms):                           372.75    
P95 TTFT (ms):                           378.16    
P99 TTFT (ms):                           390.32    
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          2.87      
Median TPOT (ms):                        1.54      
P90 TPOT (ms):                           5.60      
P95 TPOT (ms):                           5.95      
P99 TPOT (ms):                           6.79      
---------------Inter-Token Latency----------------
Mean ITL (ms):                           2.87      
Median ITL (ms):                         1.44      
P90 ITL (ms):                            6.04      
P95 ITL (ms):                            10.82     
P99 ITL (ms):                            21.89     
Max ITL (ms):                            52.99     
==================================================

./run_gsm8k.sh

100%|███████████████████████████████████████████████████████| 1314/1314 [17:28<00:00,  1.25it/s]
Total latency: 1049.196 s
Score: 0.974
Output throughput: 3341.218 token/s

5. Qwen3.5 35B target model only TP4, disable radix cache
./launch_qwen3.5-35B-fp8_tp4_disable_prefix_cache.sh
./run_qwen35_pure_text_bench.sh

============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     128       
Benchmark duration (s):                  289.00    
Total input tokens:                      1024000   
Total input text tokens:                 1024000   
Total generated tokens:                  64000     
Total generated tokens (retokenized):    63891     
Request throughput (req/s):              0.44      
Input token throughput (tok/s):          3543.20   
Output token throughput (tok/s):         221.45    
Peak output token throughput (tok/s):    246.00    
Peak concurrent requests:                2         
Total token throughput (tok/s):          3764.65   
Concurrency:                             1.00      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   2257.05   
Median E2E Latency (ms):                 2256.80   
P90 E2E Latency (ms):                    2290.70   
P95 E2E Latency (ms):                    2311.48   
P99 E2E Latency (ms):                    2325.88   
---------------Time to First Token----------------
Mean TTFT (ms):                          171.35    
Median TTFT (ms):                        165.49    
P90 TTFT (ms):                           173.93    
P95 TTFT (ms):                           200.53    
P99 TTFT (ms):                           236.36    
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          4.18      
Median TPOT (ms):                        4.18      
P90 TPOT (ms):                           4.25      
P95 TPOT (ms):                           4.27      
P99 TPOT (ms):                           4.32      
---------------Inter-Token Latency----------------
Mean ITL (ms):                           4.18      
Median ITL (ms):                         4.07      
P90 ITL (ms):                            4.12      
P95 ITL (ms):                            4.14      
P99 ITL (ms):                            6.53      
Max ITL (ms):                            54.99     
==================================================

./run_gsm8k.sh

100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1314/1314 [13:42<00:00,  1.60it/s]
Total latency: 822.562 s
Score: 0.967
Output throughput: 5339.040 token/s

6. Qwen3.5 35B target +dflash TP1, enable radix cache
./launch_qwen3.5-35B-fp8_tp1_dflash_with_prefix_cache_mfs0.7_bs32.sh
./run_qwen35_pure_text_bench.sh

============ Serving Benchmark Result ============
Backend:                                 sglang    
Traffic request rate:                    inf       
Max request concurrency:                 1         
Successful requests:                     128       
Benchmark duration (s):                  222.74    
Total input tokens:                      1024000   
Total input text tokens:                 1024000   
Total generated tokens:                  64000     
Total generated tokens (retokenized):    63937     
Request throughput (req/s):              0.57      
Input token throughput (tok/s):          4597.34   
Output token throughput (tok/s):         287.33    
Peak output token throughput (tok/s):    624.00    
Peak concurrent requests:                3         
Total token throughput (tok/s):          4884.67   
Concurrency:                             1.00      
Accept length:                           6.05      
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   1739.30   
Median E2E Latency (ms):                 1626.12   
P90 E2E Latency (ms):                    2798.07   
P95 E2E Latency (ms):                    3170.02   
P99 E2E Latency (ms):                    3777.46   
---------------Time to First Token----------------
Mean TTFT (ms):                          334.82    
Median TTFT (ms):                        333.24    
P90 TTFT (ms):                           337.31    
P95 TTFT (ms):                           341.27    
P99 TTFT (ms):                           365.69    
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          2.81      
Median TPOT (ms):                        2.59      
P90 TPOT (ms):                           4.93      
P95 TPOT (ms):                           5.68      
P99 TPOT (ms):                           6.47      
---------------Inter-Token Latency----------------
Mean ITL (ms):                           2.81      
Median ITL (ms):                         1.24      
P90 ITL (ms):                            5.75      
P95 ITL (ms):                            8.31      
P99 ITL (ms):                            16.58     
Max ITL (ms):                            57.59     
==================================================

./run_gsm8k.sh

100%|███████████████████████████████████████████████████████████████████████████████| 1314/1314 [33:09<00:00,  1.51s/it]
Total latency: 1990.152 s
Score: 0.965
Output throughput: 2185.120 token/s

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

vincentzed and others added 5 commits October 19, 2026 03:37
The transport resolution moved from ServerArgs._handle_multimodal_feature_transport
to arg_groups/serving_hook.handle_multimodal_feature_transport. Accept cuda_ipc on
CUDA or HIP there. Tests use override_platform instead of patching server_args.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KVPUFiK2bhzjErEnCMv26w
(cherry picked from commit 7453337)
PR sgl-project#33747 opens the multimodal IPC gate on HIP, but the pool lifecycle
introduced by sgl-project#33949 still calls the NVIDIA CUDA driver. Dispatch the
ROCm ready/wait/ack words through small Triton kernels with system-scope
acquire/release atomics. Keep the NVIDIA path unchanged.

Native HIP stream wait crashed on peer IPC mappings in the tested ROCm
build; the GPU kernel path preserves copy ordering and lease safety.
Correct the inherited gate comment to describe this additional backend
requirement and register IPC coverage for AMD.
@sammysun0711 sammysun0711 changed the title [Rebase] Add Qwen3.8 & Qwen3.5 function support and evaluation guide on qwen4_v0.5.21 [Rebase] Add Qwen3.8 & Qwen3.5 support and evaluation guide on qwen4_v0.5.21 Oct 20, 2026
Comment thread evaluation/Qwen4_Evaluation_Guide.md Resolved
Comment thread evaluation/Qwen4_Evaluation_Guide.md Resolved
Signed-off-by: Xiake Sun <[email protected]>
Comment thread evaluation/Qwen4_Evaluation_Guide.md Resolved
…processing

The self-referencing PLE shard loader forms a closure cycle that retains
params_dict after weight loading. When FP8 postprocessing
(fp8e4m3->fp8e4m3nuz) replaces the parameters, the dictionary keeps
their original GPU storage alive until cyclic GC runs, causing
Qwen3.8 BF16-PLE TP2 launches OOM.

Clear params_dict before returning so obsolete weight storage can be
released during postprocessing. Preserve PLE GPU residency, weight
precision, and existing quantization behavior.

Signed-off-by: Xiake Sun <[email protected]>
absmax = torch.clamp(absmax, min=eps)
scale_val = absmax / fp8_max
scale.copy_(scale_val)
scale[:M].copy_(scale_val)

@apinge apinge Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Where did changes in this file python/sglang/kernels/ops/quantization/fp8_kernel.pycome from?

@sammysun0711 sammysun0711 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This padding fix from 8ead45e does not backport from upstream or previous fork repo.
It added as initial support Qwen3.5 model to allow padded FP8 linear operations to work when SGLANG_USE_AITER=0 on ROCm.

Qwen3.5 GatedDeltaNet input projection: in_proj_qkvz
  → compressed-tensors FP8 linear
  → apply_fp8_linear()
  → scaled_fp8_quant(num_token_padding=17) -> fix padding issue here
  → native PyTorch per-token quantization
  → FP8 matrix multiplication

apply_fp8_linear() (python/sglang/srt/layers/quantization/fp8_utils.py:2078) pads small input batches to 17 rows because the existing code expects better torch._scaled_mm performance above 16 rows. This padding is independent of CUDA graph capture.
With SGLANG_USE_AITER=0, the quantization helper receives, for example, 2 live input rows and a 17-row output buffer. This fix makes that copy valid and initializes the remaining rows.

This code path in python/sglang/kernels/ops/quantization/fp8_kernel.py with _native prefix will not invoke if ``SGLANG_USE_AITER=1`, We can preserve it as a debug fallback if needed.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Make sense. Let's keep it.

@apinge
apinge merged commit 91cdd01 into qwen4_v0.5.21 Oct 22, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants