Skip to content

[Bugfix] mtp forces eager mode - #6760

Merged
MengqingCao merged 2 commits into
vllm-project:releases/v0.13.0from
zhenwenqi2024:releases/v0.13.0
Feb 27, 2026
Merged

MengqingCao merged 2 commits into
vllm-project:releases/v0.13.0from
zhenwenqi2024:releases/v0.13.0

Conversation

@zhenwenqi2024

@zhenwenqi2024 zhenwenqi2024 commented Feb 14, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

in mtp_proposer, we set self.use_cuda_graph false in mtp, becasuse async_scheduler is set true in default, mtp dose not need aclgraph. otherwise, in piecewise ,mtp need aclgraph too, it will change some unexpected errors.

Does this PR introduce any user-facing change?

NA

How was this patch tested?

Signed-off-by: zhenwenqi2024 <zhenwenqi_2022@qq.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @zhenwenqi2024, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug within the mtp method's configuration, which was inadvertently enabling CUDA graphs and thereby forcing an eager execution mode. The change ensures that the mtp method correctly disables CUDA graphs, allowing it to function as designed without unintended performance or behavioral implications related to eager execution.

Highlights

  • Bugfix for MTP method: Resolved an issue where the mtp method was implicitly forcing eager mode due to incorrect CUDA graph usage.
  • CUDA Graph Disablement: Explicitly set use_cuda_graph to False when the mtp method is active, ensuring it operates as intended without CUDA graphs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • vllm_ascend/spec_decode/eagle_proposer.py
    • Disabled CUDA graph usage for the mtp method to prevent unintended eager mode enforcement.
Activity
  • No activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@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 disables CUDA graph for MTP speculative decoding. This is a valid bugfix that forces MTP to run in eager mode, addressing potential issues with graph mode. However, this change introduces a significant amount of now-unreachable code related to graph mode in vllm_ascend/spec_decode/mtp_proposer.py. This dead code should be removed in a follow-up pull request to improve maintainability.

Additionally, the pull request title and description do not follow the repository's style guide. Here are the suggested updates:

Suggested PR Title:

[SpecDecode][BugFix] Force eager mode for MTP

Suggested PR Summary:

### What this PR does / why we need it?
This PR fixes a bug where MTP (Multi-Token Prediction) speculative decoding was not correctly forced into eager mode, leading to issues when CUDA graph was enabled.

The change disables CUDA graph (`use_cuda_graph = False`) for the MTP method unconditionally within `EagleProposer`. Previously, it was only disabled when asynchronous scheduling was active. This ensures MTP always runs in eager mode, preventing potential correctness or performance issues with graph mode.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
CI passed. The correctness of MTP is validated by existing tests, such as `test_deepseek_mtp_correctness`, which will now run in eager mode for MTP as intended by this fix.

and not self.vllm_config.speculative_config.enforce_eager)
if self.method == "mtp":
self.use_cuda_graph = self.use_cuda_graph and not self.use_async_scheduling
self.use_cuda_graph = False

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.

high

By setting use_cuda_graph to False for MTP, a significant amount of code in the MtpProposer class (in vllm_ascend/spec_decode/mtp_proposer.py) becomes dead code. Specifically, all logic conditioned on aclgraph_runtime_mode == CUDAGraphMode.FULL or forward_context.cudagraph_runtime_mode == CUDAGraphMode.FULL is now unreachable.

To improve code maintainability, this dead code should be removed. Please consider creating a follow-up PR to refactor MtpProposer and clean up the now-unnecessary graph-related logic.

@zhenwenqi2024

Copy link
Copy Markdown
Collaborator Author

/ready

@MengqingCao
MengqingCao merged commit cf1ca7c into vllm-project:releases/v0.13.0 Feb 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants