[ATOM SGL] MTP Spec decode#1361
Open
ZhiweiYan-96 wants to merge 4 commits into
Open
Conversation
22b74b5 to
84f2e0d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Enable DeepSeek-V4 MTP speculative decoding in the ATOM SGLang plugin path by adding an SGLang-compatible NextN draft wrapper and extending the DeepSeek-V4 proxy KV-cache/metadata bridge to support speculative + CUDA-graph workflows.
Changes:
- Add
DeepseekV4ForCausalLMNextNSGLang wrapper backed by ATOM’sDeepseekV4MTP, including shared embedding/LM-head weight tying for draft runs. - Extend DeepSeek-V4 SGLang bridge/backends to publish and reuse ATOM V4 graph/attention metadata across decode/prefill/graph capture paths, including MTP layer support.
- Patch SGLang speculative factories / CUDA-graph eligibility to route DeepSeek-V4 draft backends through ATOM plugin mode.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| atom/plugin/sglang/runtime/forward_context.py | Adds V4 graph-metadata capture slicing and more robust metadata discovery paths. |
| atom/plugin/sglang/models/deepseek_v4_nextn_wrapper.py | New SGLang entry wrapper that instantiates ATOM DeepseekV4MTP and shares embed/head weights for NextN draft. |
| atom/plugin/sglang/models/base_model_wrapper.py | Routes DeepSeek-V4 logits through LogitsProcessor consistently; exposes embed/head for weight sharing. |
| atom/plugin/sglang/deepseek_v4_bridge.py | Extends proxy KV binding to MTP blocks and updates decode-graph metadata construction/indexer metadata. |
| atom/plugin/sglang/attention_backend/deepseek_v4_backend.py | Publishes ATOM metadata into ForwardBatch, supports multi-step draft backend expectations, and supports old/new graph hooks. |
| atom/plugin/register.py | Monkeypatches SGLang speculative backend factories and CUDA-graph behavior to force DeepSeek-V4 through ATOM shims. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+692
to
+695
| pos_np = positions[:total].detach().cpu().numpy().astype(np.int32) | ||
| repeats = max(1, total // max(1, bs)) | ||
| batch_np = np.repeat(np.arange(bs, dtype=np.int64), repeats)[:total] | ||
| else: |
Comment on lines
14
to
+16
| from atom.plugin.sglang.runtime.context import bind_current_forward_batch | ||
|
|
||
| logger = logging.getLogger("atom.plugin.sglang.runtime.forward_context") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Enable DeepSeek-V4 MTP speculative decoding in the ATOM SGLang plugin path.
Technical Details
Test Result
DeepSeek-V4-Pro
Acceptance rate(MTP=3):
Submission Checklist