vCache: Verified Semantic Prompt Caching

Luis Gaspar Schroeder, Aditya Desai, Alejandro Cuadron, Kyle Chu, Shu Liu, Mark Zhao, Stephan Krusche, Alfons Kemper, Matei Zaharia, Joseph E. Gonzalez

Semantic caching saves Large Language Model (LLM) compute costs by reusing answers for similarly phrased prompts. However, current systems rely on static similarity thresholds that cause unpredictable and often high error rates. vCache introduces the first semantic cache with user-defined error guarantees by dynamically learning optimal, embedding-specific thresholds online. It achieves up to 12.5$\times$ higher cache hit rates and 26$\times$ lower error rates than state-of-the-art baselines, making LLM caching reliable enough for production.

The Problem: The Threshold Dilemma

LLMs are expensive and slow. To mitigate this, developers use prompt caching: if a user asks a question the system has already answered, it returns the cached response instead of running the model again. Because users phrase things differently ("What is Canada's capital?" vs. "Which city is the capital of Canada?"), semantic caching uses vector embeddings to find "close enough" matches rather than exact string matches.

The glaring flaw in existing semantic caches (like GPTCache) is how they decide if a prompt is "close enough." They use a single, global, static similarity threshold (e.g., a cosine similarity of 0.8). This creates a "threshold dilemma": the similarity scores of correct and incorrect cache hits heavily overlap.

Density of similarity values for hits vs. misses and the wide distribution of optimal thresholds.

As shown above, a fixed threshold is either too low (returning wrong answers) or too high (missing cache opportunities). Furthermore, the optimal similarity threshold varies drastically depending on the specific prompt. Some concepts in embedding space are tightly clustered, while others are broad. A single threshold across all embeddings is mathematically doomed to be suboptimal and offers zero formal guarantees on correctness.

The Solution: Dynamic, Per-Prompt Boundaries

vCache replaces the static, global threshold with a dynamic, probabilistic policy that learns on the fly. Instead of one global rule, vCache learns a separate decision boundary for each individual prompt stored in the cache.

Comparison of existing static cache decision boundaries versus vCache's dynamic, per-prompt boundaries.

How vCache Works

  1. Sigmoid Probability Fit: For a given cached embedding, vCache tracks the history of incoming similar prompts. It uses Maximum Likelihood Estimation (MLE) to fit a logistic sigmoid curve, modeling the exact probability that a cache hit will be correct based on its similarity score.
  2. Explore vs. Exploit: The user defines a maximum acceptable error rate ($\delta$). Using the sigmoid model and confidence bounds, vCache calculates an exploration probability ($\tau$).
  3. Explore: With probability $\tau$, the system ignores the cache, runs the actual LLM, and uses the result to check if the cache would have been right. This updates the metadata for future decisions.
  4. Exploit: Otherwise, it confidently returns the cached answer.

This randomized, multi-armed bandit-style approach ensures the system explores just enough to guarantee the user's error bound is never exceeded, while maximizing cache hits when confidence is high.

Datasets and Key Results

Because no standard open-source benchmarks existed for semantic caching, the authors created four new benchmarks reflecting real-world workloads: SemCacheLMArena (chatbot queries), SemCacheClassification (structured classification), SemCacheSearchQueries (web search), and SemCacheCombo (hybrid).

Testing across these datasets revealed massive improvements over existing methods:

  • Strict Error Compliance: Across all datasets and embedding models, vCache consistently kept the actual error rate below the user-specified bounds (e.g., staying under a requested 1% or 2% error limit).
  • Massive Efficiency Gains: At the same error rate, vCache achieved up to 12.5$\times$ higher cache hit rates compared to static-threshold baselines.
  • Drastic Error Reduction: When matched for latency and cache hit rates, vCache reduced error rates by up to 26$\times$ compared to GPTCache.
  • Negligible Overhead: The online logistic regression and $\tau$ computation add less than 1.5 milliseconds of latency per request, making the overhead effectively zero compared to an LLM forward pass.

Limitations

While highly effective, vCache has a few limitations. For long-form text, simple string matching cannot determine if a cached response and a newly generated response mean the same thing. vCache relies on an "LLM-as-a-judge" to evaluate correctness during the "explore" phase, which incurs an extra background LLM inference cost. Additionally, the mathematical guarantees rely on the assumption that incoming prompts are independent and identically distributed (i.i.d.); sudden, drastic shifts in user traffic distributions could temporarily challenge these assumptions.

Summary updated

BibTeX
@inproceedings{schroeder2026vcache,
  author = {Luis Gaspar Schroeder and Aditya Desai and Alejandro Cuadron and Kyle Chu and Shu Liu and Mark Zhao and Stephan Krusche and Alfons Kemper and Matei Zaharia and Joseph E. Gonzalez},
  title = {{vCache: Verified Semantic Prompt Caching}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=zF0A0xw3HZ},
}
Figure