Skip to content

[3/N][Core][KV Connector] Support reliable partial-tail KV offload for sub-block prompts - #49502

Merged
ivanium merged 8 commits into
vllm-project:mainfrom
Dao007forever:dao/partial-hit
Jul 27, 2026
Merged

ivanium merged 8 commits into
vllm-project:mainfrom
Dao007forever:dao/partial-hit

Conversation

@Dao007forever

@Dao007forever Dao007forever commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Purpose

see #45702

Enable fine-grained prefix lookup and MooncakeStore offload when a prompt ends before the shared block boundary. Handle lazy hash sequences and local-only partial hits correctly so sub-block requests can reuse cached state without triggering an invalid remote load.

max_tokens=1 failure mode

A producer's partial-tail marker previously became an offload handoff only when a later allocation triggered copy-on-write. Requests that finished after their first sample never allocated again, so freeing the request discarded the marker and forced later consumers to recompute that otherwise shareable tail. As a result, the tail was not offloaded when max_tokens=1.

Flush partial-tail handoffs in the scheduling step that creates them, carry the exact snapshot boundary, and pin off-table Mamba CoW blocks until connector-delayed free completes. Persist every cache group from its durable offset through the boundary, including smaller-group full blocks that normal LCM-aligned saves omit.

Gate producer-only work on connector availability and fail closed under pressure, null source blocks, lookup errors, or failed puts. Keep partial-tail progress separate from normal-save progress so failed offloads remain cache misses instead of publishing corrupt data or advancing the durable watermark.

Consolidate the partial-hit feature predicate and computed-block truncation used by reconciliation.

AI assistance was used to implement this change.

Test Plan

Tests: partial-prefix cache, scheduler, MooncakeStore scheduler/worker/coordinator, and hybrid-memory end-to-end suites; Ruff and git diff checks.

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Enable fine-grained prefix lookup and MooncakeStore offload when a prompt ends before the shared block boundary. Handle lazy hash sequences and local-only partial hits correctly so sub-block requests can reuse cached state without triggering an invalid remote load.

Flush partial-tail handoffs in the scheduling step that creates them, carry the exact snapshot boundary, and pin off-table Mamba CoW blocks until connector-delayed free completes. Persist every cache group from its durable offset through the boundary, including smaller-group full blocks that normal LCM-aligned saves omit.

Gate producer-only work on connector availability and fail closed under pressure, null source blocks, lookup errors, or failed puts. Keep partial-tail progress separate from normal-save progress so failed offloads remain cache misses instead of publishing corrupt data or advancing the durable watermark.

Consolidate the partial-hit feature predicate and computed-block truncation used by reconciliation.

Tests: partial-prefix cache, scheduler, MooncakeStore scheduler/worker/coordinator, and hybrid-memory end-to-end suites; Ruff and git diff checks.

AI assistance was used to implement this change.

Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai>

Co-authored-by: OpenAI Codex <codex@openai.com>

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao Le <Dao007forever@gmail.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@ivanium ivanium changed the title Support reliable partial-tail KV offload for sub-block prompts [3/N][KV Connector] Support reliable partial-tail KV offload for sub-block prompts Jul 23, 2026
@ivanium ivanium changed the title [3/N][KV Connector] Support reliable partial-tail KV offload for sub-block prompts [3/N][Core][KV Connector] Support reliable partial-tail KV offload for sub-block prompts Jul 23, 2026
@mergify

mergify Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Dao007forever.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Jul 23, 2026
process_tokens bounded iteration by the compact chunk-hash list, whose length only counts complete physical blocks. Fine-grained cache hits ending at a hash boundary inside a physical block were therefore omitted entirely for sub-block hits or lost their trailing KV for cross-block hits.

Make the caller's hash-alignment and hash-coverage contracts explicit, enumerate the token range directly with ceiling division, and key every emitted chunk by the fine-grained hash at its ending boundary. Extend the existing HMA test to cover sub-block and cross-block partial tails while retaining the aligned case.

Co-authored-by: OpenAI Codex <noreply@openai.com>

Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao Le <Dao007forever@gmail.com>

@ivanium ivanium left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Discussed offline and LGTM!
Please rebase and update the potential edge case for short decode requests.

Dao007forever and others added 3 commits July 24, 2026 19:52
# Conflicts:
#	vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/data.py
#	vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/scheduler.py

Signed-off-by: Dao Le <Dao007forever@gmail.com>
Align lookup bounds to the hash block size when partial hits are enabled so persisted sub-block tails remain discoverable. Retain LCM alignment for regular block-granular lookups.

Co-authored-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao Le <Dao007forever@gmail.com>
@mergify mergify Bot removed the needs-rebase label Jul 25, 2026
@ivanium ivanium added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 25, 2026
Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao Le <Dao007forever@gmail.com>
Signed-off-by: Dao Le <Dao007forever@gmail.com>
@ivanium
ivanium merged commit d742856 into vllm-project:main Jul 27, 2026
97 checks passed
puririshi98 added a commit to puririshi98/vllm that referenced this pull request Jul 27, 2026
Resolve conflict in the Mooncake store coordinator: vllm-project#49502 independently
landed the MambaSpec eagle gate upstream and extended it with a
fine-grained hash margin. Keep upstream's superset and retain the comment
explaining why a recurrent group gets no peek margin (vllm-project#43559).

Signed-off-by: Rishi Puri <riship@nvidia.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kv-connector ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants