Skip to content

[Bugfix][MoE] Keep routing rows during DeepSeek V4.1 decoder replay - #61643

Merged
aoshen02 merged 4 commits into
vllm-project:mainfrom
Ronald1995:codex/fix-routed-experts-decoder-replay
Oct 15, 2026
Merged

aoshen02 merged 4 commits into
vllm-project:mainfrom
Ronald1995:codex/fix-routed-experts-decoder-replay

Conversation

@Ronald1995

Copy link
Copy Markdown
Collaborator

Overview

Keep every prefill routing row when DeepSeek V4.1 decoder replay runs with returned routed experts enabled. Extracted from #61388 as a standalone fix based on main.

Claims

  • R3 requests use the existing prompt-logprobs keep-row mechanism so decoder replay does not omit their routing computations.
  • Cover eager and PIECEWISE replay in the existing replay-batch suite.
  • The diff contains the request row-retention policy and its regression coverage in two files.

Validation

  • 20 isolated CPU policy cases passed using the actual request-admission, graph-selection, and replay row-selection methods with real CPU tensors. The same checks against unmodified main reproduce 6 failures / 14 passes, including a 300-row prefill incorrectly reduced to 128 rows.
  • Applicable pre-commit hooks, including mypy and Buildkite test tethering, and git diff --check: passed with local UTF-8/Git Bash interpreter adaptations.
  • The pre-split [Bugfix][MoE] Restore TP-sharded routed-expert capture for DP=1 #61388 validation recorded real-weight DeepSeek-V4.1 TP1/DP2/EP, 300/301-token prefill: late layers previously executed only 128 rows; the keep-row fix retained all rows in all 40 layers. The request-retention change is preserved from that combined revision.

GPU/model runs were not repeated for the split. CPU checks stop at the row-selection boundary and substitute configuration/base-state/input-gather fixtures; they do not validate CUDA kernels or attention numerics. The GPU regression remains in the existing CI-tethered suite:

.venv/bin/python -m pytest -q tests/models/test_deepseek_v41_replay_batch.py

Details

Decoder replay can normally skip older prefill rows when only final logits are needed. Returned routing needs every accepted token's decisions; scattering the remaining rows cannot recover computations that never ran. Mark R3 requests as requiring every row when admitted, using the existing keep-row policy.

R3-enabled replay therefore retains prefill work that could otherwise be trimmed. No throughput measurement is claimed.

Duplicate-work checks refreshed open PR searches for 61388 in:body, routed-expert capture, and decoder replay. #52902 adds API consistency tests, #57184 handles DBO staging/offsets, and #56778 implements terminal transport; they do not implement this NVIDIA V4.1 admission policy. The same fix has been removed from #61388, so this is its single review location.

AI assistance was used to split and validate the existing fix.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill.
  • AI assistance was used during the creation of this PR.
  • Design Fit: Reuses existing mechanisms and keeps the fix scoped.
  • Testing and Validation: Focused regression checks passed; validation limits are stated above.
  • Code Quality and Style: Applicable pre-commit checks, including mypy, and diff checks passed.
  • Pull Request Contents: Root cause, duplicate-work checks, evidence, and AI assistance are disclosed.

Retain every prompt row when routed-expert output is enabled. Decoder
replay cannot recover routing decisions for rows whose computation was
omitted, so reuse the prompt-logprobs keep-row policy.

Extend the existing replay batch tests for eager and PIECEWISE execution.

Validation: isolated CPU admission and row-selection checks reproduced
six failures on main and passed all twenty cases with the fix. Applicable
pre-commit checks passed. GPU/model runs were not repeated for this split.

Signed-off-by: Ronald1995 <ronaldautomobile@163.com>
@mergify mergify Bot added deepseek Related to DeepSeek models DSv4.1 Related to DeepSeek-V4.1 models bug Something isn't working labels Oct 14, 2026
@Ronald1995
Ronald1995 marked this pull request as ready for review October 15, 2026 04:42

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

@Ronald1995 Ronald1995 added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 15, 2026
@github-actions

Copy link
Copy Markdown

✅ @Ronald1995, 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.

@Ronald1995

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #95029 for commit c0312d70a2b5.

@Ronald1995

Copy link
Copy Markdown
Collaborator Author

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 1 failed job(s) for retry in Buildkite CI #95029.

@aoshen02
aoshen02 enabled auto-merge (squash) October 15, 2026 07:42
@Ronald1995

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

❌ This PR is 7 commits behind upstream main. The bot could not merge upstream main into this branch (API returned 403: user doesn't have permission to update head repository). No new CI build was started. Either merge or rebase onto the latest main yourself and rerun /ci run, or use /ci run --allow-stale to test this branch as is.

@Ronald1995

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #95089 for commit 6a00a6971b14.

@aoshen02
aoshen02 merged commit d12d546 into vllm-project:main Oct 15, 2026
95 checks passed
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 DSv4.1 Related to DeepSeek-V4.1 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.

2 participants