Skip to content

[Model][Spec Decode] Refactor #41834 with useful improvements - #63996

Merged
Harry-Chen merged 2 commits into
vllm-project:mainfrom
wtdcode:dsv4-salvage-41834
Oct 27, 2026
Merged

Harry-Chen merged 2 commits into
vllm-project:mainfrom
wtdcode:dsv4-salvage-41834

Conversation

@wtdcode

@wtdcode wtdcode commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Overview

#41834 has been stale for a while, and many key contributions have been superseded by other PRs. This PR extracts the useful parts of that huge PR and conducts end-to-end experiments on two Sparks to ensure it works well. The authorship is also acknowledged.

Claims

In general, this PR comprises:

  • mHC residual reuse. For a 8192 token prefill setup, this saves 256 MiB VRAM.
  • No _mtp_hidden_buffer under DSpark. DSpark does not need and access these memories and this saves another 256 MiB VRAM per card.
  • Stale MRV1 drafter layout caches. This is a real bugfix but only for V1 runner. This fixes the drafter layout cache and increases the accept rate from 51% to 63%, same as V2 runner.

Validation

Reproduced on two Sparks. I did several end-to-end experiments using DeepSeek-v4-Flash and ensured that the tokens output is the same.

No performance regression is observed, and I confirm the VRAM savings and draft acceptance rate benefits.

Details

See above.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

…caches

- mHC: DeepseekV4Model's layer loop lets the unfused mHC post/pre
  (T > 32) write the next residual into the dead input residual instead of
  allocating a new [T, hc_mult, hidden] bf16 buffer. Outputs are
  bit-identical; the registered custom op is unchanged.
- DeepSeek V4/V4.1: skip the pre-hc_head _mtp_hidden_buffer for DSpark,
  which drafts from the target's aux hidden states.
- MRV1 drafter: drop the cached token->request mapping and
  num_computed_tokens after the in-place layout/seq_lens rewrites and in
  extend_all_queries_by_N, so builders inside the draft loop see the
  current layout.

Salvaged from vllm-project#41834.

Co-authored-by: alexbi29 <alexbi29@users.noreply.github.com>
Co-authored-by: jasl <jasl9187@hotmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: lazymio <mio@lazym.io>

@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.

@mergify mergify Bot added deepseek Related to DeepSeek models DSv4 DSv4.1 Related to DeepSeek-V4.1 models cpu Related to CPU backends speculative-decoding labels Oct 27, 2026
@Harry-Chen Harry-Chen added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

✅ @wtdcode, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • Run commands test your branch with every commit currently on its upstream target branch. If it is behind, the bot merges the target branch into it first (pull before pushing again). Append --allow-stale to a run command to test an outdated branch as is, at your own risk.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@Harry-Chen

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #97559 for commit 1da372df286a.

@Harry-Chen Harry-Chen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the improvement!

@Harry-Chen
Harry-Chen merged commit e7fa26d into vllm-project:main Oct 27, 2026
178 of 180 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cpu Related to CPU backends deepseek Related to DeepSeek models DSv4 DSv4.1 Related to DeepSeek-V4.1 models ready ONLY add when PR is ready to merge/full CI is needed speculative-decoding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants