Skip to content

[Config] add "qwen" as a native eagle3 target supported model #22333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 10, 2025

Conversation

lec77
Copy link
Contributor

@lec77 lec77 commented Aug 6, 2025

Purpose

Add "qwen" to the eagle3_target_supported model list in config.py, so that Qwen models can run with Eagle3 by setting speculative_config.
Previously, "qwen" was only enabled for Eagle3 when draft_model_config was provided with SpeculatorsConfig.

The architectures of Qwen3-Eagle3 drafter models listed in EAGLE project are all LlamaForCausalLMEagle3:

This needs to be added to the model registry for compatibility.

Test Plan

  • Run Eagle3 inference with a "qwen" model without Speculatorsconfig (Qwen/Qwen3-8B + AngelSlim/Qwen3-8B_eagle3).
  • Confirm that the model loads successfully and speculative decoding works as intended.

Test Result

total_num_output_tokens: 1000
num_drafts: 352
num_draft_tokens: 1056
num_accepted_tokens: 680
mean acceptance length: 2.93
--------------------------------------------------
acceptance at token 0: 1.00
acceptance at token 1: 0.62
acceptance at token 2: 0.31

@lec77 lec77 changed the title config: add "qwen" as a native eagle3 target supported model [Config] add "qwen" as a native eagle3 target supported model Aug 6, 2025
@mergify mergify bot added the qwen Related to Qwen models label Aug 6, 2025
Copy link
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 'qwen' to the list of natively supported target models for Eagle3 speculative decoding. The change simplifies the configuration logic by removing a conditional check that previously enabled Qwen support only when a SpeculatorsConfig was used. The updated code is more direct and improves maintainability. Based on the provided description and test results, this change appears correct and aligns with the goal of broader model support for Eagle3. I have no major concerns with this change.

Copy link

github-actions bot commented Aug 6, 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.

🚀

@hmellor
Copy link
Member

hmellor commented Aug 6, 2025

Could you please share the command used for testing?

@mergify mergify bot added the v1 label Aug 6, 2025
@lec77
Copy link
Contributor Author

lec77 commented Aug 6, 2025

Sure!
I ran the tests using the following command:

pytest test_spec_decode.py -v -k qwen3_eagle3

The acceptance_rate and related metrics were obtained by calling spec_llm.get_metrics() and computing the statistics:

try:
    metrics = spec_llm.get_metrics()
except AssertionError:
    print("Metrics are not supported in the V0 engine.")
    return

total_num_output_tokens = sum(
    len(output.outputs[0].token_ids) for output in spec_outputs
)
num_drafts = 0
num_draft_tokens = 0
num_accepted_tokens = 0
acceptance_counts = [0] * 3
for metric in metrics:
    if metric.name == "vllm:spec_decode_num_drafts":
        assert isinstance(metric, Counter)
        num_drafts += metric.value
    elif metric.name == "vllm:spec_decode_num_draft_tokens":
        assert isinstance(metric, Counter)
        num_draft_tokens += metric.value
    elif metric.name == "vllm:spec_decode_num_accepted_tokens":
        assert isinstance(metric, Counter)
        num_accepted_tokens += metric.value
    elif metric.name == "vllm:spec_decode_num_accepted_tokens_per_pos":
        assert isinstance(metric, Vector)
        for pos in range(len(metric.values)):
            acceptance_counts[pos] += metric.values[pos]

print("-" * 50)
print(f"total_num_output_tokens: {total_num_output_tokens}")
print(f"num_drafts: {num_drafts}")
print(f"num_draft_tokens: {num_draft_tokens}")
print(f"num_accepted_tokens: {num_accepted_tokens}")
acceptance_length = 1 + (num_accepted_tokens / num_drafts) if num_drafts > 0 else 1
print(f"mean acceptance length: {acceptance_length:.2f}")
print("-" * 50)

# print acceptance at each token position
for i in range(len(acceptance_counts)):
    acceptance_rate = acceptance_counts[i] / num_drafts if num_drafts > 0 else 0
    print(f"acceptance at token {i}: {acceptance_rate:.2f}")

Copy link
Member

@hmellor hmellor left a comment

Choose a reason for hiding this comment

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

Thanks for adding the test, LGTM as long as the relevant tests pass. (Please merge from main to resolve some of the unrelated errors)

@hmellor
Copy link
Member

hmellor commented Aug 7, 2025

Can you make sure pre-commit passes?

@mergify mergify bot added documentation Improvements or additions to documentation ci/build labels Aug 7, 2025
@mergify mergify bot added frontend multi-modality Related to multi-modality (#4194) performance Performance-related issues labels Aug 7, 2025
@lec77
Copy link
Contributor Author

lec77 commented Aug 7, 2025

Sorry, I am not familiar with the process. I will fix it.

@hmellor hmellor enabled auto-merge (squash) August 7, 2025 13:08
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 7, 2025
Copy link

mergify bot commented Aug 8, 2025

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

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 Aug 8, 2025
auto-merge was automatically disabled August 8, 2025 02:53

Head branch was pushed to by a user without write access

@mergify mergify bot added new-model Requests to new models speculative-decoding labels Aug 8, 2025
@mergify mergify bot removed the needs-rebase label Aug 8, 2025
@DarkLight1337
Copy link
Member

Sorry there is merge conflict again, can you resolve it?

@vllm-bot vllm-bot merged commit 3d7363e into vllm-project:main Aug 10, 2025
35 of 43 checks passed
@DarkLight1337
Copy link
Member

Looks like https://buildkite.com/vllm/ci/builds/26496/steps/canvas?sid=0198934d-abd0-4623-ac97-7ab5f3be8cfc is caused by this PR, can you fix it?

noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 10, 2025
@lec77
Copy link
Contributor Author

lec77 commented Aug 11, 2025

Thanks for pointing this out. I’ll submit a fix in a follow-up PR.

Looks like https://buildkite.com/vllm/ci/builds/26496/steps/canvas?sid=0198934d-abd0-4623-ac97-7ab5f3be8cfc is caused by this PR, can you fix it?

@DarkLight1337
Copy link
Member

See #22611

jingyu-ml pushed a commit to jingyu-ml/vllm that referenced this pull request Aug 11, 2025
yyihuang pushed a commit to yyihuang/vllm that referenced this pull request Aug 11, 2025
aarnphm pushed a commit to aarnphm/vllm that referenced this pull request Aug 13, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
taneem-ibrahim pushed a commit to taneem-ibrahim/vllm that referenced this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation frontend multi-modality Related to multi-modality (#4194) new-model Requests to new models performance Performance-related issues qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed speculative-decoding v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants