fix(hybrid): preserve cache reuse and decode under prefill pressure - #583
fix(hybrid): preserve cache reuse and decode under prefill pressure#583logprobz wants to merge 17 commits into
Conversation
…er EAGLE/MTP The full-attention EAGLE lookup drops one block below what it matched, so until a request decodes past the block boundary after its prompt, the only candidate the coordinator can offer a Mamba group is one block below the replay boundary. Latest-only retention (prefix_cache_retention_interval=0, the default) kept exactly the boundary state, leaving every retained state one block above every reachable candidate: the reconciled prefix-cache hit was always zero on hybrid models running MTP/EAGLE spec decode. Measured live on GLM-5.3-Flash (MTP k=3, TP=4): 0 hits across 16,897 queries; per-group lookups on an identical resent 8,901-token prompt returned (6912, 6912, 6912) for the Mamba groups against 4608 for the eagle-dropped full-attention group, reconciling to 0. Keep the state one block below each reachable boundary as well when the group runs under EAGLE. The extra state only materializes where a block boundary coincides with an aligned prefill chunk end (the running-state block), which is how the align-mode scheduler chunks prompts.
…group's drop Two defects found reviewing the first cut, both caught by new tests: 1. The back-off was hard-coded as one Mamba block, but the drop the full-attention finder applies is min(alignment_tokens, its block_size) followed by a re-floor to the alignment -- which lands exactly one ALIGNMENT unit below the boundary either way. When a group's block size differs from the alignment (their LCM), one block is the wrong step: the retained state sits at an offset Mamba's own finder rejects, so the hit stays 0 and the extra block is dead weight. Now computed in tokens via reachable_hit_positions(), which is exact for alignment >, == and < the block size. 2. Retention keyed off the group's OWN use_eagle bit, which is 'this group holds draft layers'. The right predicate is 'some group's lookup shortens the candidate offered to me', since the coordinator reconciles all groups to one hit length. It worked only via the coordinator's flag-all fallback (no annotator exists for glm5_next); the day one lands, the zero-hit bug returns silently. The coordinator now sets lookup_drops_eagle_block on every manager from bool(self.eagle_group_ids). Tests: parametrize the MTP test over the three annotation routes (fallback, full-only, both) and give it real speculative blocks + lookahead; add a differing-block-size test pinning the alignment-unit back-off. Both fail on the previous cut (full_only: 'mamba hash 1 should be cached'; backoff: 'reachable state missing; cached=[5]'). 95/95 in test_prefix_caching.py.
Draft prefill can leave a DCP rank with an empty sequence list. Mark every LSE contribution from that rank as negative infinity before the cross-rank reduction instead of indexing the empty tensor. Assisted-by: OpenAI Codex Signed-off-by: derek <derek.yates@live.com>
Signed-off-by: derek <derek.yates@live.com> Assisted-by: OpenAI Codex
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
#583 is superseded by focused, independently reviewable pull requests:
The prefix-hit correction in #556 is a general local vLLM automatic-prefix- The hybrid-cache diagnostic code from #583 is not being published as a The DFlash-specific replay commits from #583 are also excluded. They were based Original authorship is retained in #556, #560, #589, and #596. |
Purpose
Preserve hybrid prefix-cache reuse and active decode progress when many long prefills compete with decode. This draft consolidates the source behavior validated in the LP15 high-concurrency investigation onto the current
dev/jovian-judgementbase.This is intentionally a draft integration PR. It keeps the existing focused PRs open while maintainers decide whether to review the combined behavior or split it by concern.
Root causes
The incident required fixes in two interacting paths:
The r15 rebase exposed two more shared-path details. Full-attention cache lookup must use the coordinator DCP width, while replicated or non-full groups use width one. Sparse retention must align its primary mask to
prefix_cache_alignment_tokens, not the larger scheduler page.Changes
Decode and prefill scheduling
Hybrid prefix cache
DCP correctness
Related PRs
This draft does not close or modify those PRs.
r15 baseline
Validation uses the immutable image:
Its source lock names
dev/jovian-judgement@9c4dd05487629eccb26d7166459867a3db9b099f, which is also this PR's Git base. The image's exact composition commit is not published to either GitHub fork, so it is used as the installed-source and dependency baseline rather than as an unreproducible Git parent.Exact draft head and tree:
Validation
Pinned r15 CPU-only container, networking disabled, no GPU devices:
The xfail is the optional fine-grained resume checkpoint that this branch does not claim to implement. Added regressions cover decode-burst fairness, partial-prefill bounds, DFlash and Mamba replay boundaries, DCP1 and DCP4 group reconciliation, admission-only metrics, empty DCP ranks, and sparse MLA query gathering.
Changed-file pre-commit 4.3.0 passed Ruff, formatting, mypy, typos, SPDX, forbidden imports, configuration defaults, CUDA API guards, and all applicable repository hooks.
git diff --checkand the source-only scope check also passed.A separate source-locked LP15 image completed a matched 20-agent DCP1 screen and reverse-order repeat against the prior LP8 runtime. It delivered 2.304x and 2.388x job goodput, with p99 ITL at 37.3% and 36.8% of baseline. That evidence motivated this port, but it is not an r15 GPU qualification claim.
Compatibility and gaps
AI assistance
OpenAI Codex assisted with investigation, source reconstruction, tests, and this draft description. The human submitter reviewed the source and accepts the recorded validation and limitations.