[Temporarily unblock spec v2 qwen3.5]#18906
Conversation
Summary of ChangesHello @vincentzed, 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 introduces several enhancements to support speculative decoding v2 (EAGLEWorkerV2) for Qwen3.5, focusing on optimizing Mamba state management and improving multimodal input handling. It integrates an overlap scheduling mechanism to enhance performance and refines the Mamba prefix-cache update logic, particularly after token verification. Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces changes to support spec v2 for qwen3.5, particularly for models with Mamba-like architectures. The changes include adding a new forward mode DRAFT_EXTEND_V2, optimizing mamba state updates, and improving multimodal input handling in speculative decoding. The code is generally well-structured and the changes are consistent across files. I have a couple of suggestions for minor improvements to enhance maintainability and code clarity.
| req.mamba_next_track_idx = ( | ||
| batch.req_to_token_pool.get_mamba_ping_pong_other_idx( | ||
| req.mamba_next_track_idx | ||
| ) | ||
| ) |
| to_track_ith = torch.clamp( | ||
| tracking_point - seq_lens_pre_verify - 1, min=0 | ||
| ).to(torch.int64) |
There was a problem hiding this comment.
The torch.clamp(..., min=0) call appears to be redundant. Given that to_track_mask is true, it implies seq_lens_pre_verify // mamba_track_interval < seq_lens_post_verify // mamba_track_interval. This guarantees that tracking_point will be greater than seq_lens_pre_verify, making tracking_point - seq_lens_pre_verify - 1 always non-negative. Removing the clamp can simplify the code without changing the logic.
to_track_ith = (tracking_point - seq_lens_pre_verify - 1).to(torch.int64)Signed-off-by: vincentzed <207368749+vincentzed@users.noreply.github.com>
|
not working on my machine |
Motivation
Modifications
Uses #15591 and https://github.com/sgl-project/sglang/pull/18808/changes and change in mm handling on top of it.
❯ python -m sglang.test.send_one --streamSpec v2
SGLANG_ENABLE_SPEC_V2=1 python -m sglang.launch_server --model-path Qwen/Qwen3.5-397B-A17B --tp-size 8 --mem-fraction-static 0.8 --context-length 262144 --reasoning-parser qwen3 --speculative-algo NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4Spec v1
Suspect there is still some opportunity to further improve spec v2 performance, as advantage is still small.

edit: it's because of this nontrivila sync
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci