Skip to content

[V1][eagle3] Support eagle3 proposer for v1 #1032

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 2 commits into from
Jun 20, 2025

Conversation

yuancaoyaoHW
Copy link
Contributor

@yuancaoyaoHW yuancaoyaoHW commented May 30, 2025

What this PR does / why we need it?

This PR implements the Eagle Pososer feature for vLLM v1, which enables more efficient speculative decoding by using a draft model to predict potential future tokens.

  • The implementation includes the core Eagle algorithm integration with vLLM's existing architecture, allowing for faster inference while maintaining output quality.
  • This is needed to significantly improve the generation speed of large language models without compromising on the quality of generated text.

Does this PR introduce any user-facing change?

Yes, this PR introduces a new speculative decoding mode that can be enabled via configuration.

  • Users can now choose to use Eagle Pososer by setting appropriate flags in the inference configuration.
  • The API remains backward compatible, with the new functionality being opt-in.

How was this patch tested?

CI passed with new unit tests added for the Eagle Pososer functionality.

  • Benchmark tests were conducted comparing generation speed and quality with and without Eagle Pososer.
  • Integration tests were performed with various model architectures to ensure compatibility.
  • Manual testing was done using different prompt scenarios to verify output quality remains consistent.
  • we test accept rate on one Ascend 910B npu, The acceptance rate results are basically consistent with those shown here: [V1][Spec Decode] EAGLE-3 Support vllm#16937
  • Currently, we support scenarios where num_spec_tokens <= 2. When num_spec_tokens > 2, issues such as insufficient GPU memory and operator computation errors may occur. We will address this in subsequent updates.
  • We will add support for Eagle v1 in future updates.

Acceptance Test Script

SCRIPT="/offline/eagle.py"
DATASET="ShareGpt"
MODEL=Meta-Llama-3.1-8B-Instruct
DRAFT=EAGLE3-LLaMA3.1-Instruct-8B

CUDA_VISIBLE_DEVICES="0" VLLM_USE_V1=1 $PYTHON $SCRIPT \
    --dataset $DATASET \
    --num_spec_tokens 2 \
    --max_num_seqs 1 \
    --model_dir $MODEL \
    --eagle_dir $DRAFT \
    --tp 1 \
    --num_prompts 80

Acceptance Test Results

██████████████████████████████████████████████████████████████████████████████████████████████████████████| 80/80 [21:22<00:00, 16.03s/it, est. speed input: 4.72 toks/s, output: 13.56 toks/s]
-------------------------------------------------------------------------------------
mean acceptance length: 1.63
-------------------------------------------------------------------------------------
total_counts: 8062
acceptance at token 0: 1.00 (8062 times)
acceptance at token 1: 0.70 (5612 times)
acceptance at token 2: 0.47 (3765 times)

Closes: #1004

@Yikun
Copy link
Collaborator

Yikun commented May 30, 2025

Thansk for contributions, you can git commit --amend -s amend the singned off by info and git push origin vllm-eagle3 -f

@Yikun Yikun requested a review from mengwei805 May 30, 2025 07:28
@yuancaoyaoHW yuancaoyaoHW changed the title Basie eagle3 proposer Basie eagle3 proposer for v1 May 30, 2025
@Yikun
Copy link
Collaborator

Yikun commented May 30, 2025

Thanks for your contributions.

  1. Please add How was this patch tested? in commit msh including vllm server or script to help others reproduce locally
  2. Please change code note to english
  3. Add e2e test: https://github.com/vllm-project/vllm-ascend/tree/main/tests/long_term/spec_decode/e2e , you can reference: https://github.com/vllm-project/vllm/blob/main/tests/spec_decode/e2e/test_eagle_correctness.py
  4. Fix mypy and lint CI, you can refernece: https://vllm-ascend.readthedocs.io/en/latest/developer_guide/contributing.html

Copy link

github-actions bot commented Jun 3, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@yuancaoyaoHW yuancaoyaoHW force-pushed the vllm-eagle3 branch 4 times, most recently from edf2424 to 1c6ed70 Compare June 4, 2025 01:26
@yuancaoyaoHW yuancaoyaoHW changed the title Basie eagle3 proposer for v1 Support eagle3 proposer for v1 Jun 4, 2025
Copy link

github-actions bot commented Jun 5, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@yuancaoyaoHW yuancaoyaoHW changed the title Support eagle3 proposer for v1 [V1][eagle3]Support eagle3 proposer for v1 Jun 5, 2025
@yuancaoyaoHW yuancaoyaoHW force-pushed the vllm-eagle3 branch 2 times, most recently from df84c06 to 9a4371e Compare June 5, 2025 09:48
@@ -0,0 +1,429 @@
# SPDX-License-Identifier: Apache-2.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

please revise file header.
I think this file should be placed in the woker directory instead of creating a new spec_decode directory. @wangxiyuan

# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Copy link
Collaborator

@mengwei805 mengwei805 Jun 6, 2025

Choose a reason for hiding this comment

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

make sure this UT could run in v1 engine when CI running.
The UT in the current long_term directory is run by the v0 engine by default.
You can refer to test_v1_spec_decode.py or test_v1_mtp_correctness.py.
You may also have to modify .github/workflows/vllm_ascend_test_long_term.yaml

Copy link

github-actions bot commented Jun 6, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@Yikun Yikun added ready-for-test start test by label for PR and removed ready-for-test start test by label for PR labels Jun 17, 2025
@MengqingCao MengqingCao added ready-for-test start test by label for PR and removed ready-for-test start test by label for PR labels Jun 18, 2025
@Yikun Yikun added ready-for-test start test by label for PR ready read for review and removed ready-for-test start test by label for PR labels Jun 18, 2025
@wangxiyuan
Copy link
Collaborator

@jianzs @ganyi1996ppo @Yikun please help review.

@github-actions github-actions bot added merge-conflicts and removed ready read for review labels Jun 19, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: yuancaoyaoHW <[email protected]>
@Yikun Yikun added ready-for-test start test by label for PR and removed ready-for-test start test by label for PR labels Jun 20, 2025
@Yikun
Copy link
Collaborator

Yikun commented Jun 20, 2025

I'm OK with this PR, I trend to merge this today.

@MengqingCao
Copy link
Collaborator

@Yikun Yikun mentioned this pull request Jun 20, 2025
29 tasks
@Yikun Yikun changed the title [V1][eagle3]Support eagle3 proposer for v1 [V1][eagle3] Support eagle3 proposer for v1 Jun 20, 2025
@wangxiyuan wangxiyuan merged commit 00ae250 into vllm-project:main Jun 20, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long-term-test enable long term test for PR module:tests ready-for-test start test by label for PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Implement Eagle3 Acceleration on vllm-ascend
8 participants