Data & databases

Semantic Caching

AI-assisted editorial review:

Semantic caching reuses a stored response when a new request is sufficiently similar in meaning to a previous one and meets the required context boundaries. Embeddings and vector comparison commonly support the lookup. An acceptable hit can avoid another generation call; embedding, lookup, and storage still have costs. [1][4]

What does Semantic Caching mean in simple terms?

“How do I request a refund?” and “Explain the refund process” may be similar enough to reuse an approved answer. But a question about a different product, customer, or policy version may need a fresh answer. Similar wording is a candidate for reuse, not a guarantee that reuse is correct.

How can Semantic Caching be explained with an analogy?

It is an FAQ desk that recognizes paraphrases but also checks whether the answer applies to the current visitor.

Where is Semantic Caching used?

Case 1

AWS benchmark

AWS evaluated 63,796 chatbot queries and paraphrases using Titan Text Embeddings V2, Claude 3 Haiku, and ElastiCache. At threshold 0.75, reported hit ratio was 90.3%, cached-response accuracy 91.2%, cost $49.50 to $6.80 per day, and average latency 4.35 to 0.51 seconds. These are that benchmark’s results, not a universal threshold recommendation. [2]

Case 2

A game-support assistant

A hypothetical support team caches stable public FAQ answers. It excludes personalized account requests and measures cache-hit latency separately from new generation.

Case 3

Walmart interview

In Portkey’s February 2024 interview report, Walmart’s architect described a tail-query caching rate near 50%, compared with an anticipated 10–20%. This is an attributed account of a particular search use case. [3]

Case 4

Azure Managed Redis

Microsoft documents application and API Management cache paths with prompts, embeddings, responses, and context partitions. Its current tutorial distinguishes RedisVL cosine-distance units from API Management threshold units. Values cannot safely be copied between them without validation. [4]

Learning steps, limitations and developments

01 — Collect permitted, representative requests and identify repeated, stable questions.

02 — Group candidate paraphrases and label examples that must not share an answer.

03 — Evaluate a pilot’s expected savings and risks without treating a 30% duplicate rate as a universal cutoff.

04 — Start with strict matching and explicit user, tenant, model, and version boundaries.

05 — Review cached answers and measure false matches, freshness, hit rate, and total cost before adjusting the threshold.

Limitations and direction: A high hit rate can hide wrong reuse. Expiration and invalidation must follow changes in the information source. Conversation context, permissions, and personal details can make similar questions different. Keep context boundaries and no-cache rules explicit, record when an answer comes from cache, and retest after model or prompt changes. Compare the entire pipeline, since cache misses add lookup work rather than removing generation.

Which sources explain Semantic Caching?

  1. Redis semantic cache — https://redis.io/docs/latest/develop/use-cases/semantic-cache/
  2. AWS benchmark — https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/semantic-caching-benchmarks.html
  3. Portkey Walmart interview — https://portkey.ai/blog/transforming-e-commerce-search-with-generative-ai-insights-from-walmarts-journey/
  4. Microsoft semantic-cache tutorial — https://learn.microsoft.com/en-us/azure/redis/tutorial-semantic-cache