Skip to content

Conversation

@b8zhong
Copy link
Collaborator

@b8zhong b8zhong commented Jan 2, 2026

Motivation

Depends on Flashinfer 0.6.0

Currently, the MTP layer (BF16 x BF16) use Triton for the Fused MoE backend. The drafting stage is a small portion of E2E performance, but it can make a bigger difference at higher concurrency.

Modifications

Remove the change from auto to triton, as RoutingMethodType=DeepseekV3 is supported in flashinfer-ai/flashinfer#2234 commit of Flashinfer

Accuracy Tests

SGLANG_ENABLE_SPEC_V2=1 \
python3 -m sglang.launch_server \
    --model-path nvidia/DeepSeek-V3-0324-FP4 \
    --trust-remote-code \
    --tp 4 \
    --quantization modelopt_fp4 \
    --speculative-algorithm EAGLE \
    --speculative-moe-runner-backend=flashinfer_trtllm \
    --moe-runner-backend=flashinfer_trtllm

TODO: after the acceptance length issue is fixed.

Benchmarking and Profiling

Draft layer

export SGLANG_TORCH_PROFILER_DIR="./"

python -m sglang.bench_one_batch_server \
  --model nvidia/DeepSeek-V3-0324-FP4 \
  --batch-size 8 \
  --input-len 2048 \
  --output-len 256 \
  --profile \
  --profile-steps 10 \
  --show-report

Before:

Screenshot 2026-01-01 at 8 31 59 PM
+-------------+--------+------------+-----------------+
| Latency (s) | Tokens | Acc Length | Speed (token/s) |
+-------------+--------+------------+-----------------+
|    3.867    |  1024  |   2.844    |     264.80      |
+-------------+--------+------------+-----------------+

After:

Screenshot 2026-01-01 at 8 30 58 PM
+-------------+--------+------------+-----------------+
| Latency (s) | Tokens | Acc Length | Speed (token/s) |
+-------------+--------+------------+-----------------+
|    4.078    |  1024  |   2.646    |     251.08      |
+-------------+--------+------------+-----------------+

Anyway, the root problem is the acceptance length drop, likely because the routing method for MTP layer may not be correctly inferred. Investigating the issue. @samuellees

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @b8zhong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the default backend for the speculative Mixture-of-Experts (MoE) runner to flashinfer_trtllm. This change leverages recent advancements in Flashinfer, specifically version 0.6.0, which now supports the DeepseekV3 routing method. The aim is to utilize a more optimized backend for the MoE layer, potentially improving performance, particularly in scenarios with higher concurrency.

Highlights

  • Default Backend Change: The speculative_moe_runner_backend now defaults to flashinfer_trtllm, removing a previous restriction.
  • Flashinfer Update Dependency: This change is enabled by Flashinfer version 0.6.0, which includes support for RoutingMethodType=DeepseekV3.
  • Code Simplification: A conditional block that previously prevented flashinfer_trtllm from being used as the default speculative MoE backend has been removed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@b8zhong b8zhong marked this pull request as draft January 2, 2026 01:38
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 removes a temporary workaround that prevented flashinfer_trtllm from being used as the speculative MoE backend. This is a good cleanup. I've left one comment regarding the default behavior for certain model configurations that might need another look. Also, as you've noted, the performance regression with flashinfer_trtllm needs to be addressed before this can be merged.

I am having trouble creating individual review comments. Click here to see my feedback.

python/sglang/srt/server_args.py (2003-2016)

medium

Removing this workaround is a good step towards enabling flashinfer_trtllm for speculative MoE.

However, it seems that for DeepSeek V3 models with modelopt_fp4 quantization, the default speculative_moe_runner_backend is still set to 'triton' within the _handle_model_specific_adjustments method (specifically around line 1191).

Given the PR's goal to use flashinfer_trtllm by default and the new support for RoutingMethodType=DeepseekV3 in Flashinfer, should this default also be updated to flashinfer_trtllm to fully align with the intention of this PR?

@b8zhong b8zhong mentioned this pull request Jan 2, 2026
6 tasks
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.

1 participant