Skip to content

Conversation

ruisearch42
Copy link
Collaborator

@ruisearch42 ruisearch42 commented May 5, 2025

I'd like to first address the main logic and correctness, and then the following TODOs:

  • Further unify the EAGLE and MTP code paths
  • Currently there are duplicate or unused code logic, clean it up
  • Currently there are hard coded tests etc., clean it up

The main challenge is that we need to prepare MLA attention metadata, instead of flash attention metadata, and may need to refactor related code.

Signed-off-by: Rui Qiao <ruisearch42@gmail.com>
Copy link

github-actions bot commented May 5, 2025

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@ruisearch42 ruisearch42 changed the title [V1] MTP Support Prototype [V1][Prototype] MTP Support May 5, 2025
@WoosukKwon
Copy link
Collaborator

@ruisearch42 Any update on this PR? I think the overall direction is good, while we can probably share more code with the eagle proposer.

Copy link

mergify bot commented May 10, 2025

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

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 May 10, 2025
@yeqcharlotte yeqcharlotte requested a review from luccafong May 12, 2025 15:43
)

with set_forward_context(attn_metadata, self.vllm_config):
hidden_states = self.model(
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this for single layer prototype?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes. I think DeepSeek only released one layer of weights for MTP. This can be extended to run multiple times as a follow up.

num_tokens_per_req = query_len_per_req - num_rejected_tokens

cu_num_tokens = torch.empty_like(cu_target_query_lens)
torch.cumsum(num_tokens_per_req, dim=0, out=cu_num_tokens[1:])
Copy link
Collaborator

Choose a reason for hiding this comment

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

shall we move this into triton as well?


# TODO(woosuk): Consider seeds.
q = torch.empty_like(probs)
q.exponential_()
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious why we have separate sampling logic here for MTP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

needs to be cleaned up

# SPDX-License-Identifier: Apache-2.0
import torch
import torch.nn as nn
import triton
Copy link
Contributor

@MengqingCao MengqingCao May 14, 2025

Choose a reason for hiding this comment

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

Directly import triton is not recommended in vllm to make non-triton devices work. I suggest merge this pr after #17716 . cc @mgoin

@ruisearch42
Copy link
Collaborator Author

Done in #18435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants