An engineer who has spent time building an LLM gateway says semantic caching is one of the most overhyped features in the space, and his own data backs the claim. In an analysis of 15,000 prompts from 2,500 Codex sessions, nearly every cache hit a semantic cache would have returned was wrong.
It’s the first part of a planned series on AI gateway features that promise more than they deliver.
What semantic caching promises
Traditional caches need an exact match. Semantic caching tries to reuse answers for queries that merely mean the same thing. “What is the capital of France?” and “Which city is the capital of France?” could both return a stored “Paris.”
A cache hit is close to free in both latency and cost, which makes the pitch attractive. The author recalls a demo around 2023 that showed theoretical million-dollar savings from caching similar “Hello” requests. Real traffic looked nothing like that demo.
Why it breaks down
- Context: most real requests carry details specific to the moment, such as the logged-in user, the date or the working directory. That limits how often an old answer applies.
- Agents: in multi-turn requests, the cache key is either the whole conversation, which almost never repeats, or the last message alone, which drops the meaning.
- Similar isn’t identical: “Convert 100 USD to EUR” and “Convert 100 EUR to USD” mean different things but look alike to a similarity score.
- False sharing: without user context in the key, one person’s cached answer could be served to another and expose sensitive conversation details.
What 15,000 real prompts showed
The author tested three ways of choosing what to look up, at similarity thresholds of 0.90 and 0.99.
Looking only at each prompt gave a 5% to 17% hit rate, but every hit was a false positive. Typical examples were “wdyt,” “fix it,” “keep going” and “review the local change.” All depend on earlier messages.
Looking only at the first prompt of a session gave 8% to 20%. That seems safer, since no earlier context is missing, yet all the hits would have been harmful. Many prompts were identical but aimed at different repositories. Others were deliberate repeats. Near matches like “fix issue 1234” and “fix issue 1243” are close in meaning to a model and different in reality. The only plausible true hits were “hello” prompts, and those were the author testing connectivity or model availability, where a cached reply would hide the result.
Using the full prompt while ignoring system prompts and model responses produced 16% to 68% within the same conversation. That number is high because a long conversation plus one new message looks nearly the same as the conversation alone. A hit would return the previous answer and ignore the new message. Across sessions only, the rate dropped to 1% to 3%, with the same false hits as before.
The verdict for coding agents
By the author’s count, there were essentially no cases where semantic caching would have helped, even with an exact-match threshold. The false positive rate was extremely high.
He allows one exception. Simple support-bot use cases, where questions are predictable and depend little on context, may still benefit. As more applications lean on tools and surrounding context, he expects its usefulness to shrink further. Even a single tool in a request can make a cache hit invalid.
What comes next in the series
Part two covers prompt compression and is marked as coming soon, and a third installment is planned. The author says the series is meant to separate what these features promise from what they actually deliver, since benchmarks in this area are often cherry-picked or outright fabricated. For teams evaluating a gateway, the takeaway is to test semantic caching on your own traffic before trusting vendor savings figures. Measure false positives, not just hit rates, because a high hit rate can simply mean the cache is returning the wrong answer more often.
Source: howardjohn's blog