Skip to content

[Spec Decode][Perf] Fuse the MTP trailing all-reduce; local-argmax draft tokens - #49793

Merged
WoosukKwon merged 29 commits into
vllm-project:mainfrom
zhou9402:agent/mtp-spec-decode-fast-path
Aug 15, 2026
Merged

[Spec Decode][Perf] Fuse the MTP trailing all-reduce; local-argmax draft tokens#49793
WoosukKwon merged 29 commits into
vllm-project:mainfrom
zhou9402:agent/mtp-spec-decode-fast-path

Conversation

@zhou9402

@zhou9402 zhou9402 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Two optimizations on the DeepSeek-V3.2 / GLM-5.2 MTP draft path.

  • Fuse the trailing all-reduce into the final RMSNorm on the
    non-sequence-parallel path, as the main model already does at layer
    boundaries. The sequence-parallel path is unchanged.
  • Greedy draft tokens via vocab-parallel local argmax (get_top_tokens),
    skipping the full-vocab all-gather in compute_logits. The proposer already
    probes for this via use_local_argmax_reduction; this adds the model side.

Not a duplicate: an earlier revision also carried the
index_share_for_mtp_iteration gates and the V2 speculator lifecycle hooks,
both of which have since landed on main; that part is dropped. Nothing open
overlaps with what remains.

gh pr list --repo vllm-project/vllm --state open --search "MTP all-reduce RMSNorm fuse"
gh pr list --repo vllm-project/vllm --state open --search "local argmax draft tokens"

Benchmarks

2×GB300, TP8 across 2 nodes, nvidia/GLM-5.2-NVFP4, MTP=5,
VLLM_USE_V2_MODEL_RUNNER=1, fp8 KV cache, no prefix caching. The baseline arm
is the same tree with the fusion reverted to an explicit
tensor_model_parallel_all_reduce + RMSNorm; local argmax is toggled with
--speculative-config.use_local_argmax_reduction.

Batch 1 (8192 in / 1024 out, c=1) — no measurable change. Three runs per
arm, output tok/s and MTP acceptance length:

arm fusion local argmax output tok/s acceptance length
baseline 456.7 / 451.6 / 463.3 4.78 / 4.70 / 4.86
+fusion 487.0 / 459.0 / 461.3 5.05 / 4.76 / 4.79
+both 460.1 / 472.8 / 470.2 4.80 / 4.95 / 4.90

The arms overlap completely. At c=1 the saved all-gather is one vocab row and
the fused all-reduce is one small tensor, so this is the expected result;
median ITL sat at 9.08–9.12 ms across all nine runs.

Concurrency 64 (1024 in / 1024 out, 256 prompts) — this is where it pays.
One A/B pair on the same node pair:

arm output tok/s acceptance length median ITL
baseline 2923.2 4.86 31.83 ms
+both 3321.1 (+13.6%) 4.69 31.32 ms

The gain cannot be attributed to speculation luck: acceptance length is 3.5%
lower in the faster arm. Normalizing throughput by acceptance length
(steps/s) gives +17.8%. At c=64 the draft's per-step full-vocab all-gather is
64 × 151k × 2 B ≈ 19 MB, five times per accepted token — that is what
get_top_tokens removes.

Caveats, stated plainly: the c=64 result is a single A/B pair, and a repeat was
lost to cluster contention. Cross-node variability on this cluster is large
(the +fusion arm measured 4226 tok/s on a different node pair with the same
acceptance length as the baseline), so only within-pair comparisons above are
meaningful — do not compare numbers across the two tables.

Accuracy

gsm8k, 5-shot, full 1319 questions, via lm_eval --model local-completions:

arm flexible-extract strict-match
baseline 0.9439 ± 0.0063 0.9424 ± 0.0064
+both 0.9431 ± 0.0064 0.9409 ± 0.0065

Unchanged within stderr, which is the point: the fused kernel accumulates in
fp32 and local argmax breaks vocab-boundary ties differently, so both are
output-affecting in principle.

AI assistance (Claude) was used; every changed line has been reviewed.

@mergify

mergify Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @zhou9402.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@zhou9402

Copy link
Copy Markdown
Contributor Author

Part of the #48597 re-split. See that PR for the tracker: merge order, measured numbers, and what was dropped.

@mergify mergify Bot removed the needs-rebase label Jul 29, 2026
@zhou9402
zhou9402 marked this pull request as ready for review July 29, 2026 10:14

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@zhou9402
zhou9402 force-pushed the agent/mtp-spec-decode-fast-path branch 5 times, most recently from f5de84c to 625d357 Compare July 30, 2026 04:12
@jeejeelee jeejeelee added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 30, 2026
@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Hi @zhou9402, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @zhou9402.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Jul 30, 2026
@zhou9402
zhou9402 force-pushed the agent/mtp-spec-decode-fast-path branch from 625d357 to f7c92f1 Compare July 31, 2026 01:43
@mergify mergify Bot added the mrv2 Model Runner V2 specific label Jul 31, 2026
@ZJY0516

ZJY0516 commented Aug 5, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #82463 for commit 54d503b96c47.

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Hi @zhou9402, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

@ZJY0516

ZJY0516 commented Aug 5, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #82503 for commit 99b66ac54de4.

zhou9402 and others added 2 commits August 6, 2026 17:02
Resolve the DeepSeek V3.2 indexer conflict by retaining the typed active-indexer helper while preserving main's skip-topk behavior.

Co-authored-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
@WoosukKwon

Copy link
Copy Markdown
Collaborator

To clarify, we are going to merge #47352 first

@mergify

mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @zhou9402.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
@mergify mergify Bot removed the needs-rebase label Aug 12, 2026
@WoosukKwon

Copy link
Copy Markdown
Collaborator

Is this PR still needed?

mergify Bot and others added 2 commits August 13, 2026 08:03
The index_share_for_mtp_iteration gates and the V2 speculator lifecycle
hooks this PR proposed have since landed on main, so the only thing left
in attention.py was rewriting the existing `self.indexer is not None and
not self.skip_topk` checks into an `_active_indexer` property — no
behavior change. Revert it and keep the PR to the two MTP draft-path
optimizations plus the lifecycle-hook regression test.

Co-authored-by: Claude Opus 5
Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
@zhou9402 zhou9402 changed the title [Spec Decode][Perf] Optimize MTP draft decoding [Spec Decode][Perf] Fuse the MTP trailing all-reduce; local-argmax greedy draft tokens Aug 13, 2026
Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
@zhou9402 zhou9402 changed the title [Spec Decode][Perf] Fuse the MTP trailing all-reduce; local-argmax greedy draft tokens [Spec Decode][Perf] Fuse the MTP trailing all-reduce; local-argmax draft tokens Aug 13, 2026
@zhou9402

Copy link
Copy Markdown
Contributor Author

Is this PR still needed?

Yes, but much simpler now — the index-sharing part has already merged into main, so all that's left here is the RMSNorm fusion and the local argmax.

get_top_tokens took spec_step_idx as int|None with an assert while the
sibling compute_logits takes int=0 and silently uses step 0. The assert
guarded a case compute_logits does not guard either, so drop it and keep
the two signatures identical.

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
@WoosukKwon
WoosukKwon merged commit 7b544ec into vllm-project:main Aug 15, 2026
6 of 7 checks passed
@zhou9402
zhou9402 deleted the agent/mtp-spec-decode-fast-path branch August 15, 2026 00:35
Alessandra005 pushed a commit to Alessandra005/vllm that referenced this pull request Aug 17, 2026
…aft tokens (vllm-project#49793)

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: Alessandra005 <aurib032@fiu.edu>
zyp2014 pushed a commit to zyp2014/vllm that referenced this pull request Aug 21, 2026
…aft tokens (vllm-project#49793)

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
wyettzeng pushed a commit to wyettzeng/vllm that referenced this pull request Aug 21, 2026
…aft tokens (vllm-project#49793)

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: Wyett <wyettzeng@gmail.com>
zufangzhu pushed a commit to zufangzhu/vllm that referenced this pull request Aug 24, 2026
…aft tokens (vllm-project#49793)

Signed-off-by: Peiyuan Zhou <peiyuanzhou1994@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrv2 Model Runner V2 specific ready ONLY add when PR is ready to merge/full CI is needed speculative-decoding v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants