Repository navigation
[Bugfix][KV Offload] Reject misaligned chunked-local CPU suffix hits - #63266
Merged
shen-shanshan merged 4 commits intoOct 25, 2026
Merged
shen-shanshan merged 4 commits into
shen-shanshan merged 4 commits into
Conversation
Retain the GPU prefix and recompute the suffix when CPU lookup would use chunk boundaries relative to a non-chunk-aligned local prefix. Add real scheduler and LLM regressions and document the reuse restriction. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: CharlesWu <296364977+charxwu@users.noreply.github.com>
Contributor
|
Documentation preview: https://vllm--63266.org.readthedocs.build/en/63266/ |
Contributor
Author
|
Hi @shen-shanshan, could you please review this fix for incorrect chunked-local CPU suffix hits in The issue reproduces on main at |
6 tasks done
Trigger the PR documentation webhook now that the pre-run gate passes. No source or documentation content changes. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: CharlesWu <296364977+charxwu@users.noreply.github.com>
charxwu
marked this pull request as ready for review
October 24, 2026 12:38
shen-shanshan
approved these changes
Oct 24, 2026
Contributor
|
/ci run |
|
✅ Triggered Buildkite CI #97054 for commit |
Contributor
|
/ci run |
|
✅ Triggered Buildkite CI #97083 for commit |
Micador
pushed a commit
to Micador/vllm
that referenced
this pull request
Oct 27, 2026
…llm-project#63266) Signed-off-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Shanshan Shen <467638484@qq.com> Signed-off-by: Christopher Mackenzie <christopher.mackenzie.software@gmail.com>
Micador
pushed a commit
to Micador/vllm
that referenced
this pull request
Oct 27, 2026
…llm-project#63266) Signed-off-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Shanshan Shen <467638484@qq.com> Signed-off-by: Christopher Mackenzie <christopher.mackenzie.software@gmail.com>
bantianyue
pushed a commit
to bantianyue/vllm
that referenced
this pull request
Oct 28, 2026
…llm-project#63266) Signed-off-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: CharlesWu <296364977+charxwu@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Shanshan Shen <467638484@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fix incorrect output from
SimpleCPUOffloadConnectorwhen a GPU prefix ends inside an attention chunk. Keep the GPU prefix and recompute the suffix when CPU lookup cannot safely preserve absolute chunk boundaries.Claims
LLMregressions and document the recomputation fallback.Validation
Python source baseline: upstream
mainat284c0317c486fc605b915a39a540053ec3a1b59f.Without the fix: 2 failed, 4 passed. Both 16-token local-prefix cases return
(64, True)instead of(0, False), whether the required CPU tail block is present or absent.Without the fix: 2 failed, 110 passed. With the fix: 112 passed. The six new cases cover local prefixes of 0, 16 and 64 tokens and CPU-tail presence/absence.
Without the fix: 1 failed in
check_logprobs_close(cold token 487 versus mixed-hit token 48). With the fix: 1 passed. The test saves deterministic tiny Llama4 weights, loads them throughvllm_runner, and exercisesLLM.generatewith one chunked-local and one full-attention layer. A pure CPU hit still reports 80 cached tokens; the misaligned mixed hit retains 16 GPU-cached tokens and recomputes its suffix. Cache state is established through generation and cache-reset APIs, without patching target methods or populating cache internals. Asynchronous stores are drained by condition polling and engine steps, with a timeout and no fixed sleeps.GPU configuration: one AMD Instinct MI350X, TP1, FP16, eager execution, Triton attention, block size 16, attention chunk size 64 and an 81-token prompt. Both versions use the same prebuilt native extensions: vLLM
0.32.1rc1.dev276+gdf6603f05, Torch2.13.0+rocm10.0.0, HIP7.15.26333, Transformers5.20.2. Complete Python source comes from the baseline above; a fresh native build is not claimed.Supplementary validation with an independent deterministic saved checkpoint compares all 512 next-token logprobs against cold inference (absolute tolerance 0.005):
Pure CPU hits remain correct, with 80 cached tokens, token 60 and maximum logprob error 0.001997. The supplementary checkpoint differs from the Transformers-generated pytest checkpoint, hence the different token IDs. Saved random weights validate cache execution correctness; trained-model quality, throughput, CUDA Graphs and multi-GPU execution were not evaluated.
The existing
v1-kv-offloadBuildkite step selects both regression suites, with NVIDIA and AMD coverage; the test-tethering check passes. Applicable pre-commit hooks, including Ruff, mypy and Markdown lint, pass. Unmatched actionlint was excluded from local hook initialization because its Go download fails TLS certificate verification. The usage page was rendered with the repository's MkDocs theme and Markdown extensions; the full-site build encountered aPydanticMagicMocktype error in the CLI generator's ROCm capability detection.Details
CPU lookup slices off the GPU-local prefix and passes the remaining hashes and token budget to the coordinator. Chunked-local lookup interprets that budget using absolute chunk positions, so a prefix ending inside a chunk changes which blocks are treated as null padding.
With a 16-token GPU prefix and an 81-token prompt, CPU lookup reports a 64-token suffix hit with four null chunk entries. The claimed absolute hit is 80 tokens, so tokens 64–79 still require a real chunk KV block. The load planner skips that block, producing incorrect inference. The new alignment guard declines this lookup. Its tradeoff is additional prefill for misaligned mixed hits.
Duplicate-work checks were refreshed on 2026-10-23. #57325 introduces broader joint GPU/CPU lookup while retaining the legacy suffix API for fallback paths, including composed connectors. This patch protects that retained API and does not implement joint lookup. #61375 changes
OffloadingConnectorpartial-tail stores; #39702 concerns CPU-hit pinning across lookup/allocation. Neither addresses this chunk-position error.AI assistance (Codex) was used for investigation, implementation, validation and PR preparation. This PR is ready for maintainer review. The validation results reported above were obtained by Codex.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.