[KV Cache] Preserve EAGLE SWA replay blocks for external APC - #56449
Draft
wangyicong52 wants to merge 1 commit into
Draft
wangyicong52 wants to merge 1 commit into
wangyicong52 wants to merge 1 commit into
Conversation
wangyicong52
force-pushed
the
fix/eagle-swa-external-apc
branch
from
September 11, 2026 12:33
d30da61 to
d117baf
Compare
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
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
This PR preserves reusable sliding-window replay blocks for EAGLE hybrid KV cache groups after remote KV receive, and aligns Mooncake/NIXL sliding-window transfer clipping with the same EAGLE replay slack so Decode-side local APC can reuse prefixes that were first loaded from external prefix cache.
We found this while benchmarking DeepSeek-V4.1-Flash with PD disaggregation on an 8x NVIDIA H20 setup using the
iaas-gpu-cn-beijing.cr.volces.com/serving/vllm:community_deepseekv41-flash-0909image, EAGLE/DSpark enabled, hybrid KV cache enabled, and long shared-prefix Decode traffic generated bysglang.bench_servingwith thegenerated-shared-prefixdataset. In the 64k shared-prefix Decode case, Prefill-side local APC was hot and Decode-side external prefix cache reported full hits, but Decode-side local APC did not grow at all. A fixed-engine discriminator with Decode switched to a single TP8 engine reproduced the same behavior for serialx+athenx+brequests, ruling out Decode DP cross-engine cache isolation as the primary cause.The root cause is that sliding-window groups may receive or keep only the local attention tail after external KV loading, while EAGLE local prefix-cache lookup needs one extra lookahead block and can fall back to the previous aligned replay boundary when the prompt tail is partial. In that case the full-attention group can have a reusable prefix, but the SWA group is missing the earlier replay-boundary blocks required for the hybrid fixed-point lookup, so the common local APC hit collapses to zero. This PR fixes that by retaining one cache-hit alignment of replay slack for EAGLE SWA managers and by making Mooncake/NIXL transfer clipping preserve the same replay slack for all SWA groups that share an EAGLE-marked KV cache spec.
Relationship to Existing Work
#50897 is the strongest functional overlap. It introduces successor-aware EAGLE prefix hashes and disables the legacy last-block drop for supporting connectors, including direct Mooncake and NIXL. If that broader protocol change lands and is enabled end to end, it can avoid the same Decode local-APC failure without retaining replay slack. It does not implement the conservative legacy-drop path in this PR, and its hash, publication, and connector lifecycle changes are substantially broader.
#56227 takes a different, DeepSeek-V4.1-specific approach behind an opt-in environment flag: it marks the SWA cache as non-prefix-cacheable and recomputes the trailing window after a hit. That avoids transferring and reusing the SWA prefix rather than preserving replay-boundary blocks, and it does not provide a generic direct Mooncake/NIXL fix for prefix-cacheable SWA groups.
#44082 and #54713 fix colocated SWA lookahead and replay-boundary retention, but they do not cover blocks first materialized by direct remote KV receive. #52287 keeps the EAGLE SWA replay window for the offloading scheduler path, but it does not update direct Mooncake/NIXL transfer clipping. #51295 and #53802 improve hybrid replay/checkpoint boundary handling without preserving replay-boundary SWA blocks received from remote Prefill. #44882 concerns concurrent external-prefix materialization and coalescing; #48189 was closed and explicitly excludes NIXL, hybrid/EAGLE, and full-prompt external-prefix paths; #40268 concerns GPU KV-cache scan pollution.
No existing PR covers the exact path implemented here: preserving legacy EAGLE block-drop semantics while retaining one cache-hit alignment of SWA replay slack consistently in the core manager, direct Mooncake/NIXL transfer clipping, and admission/pool sizing. However, #50897 and #56227 can avoid the same user-visible symptom through alternative designs within their supported scope.
Test Plan
Common Configuration
iaas-gpu-cn-beijing.cr.volces.com/serving/vllm:community_deepseekv41-flash-09090.1.dev20904+g179dd0fa9d117baf57c50309bb17affb501b6f4ec791ba3caDeepSeek-V4.1-Flash
x+aandx+b,max_tokens=1, sent as a first remote load, serial siblings, and overlapping siblingsprefix_repetition, one 65,504-token prefix, 64-token suffix, one same-prefix warmupgenerated-shared-prefix, 64k system prefix, 64-token question, 1,500-token output, concurrency 64, 320 formal requestsGPT-OSS-20B
openai/gpt-oss-20bRedHatAI/gpt-oss-20b-speculator.eagle3prefix_repetition, one 65,504-token prefix, 64-token suffixtemperature=0,ignore_eos=trueRepresentative performance command:
Test Result
DeepSeek-V4.1-Flash Fixed-Engine Correctness
Without the PR, the Decode TP8 single-engine probe recorded zero Decode local APC hits even when the same engine received the serial
x+athenx+brequests. The serial and overlap phases each queried 131,210 prefix tokens, produced zero local hits, and reported full external-prefix hits.With the PR:
65,551, local hit0x+athenx+b: Decode local hit65,472, external hit65,628130,944, external hit156This demonstrates that externally received KV is published into Decode local APC and reused by later same-engine requests.
DeepSeek-V4.1-Flash Prefix-Repetition Performance
All groups completed without failed requests and generated all requested output tokens. Formal TTFT did not include TileLang compilation: compilation completed during service startup, and each formal group ran only after readiness and a same-prefix warmup.
For this random-token prefix-repetition workload, Decode local APC stayed at zero and Decode external prefix cache stayed at 100% in both variants. The measured performance gain was associated primarily with Prefill local APC becoming reusable after one warmup.
DeepSeek-V4.1-Flash 64k/c64 Stress Result
The patched 64k/c64 run completed 320/320 formal requests:
2.16 req/s3247.40 tok/s15817.56 / 27784.90 ms8.14 / 9.57 ms99.31%100.00%0.31%The fixed-engine probe still produced 65,472 serial and 130,944 overlapping Decode local-hit tokens after this stress run, but high-concurrency traffic remained dominated by external-prefix materialization. Concurrent load coalescing and capacity churn are not addressed by this PR.
GPT-OSS-20B + EAGLE3 Performance
Baseline values below are the mean of A1 and A2, except output128 where A2 had one transient router-to-Decode connection reset and A1 is used.
All A1 and PR formal requests succeeded and generated the requested output-token counts. The strict pair result was repeatable: baseline A1/A2 TTFT was
4257.04/4261.85 ms, while the PR result was556.18 ms.On GPT-OSS, Decode local APC remained zero and Decode external prefix cache remained 100% hit for both baseline and patched variants. The performance gain came from Prefill local APC: the pair changed from
0to65,536local-hit tokens, c1 improved from55.49%to86.02%, and c8 improved from93.65%to97.55%. GPT-OSS therefore validates a cross-model end-to-end performance benefit but does not independently validate Decode external-to-local APC publication.AI assistance was used for code analysis, test orchestration, and drafting; the submitter reviewed the changes and end-to-end results.