generate invoking doesn't require detokenization for beam search - #33563
gameofdimension wants to merge 102 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a performance optimization to the beam_search method. By setting detokenize=False for the generate calls within the beam search loop, it avoids unnecessary work since the intermediate text is not used. The final sequences are correctly decoded at the end of the function. This is a good and safe optimization.
|
@aarnphm @chaunceyjiang |
njhill
left a comment
There was a problem hiding this comment.
Thanks @gameofdimension.
This is actually also included in https://github.com/vllm-project/vllm/pull/29133/files which stalled. Maybe you could also include an explanatory comment similar to that one.
18d1edb to
ae4039c
Compare
| @@ -347,6 +347,7 @@ async def beam_search( | |||
| logprobs=logprobs_num, | |||
| max_tokens=1, | |||
| temperature=temperature, | |||
| detokenize=False, | |||
There was a problem hiding this comment.
As the review bot pointed out, we never use generate()'s returned text - the real detokenization happens later in this function.
There was a problem hiding this comment.
Sorry, I meant adding a comment in the code next to this line, as is in the other PR I referenced.
Signed-off-by: G.O.D <32255912+gameofdimension@users.noreply.github.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…3551) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: rabi <ramishra@redhat.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…project#32790) Signed-off-by: dafrimi <dafrimi@nvidia.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: shanjiaz <zsjwpianpian@gmail.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…for the GB series (vllm-project#33540) Signed-off-by: Kebe <mail@kebe7jun.com> Signed-off-by: youkaichao <youkaichao@gmail.com> Co-authored-by: Thomas Vegas <tvegas@nvidia.com> Co-authored-by: youkaichao <youkaichao@gmail.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…-project#33039) Signed-off-by: Yang <lymailforjob@gmail.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…max loras. Multiple cuda graphs are captured for each num of active-loras. (vllm-project#32005) Signed-off-by: Yu Gong <yu3.gong@gmail.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
…lm-project#31914) Signed-off-by: vasiliy <vasiliy@fb.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com> Co-authored-by: Pavani Majety <pmajety@nvidia.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
Signed-off-by: Patrick von Platen <patrick.v.platen@gmail.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
|
Documentation preview: https://vllm--33563.org.readthedocs.build/en/33563/ |
|
The commit history is messed up. closed wait PR 29133 to be merged |
Purpose
vllm/vllm/entrypoints/openai/engine/serving.py
Line 504 in b398e5c
The code here demonstrates detokenization isn't required for generate(), and skipping it offers minor latency benefits.
Test Plan
Test Result
with sequence lengths ranging from 958 to 1,230 tokens
latency improvement
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.