-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[BugFix] Fix incremental detokenization perf issue #16963
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
max was meant to be min - could cause O(n^2) blowup in pathological cases Signed-off-by: Nick Hill <[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 🚀 |
@@ -161,7 +161,7 @@ def __init__(self, tokenizer: PreTrainedTokenizerFast, | |||
prompt_suffix = request.prompt_token_ids | |||
prompt_len = len(prompt_suffix) | |||
if prompt_len > 4: | |||
for i in range(4, max(prompt_len + 1, 32)): | |||
for i in range(4, min(prompt_len + 1, 24)): |
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.
Where does 24 come from? Can we use smaller numbers like 5?
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.
It's to try to find a small suffix to start from, or else it has to loop over the entire prompt below decoding the tokens one-by-one, which could be very long.
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.
So, does it mean we can't use smaller numbers?
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. Thanks for the fix! The performance looks normal after this PR:
============ Serving Benchmark Result ============
Successful requests: 100
Benchmark duration (s): 45.27
Total input tokens: 1000000
Total generated tokens: 20000
Request throughput (req/s): 2.21
Output token throughput (tok/s): 441.79
Total Token throughput (tok/s): 22531.15
---------------Time to First Token----------------
Mean TTFT (ms): 974.65
Median TTFT (ms): 413.66
P99 TTFT (ms): 2323.33
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 66.89
Median TPOT (ms): 77.80
P99 TPOT (ms): 83.48
---------------Inter-token Latency----------------
Mean ITL (ms): 66.89
Median ITL (ms): 27.12
P99 ITL (ms): 246.34
==================================================
Signed-off-by: Nick Hill <[email protected]> Signed-off-by: Frieda (Jingying) Huang <[email protected]>
Signed-off-by: Nick Hill <[email protected]>
Signed-off-by: Nick Hill <[email protected]>
Signed-off-by: Nick Hill <[email protected]> Signed-off-by: Agata Dobrzyniewicz <[email protected]>
Signed-off-by: Nick Hill <[email protected]> Signed-off-by: Mu Huai <[email protected]>
Signed-off-by: Nick Hill <[email protected]> Signed-off-by: minpeter <[email protected]>
max
was meant to bemin
- could cause O(n^2) blowup in pathological cases