Repository navigation
Conversation
…kups A prefix lookup checks every candidate key with batch_is_exist, which grants each key it finds a read lease, and a lease both blocks eviction and renews eviction order. Every lookup therefore renews the whole prompt history. For hybrid models that includes the Mamba state at every earlier block boundary, though a hit loads only the one at its tail. With VLLM_MOONCAKE_STORE_SELECTIVE_LEASE=1 the lookup probes the candidates with the lease-free batch_probe_key, computes the hit as before, and then leases only the keys the load will read. If a key was evicted in between, the shorter hit is leased in turn; a hit that keeps shrinking, or a failed lease, is reported as a miss. The lease RPC is recorded as the lookup_lease operation. The flag needs Mooncake >= 0.3.14 on the master and every client. A worker checks at startup that the master serves the probe and fails otherwise. With the flag off, lookups are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Wei Zhao <weizha@nvidia.com>
…nd lease failures Check only that the installed Mooncake provides batch_probe_key, and raise when it does not. A failed lease RPC now raises an internal _LeaseFailedError instead of returning None, so _lease always returns the evicted (group, hash) pairs, and lease_hit reports a miss when the lease fails or the hit keeps shrinking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Wei Zhao <weizha@nvidia.com>
…nd metrics edits Describe the feature without tying it to Mamba: a lookup lease covers the keys the hit loads, and a hit that shrinks after an eviction can end at a key the first lease did not cover, hence the second round. Revert the usage-doc row and the metrics docstring edit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Wei Zhao <weizha@nvidia.com>
wzhao18
marked this pull request as ready for review
October 23, 2026 22:28
wzhao18
requested review from
ApostaC,
NickLucche,
ivanium,
orozery and
xuechendi
as code owners
October 23, 2026 22:28
wzhao18
marked this pull request as draft
October 24, 2026 02:24
wzhao18
marked this pull request as ready for review
October 24, 2026 05:04
- ChunkedTokenDatabase.process_tokens takes any Sequence of block hashes, as the lookup path passes one. - Patch the store's batch_is_exist with monkeypatch in the lease tests. Signed-off-by: Wei Zhao <weizha@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
6 tasks done
This branch has not been deployed
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.
Purpose
MooncakeStoreConnectorprefix lookups callbatch_is_exist, which grants a read lease on every key it finds and moves it to the hot end of the eviction order. A lookup therefore renews every stored key of the prompt, including keys that loading the hit never reads: blocks outside a sliding window, or the per-block-boundary states of linear-attention / Mamba layers before the hit's tail. Once the store is full, those never-loaded keys look hot and survive eviction, while keys that later requests would actually load are evicted.This PR adds an opt-in mode,
VLLM_MOONCAKE_STORE_SELECTIVE_LEASE=1, in which a lookup:batch_probe_key, which checks existence without leasing (kvcache-ai/Mooncake#3801);batch_is_existon the hit's load set, per group load mask and tail key).If a key was evicted between the probe and the lease, the hit gets shorter, and the shorter hit can end at a key the first lease did not cover (for example, an earlier boundary state). So the shorter hit is leased in a second round. A hit is returned only when the lease on all of its keys succeeded; otherwise the lookup reports a miss. A failing lease RPC also reports a miss and never breaks the lookup server.
The default path is unchanged.
Changes
vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/selective_lease.py:SelectiveLookupLease(probe, compute the load set, lease, record thelookup_leaseoperation in the connector metrics).store/worker.py: when the env var is set, the lookup probes throughSelectiveLookupLeaseand passes its hit tolease_hit. The longest-hit computation moves into_longest_hitso it can be reused after an eviction.envs.py:VLLM_MOONCAKE_STORE_SELECTIVE_LEASE(default off).MooncakeDistributedStore.batch_probe_key.Requirements
Requires Mooncake >= 0.3.14 on the master and every client.
batch_probe_keyis not in a tagged release yet; this was tested with the nightly0.3.14.dev20261022.Test Plan
Unit tests in
tests/v1/kv_connector/unit/test_mooncake_store_hma_e2e.py, on a full-attention + Mamba (align mode) worker over an in-memory store:batch_probe_key.End-to-end A/B on Kimi-K3 (hybrid KDA + MLA), disaggregated 4 prefill workers (TP8) + 1 decode worker (DEP16) on GB300, agentic coding traces at concurrency 480, 60 min. Mooncake store with 160 GB per rank (7.5 TB total), eviction at 95% high-watermark. Both arms run the same build and the same Mooncake nightly; only the env var differs.
Test Result
Disaggregated, 4P1D (DEP16 decode), concurrency 480
The store's raw capacity is the same in both arms: about 523k keys at the watermark, 10% evicted per pass, no failed evictions. What changes is which keys survive. A per-request audit against the trace (which prefixes had a saved state available when the request arrived) shows misses on states saved 2–10 min earlier falling from 1.13 to 0.21 points of prompt tokens, and on states older than 10 min from 1.55 to 0.91. Misses on states younger than 2 min are unchanged (0.46 vs 0.45), since nothing that young is evicted.
Cost: the extra lease RPC averages 1.07 ms (P90 1.9 ms) per lookup, with no errors and no keys evicted between probe and lease during the run. The lease-free probe was itself slightly faster than the leasing one (36.8 ms vs 43.1 ms average).
Aggregated, concurrency sweep
One aggregated worker (TP8, DCP8, FP8 KV cache) on 8 GB300 GPUs, the same agentic coding traces, 60 min per run, Mooncake store with 160 GB per rank (1.25 TB total). Both arms run the same build; only the env var differs. Prefix cache hit rate is the benchmark's: cached prompt tokens / prompt tokens over the measured requests.
The gain grows with concurrency, i.e. with pressure on the store: at concurrency 96, misses on states that were saved and later evicted fall from 2.7 to 1.0 points of prompt tokens. Since the GPU KV cache is full from concurrency 64 on, the extra hits also save prefill work in the shared worker, which shows up as lower ITL.
At concurrency 48 the store is under little pressure, and selective lease is slightly worse. The difference comes from a few long requests (150k–690k tokens) that resumed from a state saved at an earlier boundary and not loaded since: the default mode kept it alive because later lookups over the same prefix renewed it, while selective lease let it age out. This is the trade-off of the mode: states that are only passed over by lookups are no longer protected.
🤖 Generated with Claude Code