Skip to content

Persistent, shareable prefix caches for multi-turn agents #51

In review

Description

@zeekay

Reuse across requests, sessions and compatible workers: prefix-aware scheduling, versioned KV and GDN-state snapshots, tiered storage (RadixAttention, arXiv 2312.07104; tiered KV persistence). Cache keys include model/checkpoint identity, tokenizer, quantization, position encoding, runtime configuration and tenant authorisation; cross-tenant reuse must never expose private state.

Benchmark: the 20-turn developer-agent workload, repeated repository reads, common system prompts, tool-result changes; recomputed tokens and p95 warm TTFT.

Scorecard for every run: cold and warm TTFT, p50/p95 inter-token latency, full agent-loop wall time, peak memory, energy per token, output correctness, quality regression. Record GPU/NPU/CPU architecture, driver, quantization format and commit. Use the shared 4B/9B/27B matrix and the 20-turn coding-agent benchmark; reject changes that win a microbenchmark but regress end-to-end inference. Published speedups are not assumed to transfer to our models without measurement. Licensing: reuse Apache-2.0/MIT sources with attribution; study-only references (non-commercial, unlicensed, papers) get an independent implementation. Open for community research: comment to claim, publish method and raw numbers (bounty; reward terms are set by the maintainers on the issue).

Activity

  1. added
    help wanted
    on Nov 15, 2026
  2. cubaloop commented on Nov 16, 2026

    @cubaloop

    Implementation & Benchmark Proposal: Persistent, Shareable Prefix Caching for Multi-Turn Agents

    We propose implementing the RadixTree-backed persistent KV prefix cache conforming to Hanzo Engine standards:

    1. Deterministic Radix Cache Keys: Cryptographic hashing across (model_id, tokenizer_hash, sys_prompt_prefix, tenant_scope)\ preventing cross-tenant leakage.
    2. Tiered KV Eviction: Two-tier memory paging (VRAM -> Host Pinned RAM) using LRU frequency heuristics for multi-turn conversational agents.
    3. 20-Turn Agent Benchmark: Complete automated harness measuring cold vs. warm TTFT and p95 inter-token latency.

    Ready to provide the reference C++/Python implementation and benchmark suite.

  3. added
    hip-1346
    on Nov 17, 2026
  4. linhsama commented on Nov 29, 2026

    @linhsama

    Hi,

    I will update engine/cache/prefix_store.py to implement the RadixAttention-based tiered storage and cache-key hashing logic. I will verify the changes by benchmarking cold versus warm TTFT and memory usage under the 20-turn coding-agent workload. Please confirm my assignment to this issue, and I will proceed with opening a pull request.

  5. zeekay commented on Dec 2, 2026

    @zeekay
    MemberAuthor

    Production priority from hanzo-inc/cloud#1156. Native cache retention should be capacity/policy-based, not provider 5-minute expiry. Source audit: disk_kv_cache.rs KVC v1 SHA-1 key_for_bytes, prefix_cacher token-byte key, hybrid_contract CacheProvenance optional cache_salt and u64 DefaultHasher. Harden portable checkpoint format first: server-derived tenant/workspace auth, model/tokenizer/template/adapter/precision/runtime/schema digests, keyed cryptographic cache ID, AEAD/KMS, atomic manifest, bounded restore, retention and deletion. Legacy files local-only until validated migration. Preserve complete GDN/conv/attention state. Add actual restart and 30min/6h/24h resume, cross-tenant denial, corruption and model mismatch tests. No prompt-derived public identifiers.

  6. self-assigned this
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bountyhelp wantedhip-1346p1perfresearch

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions