You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Smaller available space for paged KV cache compared with vLLM #224
Running on an A10 with TRT-LLM Triton backend, I'm seeing the paged KV cache size to be 10718 tokens from logs
[TensorRT-LLM][INFO] Using 10718 tokens in paged KV cache.
Is 10718 tokens actually 10718 blocks since 10718 does not divide 16?
Using vLLM I'm getting GPU block of 8348 out of the box (0.9 free memory ratio), and block size is 16 by default.
Hey, thanks for the question. That is indeed the number of tokens calculated based on user provided-constaints, but it gets rounded up to the next multiple of block size during allocation in the KV cache. We will fix the log message to be more accurate.
Thanks for your question. As @schetlur-nv explained, that's indeed the number of tokens. However, we are wondering why the difference between TensorRT-LLM and vLLM is that large. The weights should occupy around 14GB so we think there must be space for TensorRT-LLM to allocate a bigger KV cache. Do you have the log that was produced by TensorRT-LLM during the compilation, please? If not, we'll generate one ourselves.
Hi @yunfeng-scale , we pushed an update to the main branch, the log messages on KV cache are more accurate now. Feel free to let us know if there are further questions, thank you.
Thanks for your question. As @schetlur-nv explained, that's indeed the number of tokens. However, we are wondering why the difference between TensorRT-LLM and vLLM is that large. The weights should occupy around 14GB so we think there must be space for TensorRT-LLM to allocate a bigger KV cache. Do you have the log that was produced by TensorRT-LLM during the compilation, please? If not, we'll generate one ourselves.
Thanks, Julien
Sorry I can't reproduce the numbers with vLLM and 7b model. Tried again today and I'm getting 868 blocks on vLLM and that's 13888 tokens. That's still larger that TRT-LLM. It would be nice to match the size of kv cache
@yunfeng-scale We were able to reproduce your numbers but found they are likely due to different default values for the number of input tokens. Using the following values to build the TRT-LLM engine would match the vLLM default values: --max_batch_size 256 --max_num_tokens 2048
With that engine, TRT-LLM is able to allocate a larger KV cache size.
Activity
schetlur-nv commentedon Nov 1, 2023
Hey, thanks for the question. That is indeed the number of tokens calculated based on user provided-constaints, but it gets rounded up to the next multiple of block size during allocation in the KV cache. We will fix the log message to be more accurate.
jdemouth-nvidia commentedon Nov 2, 2023
Hi @yunfeng-scale ,
Thanks for your question. As @schetlur-nv explained, that's indeed the number of tokens. However, we are wondering why the difference between TensorRT-LLM and vLLM is that large. The weights should occupy around 14GB so we think there must be space for TensorRT-LLM to allocate a bigger KV cache. Do you have the log that was produced by TensorRT-LLM during the compilation, please? If not, we'll generate one ourselves.
Thanks,
Julien
kaiyux commentedon Nov 7, 2023
Hi @yunfeng-scale , we pushed an update to the main branch, the log messages on KV cache are more accurate now. Feel free to let us know if there are further questions, thank you.
yunfeng-scale commentedon Nov 7, 2023
Sorry I can't reproduce the numbers with vLLM and 7b model. Tried again today and I'm getting 868 blocks on vLLM and that's 13888 tokens. That's still larger that TRT-LLM. It would be nice to match the size of kv cache
schetlur-nv commentedon Dec 11, 2023
Hey @yunfeng-scale can you confirm if you still see this issue? We have made several updates to optimize memory savings in the past month or so.
schetlur-nv commentedon Dec 20, 2023
@yunfeng-scale I will close this issue now. Please feel free to leave a comment or open a new issue if you have more questions.
achartier commentedon Jan 12, 2024
@yunfeng-scale We were able to reproduce your numbers but found they are likely due to different default values for the number of input tokens. Using the following values to build the TRT-LLM engine would match the vLLM default values:
--max_batch_size 256 --max_num_tokens 2048With that engine, TRT-LLM is able to allocate a larger KV cache size.