← All Terms

Semantic Caching

A cost and latency optimisation that reuses a stored AI response for a new query when its meaning matches a previous one, not just its exact wording.

Implementation

A conventional cache only helps when a request is repeated word for word, which rarely happens with natural-language queries. Semantic caching solves that by comparing the meaning of an incoming query, via its embedding, against previously answered queries, and serving the stored response whenever the new one is close enough in meaning, even if the wording is completely different.

The payoff is direct: every cache hit skips a full model call, cutting both latency and token spend on the queries a system sees over and over in slightly different phrasing, which in a high-volume production workload is often a large share of total traffic. The risk is getting the similarity threshold wrong, set it too loose and the system starts returning a cached answer to a question that actually needed a fresh one.

It’s one of the first levers worth pulling once a workload moves from pilot to production, because it’s one of the few optimisations that reduces cost without touching model quality.