GPTCache + CacheVerifier: a correctness check for cache hits
GPTCache is the open-source semantic cache for LLM apps. Its SimilarityEvaluation hook is the point where a wrong hit slips through — or gets caught. CacheVerifier drops straight into that hook.
CacheVerifier is a verification layer for semantic caches, not a cache itself. This page is a straight comparison, kept as fair as we can make it — see Why Similarity Fails for the underlying argument.
What GPTCache is
GPTCache (from Zilliz) is the widely-used open-source semantic cache for LLM queries, with built-in LangChain and LlamaIndex integrations. It’s built to be pluggable: you choose the embedding function, the vector store, and the SimilarityEvaluation — the component that decides whether a matched entry is close enough to serve.
The false-positive problem
GPTCache’s own documentation recommends carefully assessing it for false positives on cache hits. Its default evaluator is distance-based, so it inherits the gray-zone limitation: a candidate can clear the similarity bar and still be the wrong answer. GPTCache also ships stronger evaluators you can switch to — an SBERT cross-encoder, an ONNX model (any model you export), Cohere rerank and, on the main branch since September 2026 (not yet in a PyPI release), JEV, which calls TypeSafe’s hosted judge API. What they don’t include is the loop around the check: fine-tuning on your feedback, randomized audits that measure the live error rate, and drift monitoring. That loop is what CacheVerifier adds.
On real Amazon and Comcast support traffic (gptcache 0.1.44), the default distance evaluator served a cached reply to 79–83% of requests, most of them wrong. The learned ONNX evaluator served fewer hits than a fine-tuned CacheVerifier at every matched error rate we tested, and added 60–90 ms per request against about 2 ms. Full comparison.
The drop-in
CacheVerifierEvaluation implements GPTCache’s SimilarityEvaluation interface. You pass it as similarity_evaluation= in cache.init(...) — no fork, no PR. Each candidate gets a cross-encoder correctness check. Pass the evaluator it replaces as fallback: until your workspace has a model of its own, hits are decided by it exactly as before, and direct_hit lets candidates that close skip the check.
from gptcache import cache
from gptcache.similarity_evaluation import SearchDistanceEvaluation
from cacheverifier.integrations.gptcache import CacheVerifierEvaluation
cache.init(
embedding_func=...,
data_manager=...,
similarity_evaluation=CacheVerifierEvaluation(
api_key="cv_...",
fallback=SearchDistanceEvaluation(), # the evaluator it replaces
),
)Full example: examples/gptcache_example.py in the cacheverifier-python repo.
Side by side
| GPTCache’s built-in evaluators | CacheVerifier | |
|---|---|---|
| Decides on | Distance by default; cross-encoder, rerank or LLM judge if you switch | Cross-encoder reading the (query, answer) pair |
| Gray-zone hits | Served or dropped by threshold | Sent for a correctness judgement |
| Adapts to your data | Manual threshold tuning; you can swap in your own ONNX model | Fine-tune on your feedback (optional) |
| Setup | Built in | pip install, pass one argument |
| Cost per lookup | Local compute; a paid API call with Cohere rerank or JEV | One API call on gray-zone candidates (obvious hits/misses skip it) |
When you don’t need it
If your GPTCache traffic is near-duplicate queries with a comfortable similarity margin — FAQ deflection on tightly-scoped phrasing, for instance — the stock evaluation is fine and a verify call is overhead. The adapter earns its place when queries are varied enough that the gray zone is where a real fraction of your hits land.
Details of third-party products reflect their public documentation as of November 2026 (source: the GPTCache repository) and may have changed since — check theirs for the current picture. GPTCache is a project of Zilliz; Zilliz and GPTCache are trademarks of their owner. CacheVerifier is not affiliated with, endorsed by, or sponsored by them; names are used only to identify the products compared.
Where to go next
- • Why Similarity Fails — the gray zone in detail: why a similarity score and a correctness judgement are different questions.
- • Semantic cache similarity thresholds — how the cutoff every semantic cache depends on is set, and the measured ceiling on tuning it alone.
- • Research — measured results on when fine-tuning a verifier helps, how much data it needs, and where it broke.
- • API Reference — how
/v1/verify, fine-tuning, and drift monitoring work mechanically. - • Start free