-
Notifications
You must be signed in to change notification settings - Fork 16
vLLM prefix caching correctness (+ "test") #346
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
According to the vLLM docs (https://docs.vllm.ai/en/v0.9.0/api/vllm/outputs.html#vllm.outputs.RequestOutput), | ||
this is the number of tokens with a prefix cache hit. So, the logic is that if we run one generation, | ||
then run another generation with the same start, we should see the number of cached tokens == the length of the prefix. | ||
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.
TIL
logger.info(f"Weight update completed (now v{self.policy_version})") | ||
|
||
@endpoint | ||
async def _reset_prefix_cache(self): |
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.
Maybe we can have this convention of
async def _reset_prefix_cache(self): | |
async def _test_reset_prefix_cache(self): |
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.
In this case, I actually don't mind exposing to the end user! It could be used if someone wants to do something custom with their Policy setup.
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 for the test
logger.info(f"Weight update completed (now v{self.policy_version})") | ||
|
||
@endpoint | ||
async def _reset_prefix_cache(self): |
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.
Another example of needing
meta-pytorch/monarch#1455
) | ||
expected_cached_tokens = 0 | ||
async for res in vllm_model.generate( | ||
first_prompt, sampling_params, request_id="first_16" |
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.
Does the request_id matter here?
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.
Nah, just for logging.
Context
Are we correctly clearing our prefix cache? Hard to know without proper testing. Hence, this PR.
What changed?
Open questions