Repository navigation
Conversation
…m#59740) Adds speculative_config.draft_token_map: the MTP drafter projects onto a list of target token ids instead of the full vocabulary, while the target still verifies with its full lm_head, so outputs are unchanged. This is the fixed-list part of vllm-project/vllm#59740 by @stecasta as of 2026-10-02 (draft_token_map; the later dynamic rows are not included), ported to this fork's EagleSpeculator (_sample_draft is the single drafting point). Adaptations: VocabParallelEmbedding records tp_rank, the draft head declines the SM70 fused top-1 path so the generic local argmax handles its padding rows, and the tests stub the TP group the heads read at construction. Co-authored-by: Stefano Castagnetta <46621686+stecasta@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peuqui <43776522+Peuqui@users.noreply.github.com>
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.
Purpose
An MTP drafter that shares the target's lm_head projects every draft token onto the full vocabulary (248,320 rows on Qwen3.8-Flash-Next). On bandwidth-bound cards that head, not the drafter layer, dominates the draft step. This PR adds
speculative_config.draft_token_map: a list of target token ids the drafter may propose (a JSON list or SGLang's--speculative-token-map.pt; EOS ids are always included). The drafter's shared head is restricted to those rows; the target still verifies every token with its full head.It is the fixed-list part of vllm-project/vllm#59740 by @stecasta as of 2026-10-02 (the later dynamic rows are not included), ported to this fork's
EagleSpeculator(_sample_draftis the single drafting point). Adaptations:VocabParallelEmbeddingrecordstp_rank, the draft head declines the SM70 fused top-1 path so the generic local argmax handles its padding rows, and the tests stub the TP group the heads read at construction. Credit: @stecasta (Co-authored-by on the commit).The field is opt-in (default
None); without it nothing changes, so the full-vocabulary MTP4 defaults qualified in #821 stay as they are. It requires methodmtpand an unquantized lm_head shared with the target.Not a duplicate: gh pr list --state all --search "draft_token_map", "draft vocabulary", "sparse LM head", "59740", "reduced draft" finds #922 (open draft), which builds a CJK-complete FP8 draft vocabulary for the DFlash2 head (qwen3_dflash2.py, dflash/utils.py); this PR is for MTP drafters through EagleSpeculator and touches neither file.
AI assistance was used for this change. I reviewed every line and ran the tests and measurements below.
Test Plan
Serving on our fork (main 6f3557c plus our commits, production commit baaa5a6): Qwen3.8-Flash-Next-180B NVFP4 + MTP (k=4), PP4 over Quadro RTX 8000 / Quadro RTX 8000 / Tesla V100 / Tesla V100, greedy drafting. The list has 98,304 ids, ranked by frequency in model-generated German/English text and code plus German running text and Python sources (coverage on held-out real sessions 99.8 %). Arms: the production entry with the list, and the same entry without
draft_token_map, alternating boots (off, off, on, off, on). Per boot: four 29k-token prompts, short prose, code and a 1.9k-token edit task at production sampling, and three greedy reference prompts.Path coverage
draft_token_mapset, PP4, CUDA graphsdraft_token_mapunsetAcceleration and benchmark contract (required for performance changes)
speculative_config.draft_token_map).--speculative-config '{"method":"mtp",...,"draft_token_map":"<list>"}'.Test Result
test_sm70_mtp_head_scope.py::test_default_head_preparation_precedes_graph_mode_guard, a fake withoutsm70_draft_hot_vocab_ids) fails the same way on main 6f3557c. pre-commit passes.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ly7LM3m9fa6DRJPYQjnt95