AI GLOSSARY · AI CONCEPTS
Semantic caching
Definition
Semantic caching stores past language-model answers and reuses one when a new question means roughly the same thing, found by comparing embeddings (numeric representations of meaning) instead of matching exact text. It saves model calls when many users ask alike.
Also called: semantic cache, semantic cache LLM.
In plain language
Think of a help desk that keeps a folder of answers. A normal cache only reuses an answer when the question is word for word the same. A semantic cache also recognises that 'How do I reset my password?' and 'I forgot my login' ask for the same thing, and hands back the saved answer without asking the model again. That can cut cost and waiting time for busy apps. The limit is that 'close enough' is a judgement: if the match setting is too loose, a person can get an answer written for a different question, and a saved answer can go out of date. Use it where repeated questions have stable answers.
Technical definition
A semantic cache converts each incoming query to an embedding, searches a vector store of earlier queries for near neighbours, and applies a similarity threshold. Above it, the stored response is returned (a cache hit); below it, the request goes to the model and the new query embedding and response are stored (a miss). The GPTCache project describes a pipeline with an embedding step, a vector store and a similarity evaluator, and contrasts this with exact-match caching. Redis describes tuning the threshold as a trade-off between accuracy and breadth, and time-to-live values for stale answers. Provider prompt caching, such as Anthropic's, is a different mechanism: it reuses an identical prompt prefix.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
llm-cost-estimator 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A monthly LLM cost range built from a usage profile and your own price table, with cache, batch and subscription effects included.
- Why it exercises the concept
- A prefix-cache pricing contrast: this estimator models identical-prefix reuse, not semantic response hits. For a hypothetical semantic-cache scenario, first estimate valid avoided model calls separately, then supply the remaining workload; embedding and lookup costs need separate accounting.
Skill by Skill Almanac · Illustrative, not executed
agent-session-cost-review 58/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A report of where a coding-agent session spent its tokens, read from the saved session transcript by a script.
- Why it exercises the concept
- A transcript spend report can identify repeated reads or expensive phases as candidates for investigation. It does not establish that questions have interchangeable meanings or that a saved answer is still correct.
Guide · Illustrative, not executed
Claude Code Pricing: What Drives Cost and Plan Options
- What you see
- An explanation of how Claude Code usage is billed, including a sample usage output where most tokens were cached context re-read on each turn.
- Why it exercises the concept
- It shows the other kind of caching you meet in agent work, provider prompt caching of an identical prefix, which is easy to confuse with semantic caching.
Coding tool · Illustrative, not executed
Claude Code
- What to try
/usage- What you see
- Claude Code shows plan usage and the session's token use, which the cost documentation breaks down into input, output and cache-read tokens.
- Why it exercises the concept
- It makes the difference visible: cache-read tokens here come from reusing an identical prefix, not from matching questions by meaning.
How it shows up when you use agents
Semantic caching sits in front of a model, usually in an application you or your team builds, such as a support chatbot or an internal question-and-answer tool. Do not infer the caching mechanisms or defaults of every coding product from this definition. One documented mechanism is provider prompt caching, which reuses an identical beginning of the prompt. Anthropic's documentation says cache hits require identical prompt segments. A semantic cache works the other way round: the wording can differ, and an embedding comparison decides whether two questions are close enough.
What breaks when the two are mixed up: a team expects a long coding session to get cheaper because "caching is on", then finds that changed instructions or a changed tool list reset the provider cache. Or a team adds a semantic cache to a workflow where each question depends on live data, and users receive stale or wrong-question answers. Redis's own guide says the similarity threshold needs careful tuning, and that cached data needs a plan for staying consistent with its source.
A sensible next step is to measure first. Examine candidate repeated requests for meaning, user context and answer freshness, then test any threshold before serving cached answers. Estimate valid avoided model calls separately. The LLM cost estimator can price the remaining workload using supplied rates, but its cache option models identical-prefix reuse, not semantic response hits. See inference cost for what is being saved.
Common confusions
- Semantic caching versus prompt caching. Prompt caching reuses an identical prompt prefix inside the provider. Semantic caching matches new questions to old ones by meaning and returns a stored answer without calling the model.
- Semantic caching versus retrieval. Retrieval (see retrieval-augmented generation) fetches documents to help the model write a fresh answer. A semantic cache returns a finished answer that was written earlier.
- Cache hit versus correct answer. A hit means the match score passed the threshold. It does not guarantee the old answer fits the new question.
- Myth: it suits all workloads. Where answers change often or depend on the individual user, a saved answer can mislead; the Redis guide discusses time-to-live settings for this reason.
Related terms
More in AI concepts
Sources
- GPTCache: a library for creating semantic cache for LLM queries, Zilliz (GitHub) (accessed 2026-11-24)
- What is semantic caching? Guide to faster, smarter LLM apps, Redis (accessed 2026-11-24)
- Prompt caching, Anthropic (Claude Docs) (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.
Review record
Last verified
Drafted by Claude (original draft); OpenAI Codex (bounded factual repairs); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .
Change log (5)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : First version.
- : Verifier pass: applied verifier corrections to unsupported or inferred claims.
- : Bounded source repairs: Separated prefix-cache estimator inputs from semantic avoided calls; scoped transcript repetition and removed unsupported cross-product caching-default assertion. Pending independent re-review.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.