Scaling Chat

What is semantic caching, and does it work for AI chat?

Semantic caching stores each question as an embedding with its answer and, when a new question is similar enough, returns the stored answer without calling the model. It works best for repeated, self-contained questions such as opening hours; it is risky for chat that depends on the customer, the order or the turn before, because similar wording can mean a different request. Redis documents a savings estimate of monthly output-token cost multiplied by cache hit rate, and notes that input-token savings are typically offset by embedding and storage costs; a MeanCache study found about 31% of 27,000 ChatGPT queries from 20 users were similar to an earlier query by the same user.

What is semantic caching?

A normal cache matches a request exactly. A semantic cache matches by meaning. Redis describes its LangCache service this way: it checks whether a semantically similar prompt has been answered before and returns the cached response with no LLM call; when there is no match, the app calls the LLM and stores the result. The open-source GPTCache library describes the mechanism: convert each query to an embedding, search a vector store for similar queries and return the stored response if one is close enough, with a configurable similarity threshold.

It is not the same as the prompt caching covered in cost control. Anthropic's prompt caching documentation says the API resumes from a cached prefix of the prompt, so the model still generates a new answer. A semantic cache replaces the model call.

Prompt caching Semantic caching
What is reused The processed prompt prefix The finished answer
Matching rule The same prefix A similar enough question (a similarity threshold you set)
Does the model still answer? Yes No, on a hit
Risk of a wrong answer No new risk from the cache Yes: a false hit returns a stored answer to a different question
Where it lives At the model vendor In your own system or a caching service

Does it work for chat?

There is real repetition to exploit. The MeanCache paper (Gill et al., 2024) recruited 20 regular ChatGPT users and analysed 27,000 queries in a privacy-preserving way. It reports that 31% of a user's queries were similar to at least one earlier query by the same user. That is a study of personal ChatGPT use, not customer-service traffic, so measure your own.

The risk is also named in the sources. GPTCache's documentation says a semantic cache can suffer false positives on hits and false negatives on misses, and offers hit ratio, latency and recall as the metrics to track. The MeanCache authors say that a threshold set too low can retrieve irrelevant queries and cause numerous false hits.

Here is an illustration of why chat is harder. "Can I cancel my order?" and "Can I cancel my subscription?" are close in wording but need different answers, and "What about the second one?" means nothing without the previous turn. This example is illustrative, not a measured result.

Worked example: what could it save?

Redis gives this estimate: monthly savings equal the monthly output-token cost multiplied by the cache hit rate, and input-token costs are typically offset by embedding and storage costs. Its own example is $200 of spend, 60% of it output tokens and a 50% hit rate, giving $200 x 60% x 50% = $60 a month.

Apply the same formula to a hypothetical chat system with a $5,000 monthly API bill, of which 55% is output tokens:

Cache hit rate Output-token cost Estimated saving
10% $2,750 $275
20% $2,750 $550
40% $2,750 $1,100

Every figure is arithmetic on assumed inputs. The number that decides the result is the share of hits that return a correct answer, so count wrong hits as well as hit rate.

What to do

  1. Pull a month of questions, and count how many are self-contained and the same for every customer (hours, policies, definitions). Only those are candidates.
  2. Do not cache answers that depend on the customer, the account or earlier turns.
  3. Pick the similarity threshold by testing pairs of questions from your own logs that should and should not match, not by default.
  4. Set an expiry on every entry and clear entries when a policy changes.
  5. Sample cache hits each week, and count wrong ones as well as the hit rate (see evaluation).
  6. Compare the saving with the cost calculator before building.

Related

How do you cut the cost of running an AI chat system?, AI chat cost calculator, Routing AI chat requests, Evaluating AI chat answers.

Sources

Read November 19, 2026:

Frequently asked questions

What is the difference between semantic caching and prompt caching?
Prompt caching, as Anthropic documents it, lets the API resume from a cached prompt prefix, so the model still writes a fresh answer. Semantic caching skips the model call and returns a stored answer, so it saves output tokens too but can return a wrong one.
What can go wrong with a semantic cache?
GPTCache's documentation names false positives on hits, where a stored answer is returned for a question that needed a different one, and false negatives on misses. MeanCache's authors note that a threshold set too low leads to numerous false hits.
Should I cache answers that mention a customer''s account or order?
No, not in a shared cache. The answer depends on private data and changes over time. Cache only answers that are the same for every customer, and give each entry an expiry.