Skip to content

Promote prefix_cache_retention_interval to an argument and change the default to 0 - #52216

Merged
tlrmchlsmth merged 6 commits into
mainfrom
prefix-cache-retention-arg
Aug 17, 2026
Merged

tlrmchlsmth merged 6 commits into
mainfrom
prefix-cache-retention-arg

Conversation

@tlrmchlsmth

Copy link
Copy Markdown
Member

VLLM_PREFIX_CACHE_RETENTION_INTERVAL was added in #43447, and allows control over the frequency of caching blocks for SWA and SSM models.

When setting this value to zero, vLLM retains only the latest replayable prompt boundary, and when setting it to a positive integer N, vLLM retains every N tokens.

This has become an extremely important setting especially for agentic workloads, so this PR upgrades it to an argument rather than an environment variable.

In addition, it now defaults to 0 rather than None, so that we avoid caching useless blocks. Marconi-style cache retention guarantees that we still retain the system prompt.

tlrmchlsmth and others added 3 commits August 13, 2026 16:06
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@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 repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@mergify mergify Bot added the kv-connector label Aug 13, 2026

@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.

Briefly skimmed through and LGTM

@tlrmchlsmth

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83809 for commit e9b1bf707034.

@hmellor

hmellor commented Aug 14, 2026

Copy link
Copy Markdown
Member

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 5 failed job(s) for retry in Buildkite CI #83809.

tlrmchlsmth and others added 2 commits August 14, 2026 13:05
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83959 for commit 92f14b6c797b.

@tlrmchlsmth

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84129 for commit ecb968beeeff.

@tlrmchlsmth
tlrmchlsmth enabled auto-merge (squash) August 17, 2026 12:56
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 17, 2026
@tlrmchlsmth
tlrmchlsmth merged commit 017e9f4 into main Aug 17, 2026
124 checks passed
@tlrmchlsmth
tlrmchlsmth deleted the prefix-cache-retention-arg branch August 17, 2026 13:20
zyp2014 pushed a commit to zyp2014/vllm that referenced this pull request Aug 21, 2026
…he default to 0 (vllm-project#52216)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
wyettzeng pushed a commit to wyettzeng/vllm that referenced this pull request Aug 21, 2026
…he default to 0 (vllm-project#52216)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Wyett <wyettzeng@gmail.com>
zufangzhu pushed a commit to zufangzhu/vllm that referenced this pull request Aug 24, 2026
…he default to 0 (vllm-project#52216)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
kamb-code added a commit to kamb-code/vllm that referenced this pull request Aug 24, 2026
…GLE-reachable state

`prefix_cache_retention_interval` defaults to 0 since vllm-project#52216: sparse Mamba
retention hashes only the replay boundary and shared-prefix junctions
(`MambaManager.reachable_block_mask`). Two consequences for the dense
boundary stops introduced earlier in this PR, both found while @jschmied
validated on a default install:

1. Stopping at every boundary splits the prefill for states the mask then
   discards. The split now stops only where a state will be hashed: every
   boundary under dense retention (`None`, or an interval at/below the
   block size), the next segment boundary under a positive interval, and
   only the kept boundaries under 0.

2. The retained replay boundary is `num_prompt_tokens - 1`, but under
   EAGLE/MTP the attention lookup drops its last matched block, so the
   kept state sat one block beyond what any speculative lookup can reach
   and an identical prompt only hit once a junction formed (third send).
   The hybrid coordinator now exposes that margin (`eagle_reach_margin`,
   the same rule its lookup applies: one hash block under fine-grained
   partial hits, otherwise one group block); `MambaManager` keeps the
   state at the eagle-reachable boundary too, and the split ends a chunk
   there so it exists.

Measured on the scheduler+manager harness at retention 0 (main @
8d6b183, 3-send identical protocol, 1,600-token align blocks):
7,292-token prompt carved [4800, 6400, 7292] instead of
[1600, 3200, 4800, 6400, 7292], first hit on send 2 (4,800) instead of 3;
6,400-token prompt carved [3200, 4800, 6400], first hit on send 2 (3,200)
instead of 3. Every dense-retention cell unchanged.

Signed-off-by: Kam Basra <kameldipbasra@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm6Q54FRX5t8uDLx2Jbrh5
Signed-off-by: Kam Basra <kameldipbasra@gmail.com>
khushali9 pushed a commit to khushali9/vllm that referenced this pull request Aug 29, 2026
…he default to 0 (vllm-project#52216)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: khushali9 <khushali.desai9@gmail.com>
@ZJY0516

ZJY0516 commented Sep 7, 2026

Copy link
Copy Markdown
Member

This let mamba prefix cache hit to 0 when using eagle

ZJY0516 added a commit to ZJY0516/vllm that referenced this pull request Sep 7, 2026
…AGLE

PR vllm-project#52216 changed the default of prefix_cache_retention_interval from
None to 0. With sparse retention (0), only the latest replay boundary
keeps a Mamba state checkpoint, and EAGLE additionally drops the tail
block from prefix-cache hits, leaving Mamba checkpoints largely
unreachable so prefix caching never hits for Mamba models with
EAGLE-style speculative decoding.

Keep the public argument unchanged (int | None, default 0) and only
change how an unset value is resolved: EngineArgs now defaults the
field to a private sentinel (or the deprecated
VLLM_PREFIX_CACHE_RETENTION_INTERVAL env var when set) so that
create_engine_config can tell an unset value apart from an explicit
one and resolve it once the model and speculative-decoding
configuration are known: dense (None) for Mamba models with
EAGLE-style speculative decoding, 0 otherwise. Explicitly configured
values (0 / N / None / env var) are always respected.

Co-authored-by: Kimi Code
Signed-off-by: zjy0516 <riverclouds.zhu@qq.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants