Published February 27, 2026 | Version v1
Preprint Open

ContextCache: Persistent KV Cache with Content-Hash Addressing for Zero-Degradation Tool Schema Caching

Description

ContextCache is a persistent KV cache system that accelerates tool-augmented LLM inference by caching prefilled key-value states of tool schema prefixes with SHA-256 content-hash addressing. On cache hits, only the user query requires prefilling, reducing time-to-first-token by 6.9x (787ms to 114ms) with zero quality degradation — group-cached generation matches full prefill exactly on Tool Selection Accuracy across all evaluation splits. This work also documents a negative result: per-tool independent KV compilation with NoPE/deferred-RoPE fails (TSA ~0.1) due to cross-tool attention dependencies, motivating the group caching design. The system includes disk persistence, a model-agnostic adapter layer (Qwen, Llama, Mistral), FastAPI serving, and a browser-based UI, breaking even after just 2.1 requests.

Files

contextcache.pdf

Files (373.1 kB)

Name Size Download all
md5:a37046fb87d168a1dd15e22e535a757a
373.1 kB Preview Download

Additional details

Software

Repository URL
https://github.com/spranab/contextcache
Development Status
Active