Skip to content

[BugFix][v0.34.0][KV Pool] Recover partial hybrid prefixes with MTP - #24533

Draft
Dwight2458 wants to merge 8 commits into
vllm-project:releases/v0.34.0from
Dwight2458:codex/ascendstore-mtp-cold-v034
Draft

Dwight2458 wants to merge 8 commits into
vllm-project:releases/v0.34.0from
Dwight2458:codex/ascendstore-mtp-cold-v034

Conversation

@Dwight2458

@Dwight2458 Dwight2458 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

This PR depends on #24473. Please merge that PR first. Its commits are in this branch so the combined behavior can be reviewed and tested.

With hybrid attention and Mamba checkpoints, an MTP draft page can depend on tokens just beyond a hash boundary. vLLM v0.34.0 allows plain HBM hashes. In this mode the old external lookup can reject a valid checkpoint unless an entire additional PMU matches. The change reuses Core's lookahead hasher for external pages whose producer inputs are known. It checks ordinary keys with their existing policy and can check the exact keys through an optional frame on the existing lookup RPC. The worker verifies stored objects on the participating ranks. GET uses the winning hash chain and physical page boundaries from that lookup.

An external prefix verified from token zero can extend a local hit. When an external ancestor is missing, combining HBM and the available external suffix keeps the conservative check. A writer that adopted an unverified local prefix continues publishing ordinary keys. Each page is published under one chain. The lookahead length comes from the resolved drafter configuration. On the single-module test model it was one token even with three speculative tokens.

Does this PR introduce any user-facing change?

Eligible cold reads can reuse a longer prefix. The change requires a recurrent checkpoint at the requested boundary. Existing ordinary entries remain readable. An older reader can miss entries written only under the exact hashes and recompute them. In the affected mode a request may perform one additional lookup and maintain an additional in-memory hash chain. Configuration syntax and backend key formats stay the same.

How was this patch tested?

  • CPU tests used the affected AscendStore unit suite and the two platform prefix-cache test files. The suite passed 1,531 tests on v0.34.0 (12 skipped).
  • Ran the repository's full manual pre-commit stage and its mypy checks targeting Python 3.10, 3.11 and 3.12.
  • On two Ascend 950DT cards with Qwen3.6-35B-A3B, MTP=3 and PMU=128, a 1,843-token writer published a checkpoint at 1,792. A cold 2,048-token sibling sharing 1,843 tokens recovered 1,792. Diverging at token offset 1,792 recovered 1,152. One shared token past the boundary was sufficient for this drafter. Greedy output IDs matched independently computed cold references.
  • The original two 2,048-token prompts were tested separately. With this model and cache layout the first writer did not publish a recurrent checkpoint at 1,792. On this workload a 1,792 hit cannot be asserted.
  • On Memcache the 1,792-token positive case previously returned 1,152. The repaired cold path was also exercised on Mooncake. A 2,048-token writer, HBM reset, 1,154-token warmup, and replay of the original prompt retained 1,152 HBM tokens plus 768 external tokens. A new reader using an old writer's Memcache pool obtained the same 1,920-token ordinary hit as the old reader. Direct 2,048-token hot replay retained 1,920 HBM tokens.

Testing checklist

  • Boundary and edge-case coverage

  • Regression tests for the missed checkpoint and mixed HBM/external recovery

  • Incomplete external pages and missing rank coverage

  • Actual request hashes and physical page reads

  • vLLM main: vllm-project/vllm@c410543

Bulk Memcache currently disables lookahead hashing, so an MTP replay can drop its only locally cached block and reload it from the pool. Propagate lookahead to Store lookup, checkpoint masks and cache events so the same boundary proof governs both cache tiers.

Verify the warm HBM hit, cold pool fallback, boundary divergence and save retry with AscendStore CPU tests. The GLM-5.3 A3 and P/D regressions need NPU coverage.

Signed-off-by: Dwight2458 <bfk371327@gmail.com>
(cherry picked from commit f3559d2)
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Describe the change in warm prefix reuse and the need for matching settings across P/D peers.

Signed-off-by: Dwight2458 <bfk371327@gmail.com>
(cherry picked from commit 6370645)
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
(cherry picked from commit 7686523)
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Skip the draft group's tail drop when block hashes cover the lookahead.
This lets full attention and Mamba reuse their shared checkpoint on a
warm replay. Keep the existing drop policy for unhashed lookups.

Cover one- and five-page replays through both hybrid lookup entry
points. Type the external checkpoint boundaries for both ranges and
tuples.

Signed-off-by: Dwight2458 <bfk371327@gmail.com>
(cherry picked from commit 65fde5d)
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
For partial hybrid cache hits with plain HBM hashes, use Core's lookahead hash for freshly established external pages. Compare both chains under their own lookup rules and load the winning keys. Keep legacy writes when the admitted prefix includes unverified local KV.

Release Core CPU tests: 1400 passed, 12 skipped in the AscendStore unit suite.

Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Check the external lookahead chain independently before composing it with HBM. When every required page and rank is present, load the suffix beyond the local hit. Keep the conservative EAGLE lookup for sparse external prefixes.

Signed-off-by: Dwight2458 <bfk371327@gmail.com>
Signed-off-by: Dwight2458 <bfk371327@gmail.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation module:tests labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

🤖 How to trigger CI

CI runs automatically when the PR is opened or reopened. Pushing a new commit no longer re-runs the E2E CI (to save NPU runner resources), so use the comment commands below when needed. They are available to the PR author and users with triage permission or above:

  • /run — run the full PR CI gate on the latest commit.
  • /rerun — re-run the failed CI jobs (e.g. after a flaky failure).
  • /e2e — run selected E2E tests instead of the full gate.
  • /nightly / /presmoke / /weekly — run the corresponding large-scale tests (triage permission or above; blocked during the nightly maintenance window).
  • /cancel — cancel a running CI on this PR.

Note

Until the CI gate has run on a commit, the required ci-gate check stays pending and the PR cannot merge — remember to comment /run after pushing.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [BugFix] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for lookahead hashing in the Ascend KV cache store, enabling more efficient cache hits and handling of draft model lookahead tokens. The changes include updates to the AscendStoreCoordinator and KVPoolScheduler to manage lookahead tokens, additions to the PoolBlockHashes utility, and corresponding updates to the connector and lookup logic. Several unit tests were added or updated to verify the new lookahead-aware cache recovery and lookup behavior. I have no feedback to provide as the changes are well-structured and include necessary test coverage.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Coverage

Total Coverage Diff Coverage
Total 164290 lines 220 lines
Missing 44324 lines 32 lines
Coverage 73% 85%

More info see: Summary

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation module:tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant