Skip to content

[Model] vllm v1 support mlp_speculator#21276

Open
skylee-01 wants to merge 8 commits intovllm-project:mainfrom
skylee-01:spport-mlpspeculator-v1
Open

[Model] vllm v1 support mlp_speculator#21276
skylee-01 wants to merge 8 commits intovllm-project:mainfrom
skylee-01:spport-mlpspeculator-v1

Conversation

@skylee-01
Copy link
Copy Markdown
Contributor

@skylee-01 skylee-01 commented Jul 21, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

vllm v1 support mlp_speculator

Test Plan

Test Result

(Optional) Documentation Update

Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
@github-actions
Copy link
Copy Markdown

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

🚀

Copy link
Copy Markdown
Contributor

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

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 adds support for the mlp_speculator speculative decoding method in vLLM's v1 architecture. The changes include a new proposer implementation for v1, modifications to the core MLPSpeculator model to support being used as a draft model, and integration into the GPUModelRunner. My review has identified several critical issues in the new implementation related to incorrect logic for processing proposal tokens, a crash in the dummy_run due to a missing argument, and flawed logic in the modified MLPSpeculator model. These issues need to be addressed to ensure correctness and prevent runtime errors.

Signed-off-by: lisiqi23 <lisiqi23@xiaomi.com>
@skylee-01 skylee-01 requested a review from DarkLight1337 as a code owner July 21, 2025 04:30
@mergify mergify bot added the new-model Requests to new models label Jul 21, 2025
@skylee-01
Copy link
Copy Markdown
Contributor Author

The content is updated to the new PR, and the old PR is discarded.
#20655

Signed-off-by: skylee-01 <497627264@qq.com>
@skylee-01
Copy link
Copy Markdown
Contributor Author

Use the following script to test:
Base model: 39.80 s
mlp_speculator: 30.03 s
The acceleration of speculative sampling is obvious.

# -*- coding: utf-8 -*-
import sys
import os

os.environ["VLLM_USE_V1"] = "1" 

custom_vllm_path = '/path/to/your/vllm' 
if custom_vllm_path not in sys.path:
   sys.path.insert(0, custom_vllm_path)


 
from vllm import LLM, SamplingParams

prompts = [
 "1+1= ",
]

sampling_params = SamplingParams(temperature=0, max_tokens=20)

model = "/path/to/your/model/Meta-Llama-3.1-8B-Instruct"  # Please replace with your model path

llm = LLM(
    model=model,
    enforce_eager=True,
    max_model_len=3000,
    gpu_memory_utilization=0.9,
    tensor_parallel_size=1,
    speculative_config={
        "method": "mlp_speculator",
        "model": "/path/to/your/speculative/model/llama3-8b-accelerator/",  # Please replace with your speculative model path
        "draft_tensor_parallel_size": 1,
        "num_speculative_tokens": 2,
    },
)

import time
t1 = time.time()
for i in range(100):
    print("************************************************")    
    outputs = llm.generate(prompts, sampling_params)
    for output in outputs:
        answer = output.outputs[0].text
        print(f"answer:{answer}")
print("time:", time.time() - t1)

@skylee-01
Copy link
Copy Markdown
Contributor Author

I've increased the tests and updated the code to the latest vllm version.
@WoosukKwon

@skylee-01
Copy link
Copy Markdown
Contributor Author

Thanks for reviewing the code, teacher. @WoosukKwon

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Oct 22, 2025
@github-actions
Copy link
Copy Markdown

This pull request has been automatically closed due to inactivity. Please feel free to reopen if you intend to continue working on it. Thank you!

@github-actions github-actions bot closed this Nov 22, 2025
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

Can you rebase this PR? I can help you merge it if the tests pass.

Sorry for the delay, seems @WoosukKwon is too busy these days.

@njhill
Copy link
Copy Markdown
Member

njhill commented Nov 22, 2025

We may want to check whether this is still relevant first. I'm unsure whether MLPSpeculator models are still used.

@skylee-01
Copy link
Copy Markdown
Contributor Author

Can you rebase this PR? I can help you merge it if the tests pass.

Sorry for the delay, seems @WoosukKwon is too busy these days.

Of course, I would be very happy to do this job if needed.

@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Nov 24, 2025
@mergify
Copy link
Copy Markdown

mergify bot commented Nov 24, 2025

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

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 Nov 24, 2025
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added stale Over 90 days of inactivity and removed unstale Recieved activity after being labelled stale labels Feb 23, 2026
@hmellor
Copy link
Copy Markdown
Member

hmellor commented Mar 4, 2026

The lack of interest suggests that we should close this PR and potentially remove MLPSpeculator completely?

@DarkLight1337
Copy link
Copy Markdown
Member

Yeah sure

@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Mar 5, 2026
@mergify
Copy link
Copy Markdown

mergify bot commented Mar 5, 2026

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

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

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

Labels

needs-rebase new-model Requests to new models speculative-decoding unstale Recieved activity after being labelled stale v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants