-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[V1] V1 engine implements parallel sampling (AsyncLLM and LLMEngine) #10980
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 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 do one of these:
🚀 |
This pull request has merge conflicts that must be resolved before it can be |
7cd9a24
to
f506458
Compare
It seems like this PR is implementing ideas similar to those implemented in PR #9302 for the V0 engine. That PR created some issues that were addressed in PR #11898 and which may exist in the proposed V1 code. In particular, the proposed code currently does not properly handle the case when a seed value is provided for the parent request; the seed value is duplicated in child requests, leading to identical outputs in the child requests. The fix in #11898 was simply to move the copying of the Additionally, the proposed code for the V1 engine defines |
This pull request has merge conflicts that must be resolved before it can be |
3d5b962
to
bf3cfd0
Compare
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.com>
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.com>
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.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.
Thanks @afeldman-nm, it's looking much better.
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.com>
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.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.
Thanks @afeldman-nm, let's land this and then @markmc can open a follow-on to refactor.
@afeldman-nm could you please check the failed tests and fix or re-run them? |
Signed-off-by: Andrew Feldman <afeldman@neuralmagic.com>
This PR adds support for parallel sampling to v1 AsyncLLM and LLMEngine.
Parallel sampling is implemented outside the engine. This does not impact the vLLM v0 parallel sampling implementation.
Design doc: https://docs.google.com/document/d/1_fvbHVCfexkPAj2Vx0Q0gNvE-b53WwtrLrD6NldgBFU/edit?usp=sharing (message me if you need access permissions)
A request with
n>1
will spawnn
requests withn=1
and aggregate their outputs in accordance with theoutput_kind
.If prefix caching is enabled, an initial warmup request withUpdate: The vLLM v1 engine can exploit APC when a prompt repeats within a batch, even if that prompt was not seen in a previous batch. Therefore, no warmup request is required.max_tokens=1
will be sent to the engine to fill the prefix cache.The abstractions are cleanest for async v1 engine because AsyncLLM presents a
generate()
method that handles adding requests and running the engine; parallel sampling is implemented by writing a wrapper which invokes this methodn
times against parallel sampling child requests.v1 LLMEngine presents
add_request()
andstep()
methods, so parallel sampling is implemented by writing anadd_request()
wrapper which branches parallel sampling requests inton
add_request()
calls for child requests, and then havingstep()
aggregate child request outputs into a parent request output.FIX #13419
FIX #13420