Skip to content

[Bugfix] Fix DeepSeek V4 MTP HC state handling - #42320

Merged
WoosukKwon merged 2 commits into
vllm-project:mainfrom
mmangkad-dev:fix-dsv4-mtp-hc-state
May 13, 2026
Merged

[Bugfix] Fix DeepSeek V4 MTP HC state handling#42320
WoosukKwon merged 2 commits into
vllm-project:mainfrom
mmangkad-dev:fix-dsv4-mtp-hc-state

Conversation

@mmangkad

Copy link
Copy Markdown
Contributor

Purpose

Fix the DeepSeek V4 MTP path after #41536 changed DeepseekV4DecoderLayer.forward to take post_mix, res_mix, and residual. The main model path was updated, but the MTP draft layer still used the old call and failed at startup/profile run. Key error lines:

TypeError: missing required positional argument: post_mix

torch._dynamo.exc.Unsupported: failed to bind arguments when attempting to inline
  Explanation: Argument mismatch when attempting to trace function forward.
  Developer debug context: func='forward' /root/vllm-workspace/vllm/model_executor/models/deepseek_v4.py:1201; args = [<class 'vllm.model_executor.models.deepseek_v4.DeepseekV4DecoderLayer'>]; kwargs = {'positions': TensorVariable(), 'x': TensorVariable(), 'input_ids': ConstantVariable(NoneType: None)}

This updates the MTP call site and fixes the DeepseekV4DecoderLayer.forward return annotation.

Before this fix, DeepSeek V4 with MTP failed to start. After this fix, it starts successfully.

cc @WoosukKwon

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
(cherry picked from commit 245c137)

@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 bug Something isn't working labels May 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the DeepSeek-V4 model implementation by modifying the forward method in deepseek_v4.py to return a tuple of four tensors instead of a single tensor. In deepseek_v4_mtp.py, the mtp_block call is updated to unpack these four values, which are then passed to a new hc_post call. I have no feedback to provide as there were no review comments.

Comment thread vllm/model_executor/models/deepseek_v4.py Outdated
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
@leihuang-sketch

Copy link
Copy Markdown

LGTM

Accuracy is aligned

┌───────────────────┬───────────┬──────────┬──────────┬───────┬─────────┬─────────┐
│ Model             │ Dataset   │ Metric   │ Subset   │   Num │   Score │ Cat.0   │
├───────────────────┼───────────┼──────────┼──────────┼───────┼─────────┼─────────┤
│ DeepSeek-V4-Flash │ gsm8k     │ mean_acc │ main     │  1319 │  0.9689 │ default │
└───────────────────┴───────────┴──────────┴──────────┴───────┴─────────┴─────────┘

2026-05-12 14:13:44 - evalscope - INFO: Skipping report analysis (`analysis_report=False`).
2026-05-12 14:13:44 - evalscope - INFO: Dump report to: ./outputs/20260512_140024/reports/DeepSeek-V4-Flash/gsm8k.json

2026-05-12 14:13:44 - evalscope - INFO:
gsm8k perf table:
Model              Dataset      Num    Avg Lat  Avg TTFT    Avg TPOT      Avg Thpt    Avg In    Avg Out
                                           (s)  (ms)        (ms)           (tok/s)       Tok        Tok
-----------------  ---------  -----  ---------  ----------  ----------  ----------  --------  ---------
DeepSeek-V4-Flash  gsm8k       1319     0.6041  -           -               225.48   582.951    136.215

@WoosukKwon WoosukKwon added the ready ONLY add when PR is ready to merge/full CI is needed label May 13, 2026

@WoosukKwon WoosukKwon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR!

@WoosukKwon
WoosukKwon merged commit f1cc7aa into vllm-project:main May 13, 2026
62 checks passed
@mmangkad
mmangkad deleted the fix-dsv4-mtp-hc-state branch May 14, 2026 02:34
khluu pushed a commit that referenced this pull request May 15, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
(cherry picked from commit f1cc7aa)
mfylcek pushed a commit to mfylcek/vllm that referenced this pull request May 19, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
rishitdholakia13 pushed a commit to rishitdholakia13/vllm that referenced this pull request May 19, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
jhu960213 pushed a commit to jhu960213/vllm that referenced this pull request May 20, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
h1t35h pushed a commit to h1t35h/vllm that referenced this pull request May 21, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
knight0528 pushed a commit to knight0528/vllm that referenced this pull request Jun 8, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
philippesic pushed a commit to philippesic/vllm-semantic-cache that referenced this pull request Jul 19, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working deepseek Related to DeepSeek models ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants