Skip to content

[Bounty #19] Non-prefix RAG KV fusion · engine / index (CacheBlend) #98

Closed as not planned

Description

@zeekay

Umbrella HIP: HIP-1345: Agent-Aware Model Serving and Cache Reuse (hanzoai/hips)
Bounty Class: Research + Implementation Bounty
Primary Research / Code: CacheBlend

Objective & Acceptance Test

Reuse cached retrieved-document KV blocks inside changing prompt layouts with selective cross-block recomputation across hanzo-engine and hanzoai/index. Measure TTFT and answer-quality parity against full prefill.

Scope & Canonical Architecture

Distinct from hanzoai/engine#51 prefix-only caching.

Canonical stack boundaries MUST stay intact (vfs -> hanzoai/s3 -> visor, Cloud owning lifecycle & billing, Enso routing models, Zen generating outputs, Kai returning structured non-generative decisions). Reported figures in referenced FAST/conference papers belong strictly to the original authors' environments and MUST NOT be treated as Hanzo expectations until reproduced here.

Research-to-PR Acceptance Contract (0 of 6 requirements)

  • 1. Paper & License Audit: Link primary paper/code, summarize design, and verify license compatibility (prefer Apache-2.0/MIT for production merges; clean-room implementation or research-only report otherwise) and patent restrictions.
  • 2. Matched Baselines: Provide reproducible upstream baseline and identical Hanzo baseline scripts/configs.
  • 3. Falsifiable Hypothesis: Document target metrics and expected failure modes up front.
  • 4. Deliverable: Submit bounded implementation PR (Implementation Bounty) or documented reproducible experiment including valid negative results (Research Bounty).
  • 5. Evidence & Safety: Include correctness, concurrency, multi-tenant isolation, security, and regression tests appropriate to the subsystem.
  • 6. Measurements & HIP Update: Publish raw before/after measurements, methodology, and status update against HIP-1345.

Activity

  1. added
    help wanted
    on Nov 16, 2026
  2. breezesamuel commented on Nov 17, 2026

    @breezesamuel
    Contributor

    Claiming this bounty as first-mover.

    Starting initial research phase:
    • Primary paper/code audit + license compatibility check
    • Matched baseline design draft
    • Falsifiable hypothesis formulation

    Publishing methodology document within 24h.

    — breezesamuel

  3. breezesamuel commented on Nov 17, 2026

    @breezesamuel
    Contributor

    Deliverable: Draft PR #105 (composition planner, fabric tier, Phase 1)

    #105

    • hanzo-kv-fabric/src/composition.rs: CompositionPlanner — per-chunk reuse/recompute decisions with signed position shifts, clamped selective-recompute windows (CacheBlend head-window recompute), fail-closed reasons (UnknownChunk, EmptyChunk, AmbiguousDuplicate, OffsetOverflow), reusable/recompute token accounting, and prompt-order violation counting the scheduler can enforce.
    • hanzo-kv-fabric/examples/composition_bench.rs: two-turn RAG session with shuffled retrieval order + one fresh document.
    • 11 new tests: cargo test -p hanzo-kv-fabric — 14/14 pass on this tree (11 new + 3 upstream), zero warnings.

    Measured (release build, identical workload for baseline and planner):

    turn 1 prompt: 896 tokens (system + docB + docA + docC + question)
    strict prefix cache           : 64/896 reusable, prefill 832 tokens
    composition planner           : 3 reuse, 1 recompute, order_violations 0
      reuse system  shift    +0 window 0 tokens
      reuse docB    shift  -256 window 16 tokens
      reuse docA    shift  +256 window 16 tokens
      recompute docC  (never cached)
    reusable from cache           : 544 tokens (planner) vs 64 (prefix-only)
    total compute (composition)   : 352 tokens = 32 windows + 256 uncached doc + 64 fresh question
    compute reduction vs prefix   : 57.7%
    

    Acceptance contract: (1) ✔ CacheBlend (arXiv 2405.16444) audit — concept-only, clean-room, no reference code consulted; (2) ✔ strict prefix cache on the identical workload is the baseline; (3) ✔ hypotheses + failure modes in the module docs; (4) ✔ this bounded PR; (5) ✔ tests above; (6) partial — compute reduction measured at fabric level; attention-path mask/window enforcement and the HIP-1345 §2.4 update are Phase 2.

    The planner input is deliberately decoupled from any directory implementation, so the scheduler can feed it from a segment directory lookup, a document store, or tests. No new dependencies, no workspace changes.

  4. zeekay commented on Nov 21, 2026

    @zeekay
    MemberAuthor

    Duplicate of #90; continue there. Open PRs are retargeted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountyhelp wantedperfresearch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions