Repository navigation
fix: retain state checkpoints for block-aligned prompts - #541
Conversation
Signed-off-by: Alexandre Milesi <milesial@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
tedzhouhk
left a comment
There was a problem hiding this comment.
Reviewed 89e0d074. The focused native state-cache suite passed (68 tests). Approving with the following backend-fidelity finding still outstanding; this approval does not establish matched-vLLM accuracy.
[P1] At core.rs:2602, prompt=16/block=4 without SD now splits prefill into 12+4 and retains state12. The pinned vLLM splitter executes 16; its allocator does not materialize state12, even with internal-checkpoint capability. Executing those upstream methods gives zero reuse for an identical prompt, versus 12 here. This changes both checkpoint availability and prefill iterations, not only bookkeeping.
Please distinguish this simulator checkpoint policy from the pinned serving behavior, or tie it to a validated serving-side fix/version. Preserve the functional-only qualification. The upstream check used actual methods with minimal metadata stubs, not a full vLLM/GPU run.
dreamtalen
left a comment
There was a problem hiding this comment.
Checked the fidelity change: upstream vLLM fixed this boundary in vllm-project/vllm#60533. The Mamba align split now stops at num_tokens - 1 rounded down to the block, so a block-aligned prompt materializes its replay-boundary checkpoint. This PR follows the fixed upstream behavior. LGTM.
Why and what changed
With aligned state caching, a prompt that ends exactly on a block boundary can skip its reusable prompt checkpoint. The scheduler stops at the prompt boundary, but the cache publishes the final full block strictly before that boundary. Subsequent decoding then leaves no reusable prompt state.
Calculate the scheduler boundary from
prompt.saturating_sub(1)to match the cache publisher. For a 16-token prompt and four-token blocks, a repeated request can reuse 12 tokens after the first request completes a long decode.Review map
VllmCore::align_state_prefilland the new state-cache regression incrates/core/src/engine/scheduler/vllm/core.rs.Evidence
The regression completes a 16-token prompt with 16 output tokens, then submits the same prompt. It requires 12 reused tokens:
floor((16 - 1) / 4) * 4. This covers checkpoint retention beyond the first decode block.Fast CI, Full CI, and independent reviews are pending. This draft does not claim merge readiness.
AgentX KV reuse impact
With this fix, a lower-load AgentX replay reaches 95.38% token-weighted KV prefix reuse on one TP1 aggregated worker.
The run uses C8, which means eight active play lanes, with no speculation.
All requests use the same replica, so this result needs no session-pinning change.
The workload uses a 16-play AgentX sample with 4,908 source requests, seed 42, and a 3,600-second profile after warmup.
The worker uses 64 GiB of modeled cache, 64-token blocks, and aligned state caching with
prefix_match_unit=64.The ratio divides reused input tokens by total input tokens across completed requests.
It measures token reuse rather than the fraction of requests with a cache hit.
The fixed run completes 1,578 requests with no cancellations or readmissions.
The C8 comparison changes both the boundary fix and the prefix match unit.
Its 54.95-percentage-point difference does not isolate the effect of this PR.
These duration-limited runs also complete different request counts.
For attribution, the separate matched comparison keeps eight TP1 workers, C64, round-robin routing, and
prefix_match_unit=64unchanged.That comparison measures 0.44% reuse before the boundary fix and 58.37% after it, a gain of 57.93 percentage points.
Modeling or data provenance
The scheduler regression is synthetic. The AgentX results describe simulator cache behavior, with
functional_onlyqualification and no matched silicon calibration.No performance tables, timing equations, or model metadata change.
Tracking
PR #542 separately allows full-block state-cache alignment with speculation. Both PRs target
mainindependently.