Repository navigation
hanzo-kv-fabric: non-prefix RAG KV composition planning (CacheBlend / HIP-1345 s2.4, Bounty #19) - #105
Conversation
|
Thanks, the CacheBlend composition planner in |
|
Noted — keeping
Will push the follow-up commit to this branch rather than opening a second PR, so the contract is visible in one place. Happy to split it out if you prefer. — breezesamuel |
Follow-up commit pushed — contract completion — head
|
…HIP-1345 s2.4, Bounty hanzoai#19)
…w-up) Completes the four remaining contract items from review: - Matched baselines: strict prefix cache vs composition planner on the identical two-turn shuffled-retrieval fixture - committed as hanzo-kv-fabric/results/cacheblend-results.json - Raw measurements: prefix-only 64/896 reusable (prefill 832) vs planner 544/896 (8.5x), compute 832 -> 352 tokens (-57.7%), recompute 1 (never-cached doc), silent order violations 0 - HIP-1345 update: results/HIP-1345-update.md proposes the §2.7 status addendum (§2.7 = Bounties hanzoai#19-hanzoai#20; the §2.4 label in the first cycle was a mislabel - §2.4 is Bounties hanzoai#14-hanzoai#15) - section refs corrected in module docs and the bench - Out-of-scope statement: explicit 6-item list (KV blending math, cross-segment attention routing, TTFT/quality parity, tenant pinning interplay, runtime eviction, Bounty hanzoai#20)
Per the live HIP text: Bounties hanzoai#14-hanzoai#15 = §2.4 (LoRA paging), Bounties hanzoai#19-hanzoai#20 = §2.7 (non-prefix RAG KV fusion).
a4c19c9 to
daee7b1
Compare
Bounty #19 (engine#90) — Non-prefix RAG KV fusion · composition planner
Refs #90. Phase 1 (bounded) of the CacheBlend integration: the composition planning layer inside
hanzo-kv-fabric. No device I/O, no attention-path changes, no new dependencies, no workspace changes.1. Paper & License Audit
ChunkMeta/CompositionRequest/ decisions), not a translation of upstream code.2. Matched Baselines
Fabric-level (no GPU required): the baseline is strict prefix caching on the identical two-turn RAG workload — turn 1 shares only the system prompt with turn 0, so 832 of 896 tokens are re-prefilled. The planner runs on the same layout. Reproduce:
GPU-side TTFT/memory baselines require a GPU host and are Phase 2.
3. Falsifiable Hypothesis
Failure modes documented: recompute windows that are too small degrade answer quality (attention-path validation is Phase 2); planner totals exclude uncached ranges the scheduler must prefill.
4. Deliverable (this PR)
hanzo-kv-fabric/src/composition.rs—CompositionPlanner: per-chunk reuse/recompute decisions with signed position shifts, clamped selective-recompute windows, fail-closed reasons (UnknownChunk,EmptyChunk,AmbiguousDuplicate,OffsetOverflow), reusable/recompute token accounting, and prompt-order violation counting for the scheduler to enforce.hanzo-kv-fabric/examples/composition_bench.rs— two-turn RAG session with shuffled retrieval + one fresh document, measuring planner decisions and compute reduction vs the strict-prefix baseline.5. Evidence & Safety
11 new tests cover: boundary-only recompute on fully cached chunks, shift correctness, unknown/empty/ambiguous/overflow fail-closed paths, identical duplicates not flagged ambiguous, window clamping and per-request override, order-violation counting, and mixed-decision totals consistency. Full crate:
cargo test -p hanzo-kv-fabric— 26/26 pass (24 from this PR's tree + 3 upstream).6. Measurements & HIP Update
Raw counters from the example (release build):
HIP-1345 §2.7 status update to follow in
hanzoai/hipswhen the scheduler integration (attention-path mask/window enforcement + real-KV stitching) is scoped — intentionally not bundled here to keep this PR bounded and reviewable.Not in this PR (Phase 2+)
Follow-up commit pushed (contract completion): matched-baseline token-accounting table, raw measurements (prefix-only
64/896reusable / prefill832vs planner544/896reusable / compute352,-57.7%; recompute1; silent order violations0) committed ashanzo-kv-fabric/results/cacheblend-results.json; HIP-1345 status addendum proposed inresults/HIP-1345-update.md(§2.7 — the §2.4 label in this description was a mislabel per the live HIP text and has been corrected); explicit out-of-scope statement included.