-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Feature] Eagle Chunked Prefill Support #14922
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Bryan Lu <yuzhelu@amazon.com>
👋 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 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 🚀 |
Signed-off-by: Bryan Lu <yuzhelu@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would like to note here that the original code has a bug. speculative_model
is the directory of the draft model, not the type of it.
Signed-off-by: pyc96 <pychen96@gmail.com>
Signed-off-by: Bryan Lu <yuzhelu@amazon.com>
@LiuXiaoxuanPKU @WoosukKwon also added a missed corner case of the refactoring in #14434 to decide the method of the speculative model (for EAGLE, we should also check for model_type). |
This PR extends #10132 and adds chunked prefill support for EAGLE. The complexity involves two main aspects:
Deal with mixed batch scenarios: when chunked prefill is not enabled, vllm's scheduler prioritizes prefill requests and doesn’t put prefill and decode to the same batch. With chunked prefill, we will need to deal with mixed batches and in particular, preserve prefill hidden states from target model for EAGLE (in
vllm/spec_decode/batch_expansion.py
,vllm/spec_decode/interfaces.py
), and prefill EAGLE model properly (invllm/spec_decode/spec_decode_worker.py
).Save and pass around last token's hidden states in non-terminal chunks: unlike Medusa, EAGLE utilizes hidden states of all previous tokens. This means the last token's hidden states in a non-terminal chunks has to be preserved. To this end, I register a new attribute to SamplerOutput called
non_terminal_hidden_states
as invllm/model_executor/layers/sampler.py
. I extract these non_terminal_hidden_states in both prefill and (mixed-batch) decoding stage as invllm/spec_decode/spec_decode_worker.py
. The function used to extract those hidden states is invllm/spec_decode/util.py
. Finally, since these non-terminal hidden states might be needed when prefilling the current chunk, I extendedprepare_prefill_hidden_states
to take in these hidden states when preparing the prefill hidden states.Limitation: the current implementation only supports batch expansion scorer.
cc @LiuXiaoxuanPKU @comaniac Would appreciate your review. Thanks!