Skip to content

[Bugfix] Fix incorrect single-token saves in v1#653

Merged
Siddhant-Ray merged 1 commit intoLMCache:devfrom
orozery:v1-chunk-boundary-fix
May 15, 2025
Merged

[Bugfix] Fix incorrect single-token saves in v1#653
Siddhant-Ray merged 1 commit intoLMCache:devfrom
orozery:v1-chunk-boundary-fix

Conversation

@orozery
Copy link
Copy Markdown
Contributor

@orozery orozery commented May 15, 2025

After saving a (256 token) chunk, num_saved_tokens % chunk_size is 0.
After the next decoded token, chunk_boundary will incorrectly be set to equal num_saved_tokens, instead of num_saved_tokens+chunk_size.
This will yield an additional unwanted 1 token save.
For example:

LMCache INFO: Storing KV cache for 1 out of 4097 tokens for request

This PR fixes chunk_boundary to avoid these incorrect writes.

This commit fixes the chunk boundary for saves in the vllm v1 adatper.
Before this fix, it was possible that a single token writes were not skipped.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
@orozery orozery force-pushed the v1-chunk-boundary-fix branch from 88bdba5 to 5ee7cf8 Compare May 15, 2025 18:02
@orozery
Copy link
Copy Markdown
Contributor Author

orozery commented May 15, 2025

@ApostaC this is a fix to code introduced in #490

Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! LGTM!

@Siddhant-Ray Siddhant-Ray merged commit 189b317 into LMCache:dev May 15, 2025
13 checks passed
vMaroon pushed a commit to vMaroon/LMCache that referenced this pull request May 16, 2025
vllm v1: Fix saves chunk boundary

This commit fixes the chunk boundary for saves in the vllm v1 adatper.
Before this fix, it was possible that a single token writes were not skipped.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
vMaroon added a commit to neuralmagic/LMCache that referenced this pull request May 16, 2025
[Bugfix] Fix incorrect single-token saves in v1 (LMCache#653)
KevinCheung2259 pushed a commit to KevinCheung2259/LMCache that referenced this pull request Nov 5, 2025
vllm v1: Fix saves chunk boundary

This commit fixes the chunk boundary for saves in the vllm v1 adatper.
Before this fix, it was possible that a single token writes were not skipped.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
DongDongJu pushed a commit to DongDongJu/LMCache that referenced this pull request Feb 22, 2026
vllm v1: Fix saves chunk boundary

This commit fixes the chunk boundary for saves in the vllm v1 adatper.
Before this fix, it was possible that a single token writes were not skipped.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants