-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
[V1][Spec Decode] Implement Eagle Proposer [1/N] #15729
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
Conversation
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
👋 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: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
vllm/v1/spec_decode/eagle.py
Outdated
logits.div_(sampling_metadata.temperature) | ||
probs = logits.softmax(dim=-1, dtype=torch.float32) | ||
|
||
# TODO(woosuk): Consider seeds? |
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.
I'm not sure seeds will work with conditional speculation and rejection sampling? :(
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.
Added TODO. I'd like to defer this to a future PR because 1) the sampling code in the PR needs some refactoring anyways, and 2) handling RNG in spec decoding is quite tricky, so I need more time to think more about it.
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
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.
Overall looks good to me, just have some questions. Also, we might want some tests for this PR? Maybe move some from #15346 if possible?
vllm/v1/spec_decode/eagle.py
Outdated
probs = logits.softmax(dim=-1, dtype=torch.float32) | ||
|
||
# TODO(woosuk): Consider seeds? | ||
q = torch.empty_like(logits) |
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.
At least we need to enable seed for reproducibility? i.e., the draft head proposes the same token when seeded.
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.
Added TODO. I'd like to defer this to a future PR because 1) the sampling code in the PR needs some refactoring anyways, and 2) handling RNG in spec decoding is quite tricky, so I need more time to think more about it.
Signed-off-by: Woosuk Kwon <[email protected]>
@njhill @LiuXiaoxuanPKU @sroy745 Thanks for the reviews. Because the integration of EAGLE involves a lot of changes, I tried to break it down to smaller steps. This PR is the first step to establish the high-level design, so I intentionally left many TODOs and FIXMEs. The next steps should be:
I don't think I have bandwidth for all of these, so it'd be nice if we can get some helps from the community. |
Sounds good. I am happy to take 2 since I already start thinking about it. Let me create issues for 1,3,4,5,6 and move some of them to onboarding tasks. |
@LiuXiaoxuanPKU Can you please take 1 as well? |
Sure, will give a try today |
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.
LGTM. One small comment.
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.
LGTM.
This pull request has merge conflicts that must be resolved before it can be |
# Common case. | ||
next_token_id = token_ids[-1] | ||
else: | ||
# Partial prefill (rare case). |
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.
Is this corresponding to this case when we had to backtrack a bit so that we can have ensure we have num_computed_tokens as a multiple of the block size?
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.
Or this handles chunked context?
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.
this is for chunked context, eagle needs the next_token_id as the input. In the decoding phase, next token id is the last generated token id. In the chunked prefill case, it's the next token id of the current chunk.
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
@v-lmn can you share how you ran this code? My understanding is that this code is not finished and cannot be executed until the futher PRs adding missing functionality in eagle |
Signed-off-by: Woosuk Kwon <[email protected]> Signed-off-by: xinyuxiao <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]> Signed-off-by: Louis Ulmer <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]> Signed-off-by: Mu Huai <[email protected]>
Efficient implementation based upon #15346
NOTE1: I intentionally used a dummy model instead of the real eagle models to reduce the scope of the PR.
NOTE2: Currently, I intentionally ignored all sampling parameters except the temperature when sampling the draft tokens.
The reason being is,
cc @sroy745 @LiuXiaoxuanPKU