Book a demo →

Semantic Caching

Definition

What semantic caching is: how AWS, Redis, Microsoft and Google docs describe it, how the similarity threshold works and what papers report on wrong hits.

In short

Semantic caching stores the answer a language model gave, together with an embedding of the prompt, and returns that stored answer when a later prompt is similar enough. A similarity threshold decides what counts as similar. Cloud and database documentation describe the method, and a paper from November 2026 measures how often a loose threshold returns a wrong answer.

What is semantic caching?

Semantic caching means that an application stores the answer a language model gave to a prompt and returns that stored answer when a later prompt asks the same thing in other words. Four documentation pages, retrieved on 5 December 2026, describe it in these words:

Company and pageWording
Amazon ElastiCache, “Overview of semantic caching” (no date on the page)“Unlike traditional caches that rely on exact string matches, a semantic cache retrieves data based on semantic similarity.”
Redis, “Redis semantic cache” (no visible date; the page metadata gives 26 November 2026 as the date modified)“Reuse LLM responses for queries that are semantically similar, not just byte-identical, to cut token costs, reduce latency, and share validated answers across users and sessions.”
Microsoft, Azure API Management policy reference “llm-semantic-cache-lookup” (page shows “Last updated on 2026-08-19”)“Use the llm-semantic-cache-lookup policy to perform cache lookup of responses to large language model (LLM) API requests from a configured external cache, based on vector proximity of the prompt to previous requests and a specified score threshold.”
Google Cloud, Apigee “SemanticCacheLookup policy” (page shows “Last updated 2026-12-05 UTC”)“The policy uses the Vertex AI Text embeddings API to generate embeddings for text and Vector Search to find similar prompts based on semantic similarity, rather than exact matches.”

Amazon and Google set semantic similarity against exact matching, Redis against byte-identical queries. Microsoft speaks of vector proximity and a score threshold. Some research papers use the words prompt caching for this idea, too; the entry on prompt caching sets out both meanings of that term.

How does semantic caching work?

The cache turns each prompt into an embedding, a vector of numbers that represents its meaning (see the entry on embeddings). Amazon's page describes the comparison: “The system compares the vector embedding of each new query against cached vectors of prior queries to determine if a similar query has been answered before.” The two outcomes follow in the next sentences of the same page: “If the cache contains a similar query above a configured similarity threshold, the system returns the previously generated response instead of invoking the LLM.” and “Otherwise, the system invokes the LLM to generate a response and caches the query embedding and response together for future reuse.”

Version 5 of the paper by Schroeder et al. (arXiv 2502.03771, 21 February 2026) says that semantic caches “embed cached prompts and store them alongside their response in a vector database”. The entry on vector databases covers stores of this kind. Google's Apigee page states which stored entry counts when several are close: “The highest matching data point, based on the similarity threshold, is the only data point used.”

For the application, a hit means that no model call takes place. Fu Bang's paper on GPTCache (Proceedings of NLP-OSS 2023, December 2023) puts it this way: “If GPTCache has the answer to a query, it quickly returns the answer to the user without having to query the LLM.”

The path of a request as Amazon's ElastiCache documentation describes it (no date on the page, retrieved 5 December 2026).

The similarity threshold and wrong answers

The threshold decides whether a stored prompt counts as close enough. Microsoft's page names the risk of answering by similarity: “Because semantic caching returns responses based on similarity (not exact match), it can surface responses that are incorrect, outdated, or unsafe for the current request.”

Microsoft writes about the score threshold of its policy: “The value ranges from 0.0 to 1.0. Lower values require higher semantic similarity for a match.” Google's Apigee page ties the direction of the threshold to the measure of the index and lists four measures: “dot product is a similarity, so a larger value means a closer match, while the other three are distances, where a smaller value does.”

Documentation and paper abstracts on thresholds and on what similarity does and does not tell, each with its date and version:

Source and versionWording
Microsoft, Azure API Management (page shows “Last updated on 2026-08-19”)“Start with a low value such as 0.05 and adjust to optimize the ratio of cache hits to misses. Score threshold above 0.2 may lead to cache mismatch.”
Redis, “Redis semantic cache” (metadata: modified 26 November 2026)“The core difficulty is threshold tuning: too loose and you serve wrong answers, too tight and the hit rate collapses.”
Zhu, Zhu and Jiao, arXiv 2402.01173, version 1 (2 February 2024)“The existing embeddings of prompts mostly focus on whether two prompts are semantically similar, which is not necessarily equivalent to whether the same response can answer them.”
Schroeder et al., arXiv 2502.03771, version 1 (6 February 2025)“We show that this one-size-fits-all threshold is insufficient across different prompts.”
Schroeder et al., arXiv 2502.03771, version 5 (21 February 2026)“However, we observe that static thresholds do not give formal correctness guarantees, result in unexpected error rates, and lead to suboptimal cache hit rates.”
Xin and Abouelseoud, arXiv 2611.40702, version 1 (30 November 2026)“Semantic caches reuse an LLM's past answer when a new query is similar enough to an old one, but similarity is not correctness: on the benchmarks studied here, a loose static threshold serves a wrong answer on 11-34% of requests.”

Singh et al. (arXiv 2602.13165, version 2, 12 March 2026) start from the same problem in a setup with two cache tiers: “In practice, both tiers are commonly governed by a single embedding similarity threshold, which induces a hard tradeoff: conservative thresholds miss safe reuse opportunities, while aggressive thresholds risk serving semantically incorrect responses.” Their system, Krites, adds a check close to the threshold: “When the nearest static neighbor of the prompt falls just below the static threshold, Krites asynchronously invokes an LLM judge to verify whether the static response is acceptable for the new prompt.” The entry on LLM-as-a-judge explains what an LLM judge is.

Semantic caching, exact-match caching and prompt caching

An exact-match cache answers only an identical request. Cloudflare's AI Gateway documentation (page shows “Last updated Nov 29, 2026”) describes its cache in these terms: “When caching is enabled, AI Gateway can cache responses from your AI model providers, serving them directly from Cloudflare's cache for identical requests.” and “This means caching is based on exact match of the entire request.”

Amazon's page gives an example with three differently worded questions about setting up a VPN. On the exact-match side: “An exact-match cache treats each query as unique and invokes the LLM three times.” On the semantic side: “A semantic cache recognizes these queries as semantically equivalent and returns the cached response for all three, invoking the LLM only once.”

With prompt caching, the model provider stores the already processed start of a prompt, and the model generates a fresh response each time; the entry on prompt caching quotes the providers. Cloudflare's page refers to its own prompt caching page for that case: “To reuse prompt prefixes at the provider instead, refer to Prompt caching.” The Redis page sets its product against provider prompt caching: “Skipping the cache and relying on prompt caching at the model provider discounts repeated prefixes but still runs the model end-to-end on every call, so it does not address latency or full-response reuse across users.”

Retrieval-augmented generation also looks up text by similarity, and Redis separates the two: “Semantic caching stores complete LLM responses, not document chunks, and the goal is to skip the LLM entirely on a hit rather than feed retrieved context into one.” The entry on retrieval-augmented generation covers that method.

Scope, keys and freshness

The documentation describes how cache entries are kept apart. Microsoft's policy can split them by user: “Control cross-user access to cache entries by specifying vary-by with specific user or user-group identifiers.” The same page defines the vary-by value as “A custom expression determined at runtime whose value partitions caching.” Redis names the boundaries it applies: “Effective semantic caching combines soft similarity matching with hard metadata boundaries (tenant, locale, model version, safety flags) so reuse stays inside well-defined limits.”

Stored answers also expire. Redis writes about the time to live (TTL) of an entry: “EXPIRE sets a TTL on each cache entry so stale answers age out without manual cleanup, keeping the cache aligned with the underlying knowledge base.”

Wang et al. (arXiv 2510.26835, version 1, 29 October 2025) argue against one setting for all queries: “fixed thresholds cause false positives in dense spaces and miss valid paraphrases in sparse spaces; fixed TTLs waste memory or serve stale data”. Their proposal: “This paper presents category-aware semantic caching where similarity thresholds, TTLs, and quotas vary by query category.”

Poisoning and key collisions

Two papers treat the semantic cache as a target for attacks. Zhang et al. (arXiv 2601.23088, version 1 of 30 January 2026; version 2 of 30 June 2026 carries the same abstract) write: “we conceptualize semantic cache keys as a form of fuzzy hashes”. From this they derive a conflict: “We demonstrate that the locality required to maximize cache hit rates fundamentally conflicts with the cryptographic avalanche effect necessary for collision resistance.”

A second paper, with a different author list and a different first author, also by Zhang et al. (arXiv 2609.35908, version 1, 28 September 2026), describes poisoning: “This design enables cache poisoning: an attacker can cache a malicious response under a query with high cosine similarity to benign requests.” The authors name the cause: “The vulnerability stems from a gap between retrieval similarity and answer validity.”

Products and projects that describe semantic caching

Each row quotes what a page says about its own feature, with the date the page shows. The order is alphabetical.

Product and pageWording
Amazon ElastiCache (no date on the page)“In generative AI applications, a semantic cache stores vector representations of queries and their corresponding responses.”
Google Cloud Apigee, SemanticCacheLookup (page shows “Last updated 2026-12-05 UTC”)“This policy works in conjunction with the SemanticCachePopulate policy.”
GPTCache, README in the GitHub repository zilliztech/GPTCache (README last changed 9 July 2025, according to the repository page)“we no longer add support for new API or models”
Microsoft Azure API Management, llm-semantic-cache-lookup (page shows “Last updated on 2026-08-19”)“This policy must have a corresponding Cache responses to large language model API requests policy.”
Redis LangCache (no visible date; metadata: modified 3 November 2026)“LangCache checks whether a semantically similar prompt has been answered before and returns the cached response instantly: no LLM call required.” and “LangCache is currently available in preview. Features and behavior are subject to change.”

Fu Bang's paper describes GPTCache as “an open-source semantic cache that stores LLM responses”, and the README calls it “a project dedicated to building a semantic cache for storing LLM responses”. The GitHub API reported on 5 December 2026 a last push on 22 September 2026, version 0.1.44 of 1 August 2024 as the latest release, and a repository that is not archived. The documentation page “GPTCache Quick Start” shows “Last updated on Aug 08, 2023.”

Names and dates in the sources

Documentation and papers use both forms, semantic cache and semantic caching. Titles and figures in the papers changed between versions:

PaperVersions
Gill et al., arXiv 2403.02694Version 1 (5 March 2024) is titled “Privacy-Aware Semantic Cache for Large Language Models”, and its sentence on repeated queries ends without a figure. Version 4 (7 March 2025) is titled “MeanCache: User-Centric Semantic Caching for LLM Web Services” and reads: “Caching is a natural solution to reduce LLM inference costs on repeated queries, which constitute about 31% of the total queries.”
Regmi and Pun, arXiv 2411.05276The abstract of version 1 (8 November 2024) contains no percentages. Version 2 (3 December 2024) adds the authors' experimental result: the system “reduces API calls by up to 68.8% across various query categories, with cache hit rates ranging from 61.6% to 68.8%”, and the abstract does not name the data the experiments used. Version 3 (9 December 2024) keeps the abstract of version 2.
Baral et al., arXiv 2606.19719Versions 1 (18 June 2026) and 2 are titled “Closing the Calibration Gap in Semantic Caching” and name a “Calibration Retention Rate (CRR)”. Versions 3 (28 August 2026) and 4 (1 September 2026) are titled “Closing the Operational Gap in Semantic Caching” and name an “Operational Retention Rate (ORR)”.

The paper by Schroeder et al. also changed its title between version 1 and version 5; the entry on prompt caching quotes both titles.

Other meanings of “semantic cache”

The term also names caches that hold something other than model answers to similar prompts. Bindschaedler (arXiv 2602.19811, version 1, 23 February 2026) uses it for analytical database queries: “Reuse requires exact intent matches under strict schema validation and confidence-gated NL acceptance”. Yu and Zhao (arXiv 2304.08096, version 1 of 17 April 2023, version 2 of 27 April 2023) use it in work on semantic communications and edge computing, where models are stored: “this paper proposes a semantic caching model in edge computing system that caches domain-specialized general models and user-specific individual models”.

Dated papers on semantic caching for language models in this entry.

Prompt caching. A provider stores the already processed start of a prompt between requests; the entry on prompt caching also covers the second meaning of the term in research.

KV cache. A model stores intermediate attention data during generation; the entry on the KV cache explains what is kept and how it grows.

Embeddings. A semantic cache compares prompts through their embeddings; the entry on embeddings explains how text becomes a vector.

Vector database. Stored prompt embeddings are searched by similarity; the entry on vector databases covers stores built for that search.

Semantic search. Semantic search finds documents by meaning; the entry on semantic search covers it, while a semantic cache looks up a stored answer.

Source

  • Amazon Web Services, “Overview of semantic caching” (Amazon ElastiCache documentation, no date on the page). Source for the Amazon wording and the VPN example (retrieved 2026-12-05): https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/semantic-caching-overview.html
  • Redis, “Redis semantic cache” (no visible date, metadata modified 2026-11-26). Source for the Redis wording on thresholds, boundaries, TTL, RAG and prompt caching (retrieved 2026-12-05): https://redis.io/docs/latest/develop/use-cases/semantic-cache/
  • Redis, “Redis LangCache” (no visible date, metadata modified 2026-11-03). Source for the LangCache wording (retrieved 2026-12-05): https://redis.io/docs/latest/develop/ai/langcache/
  • Microsoft, “Azure API Management policy reference - llm-semantic-cache-lookup” (page shows “Last updated on 2026-08-19”). Source for the Microsoft wording on threshold, risk and vary-by (retrieved 2026-12-05): https://learn.microsoft.com/en-us/azure/api-management/llm-semantic-cache-lookup-policy
  • Google Cloud, “SemanticCacheLookup policy” (Apigee documentation, page shows “Last updated 2026-12-05 UTC”). Source for the Apigee wording on embeddings, measures and populate policy (retrieved 2026-12-05): https://cloud.google.com/apigee/docs/api-platform/reference/policies/semantic-cache-lookup-policy
  • Cloudflare, “Caching” (AI Gateway documentation, page shows “Last updated Nov 29, 2026”). Source for exact-match caching (retrieved 2026-12-05): https://developers.cloudflare.com/ai-gateway/features/caching/
  • GPTCache README, GitHub repository zilliztech/GPTCache (README last changed 9 July 2025, according to the repository page). Source for the README wording (retrieved 2026-12-05): https://github.com/zilliztech/GPTCache
  • GitHub API, repository zilliztech/GPTCache and its latest release. Source for last push, latest release and archive status (retrieved 2026-12-05): https://api.github.com/repos/zilliztech/GPTCache
  • GPTCache documentation, “GPTCache Quick Start” (page shows “Last updated on Aug 08, 2023.”). Source for the documentation date (retrieved 2026-12-05): https://gptcache.readthedocs.io/en/latest/usage.html
  • Fu Bang, “GPTCache: An Open-Source Semantic Cache for LLM Applications Enabling Faster Answers and Cost Savings”, Proceedings of NLP-OSS 2023, Singapore, December 2023. Source for the description of GPTCache (retrieved 2026-12-05): https://aclanthology.org/2023.nlposs-1.24/
  • Zhu, Zhu and Jiao, “Efficient Prompt Caching via Embedding Similarity”, arXiv 2402.01173, version 1 (2 February 2024). Source for similarity and answerability (retrieved 2026-12-05): https://arxiv.org/abs/2402.01173v1
  • Gill et al., “Privacy-Aware Semantic Cache for Large Language Models”, arXiv 2403.02694, version 1 (5 March 2024), titled “MeanCache: User-Centric Semantic Caching for LLM Web Services” in version 4 (7 March 2025). Source for both versions (retrieved 2026-12-05): https://arxiv.org/abs/2403.02694
  • Regmi and Pun, “GPT Semantic Cache: Reducing LLM Costs and Latency via Semantic Embedding Caching”, arXiv 2411.05276, versions 1 (8 November 2024), 2 (3 December 2024) and 3 (9 December 2024). Source for the figures from version 2 (retrieved 2026-12-05): https://arxiv.org/abs/2411.05276
  • Schroeder et al., “Adaptive Semantic Prompt Caching with VectorQ”, arXiv 2502.03771, version 1 (6 February 2025), titled “vCache: Verified Semantic Prompt Caching” in version 5 (21 February 2026). Source for thresholds and storage in both versions (retrieved 2026-12-05): https://arxiv.org/abs/2502.03771
  • Wang et al., “Category-Aware Semantic Caching for Heterogeneous LLM Workloads”, arXiv 2510.26835, version 1 (29 October 2025). Source for thresholds and TTLs per category (retrieved 2026-12-05): https://arxiv.org/abs/2510.26835v1
  • Zhang et al., “From Similarity to Vulnerability: Key Collision Attack on LLM Semantic Caching”, arXiv 2601.23088, version 1 (30 January 2026) and version 2 (30 June 2026). Source for key collisions (retrieved 2026-12-05): https://arxiv.org/abs/2601.23088
  • Singh et al., “Asynchronous Verified Semantic Caching for Tiered LLM Architectures”, arXiv 2602.13165, version 1 (13 February 2026) and version 2 (12 March 2026). Source for Krites and the threshold tradeoff (retrieved 2026-12-05): https://arxiv.org/abs/2602.13165
  • Baral et al., “Closing the Calibration Gap in Semantic Caching”, arXiv 2606.19719, version 1 (18 June 2026), titled “Closing the Operational Gap in Semantic Caching” in version 4 (1 September 2026). Source for the change of title and metric (retrieved 2026-12-05): https://arxiv.org/abs/2606.19719
  • Zhang et al., “Similarity Is Not Validity: Defending LLM Semantic Caches Against Poisoning”, arXiv 2609.35908, version 1 (28 September 2026). Source for cache poisoning (retrieved 2026-12-05): https://arxiv.org/abs/2609.35908v1
  • Xin and Abouelseoud, “Synchronous Verified Semantic Caching: An Empirical Study”, arXiv 2611.40702, version 1 (30 November 2026). Source for wrong answers at a loose threshold (retrieved 2026-12-05): https://arxiv.org/abs/2611.40702v1
  • Bindschaedler, “Semantic Caching for OLAP via LLM-Based Query Canonicalization (Extended Version)”, arXiv 2602.19811, version 1 (23 February 2026). Source for the database meaning (retrieved 2026-12-05): https://arxiv.org/abs/2602.19811v1
  • Yu and Zhao, “Semantic communications, semantic edge computing, and semantic caching”, arXiv 2304.08096, version 1 (17 April 2023) and version 2 (27 April 2023). Source for the edge-computing meaning (retrieved 2026-12-05): https://arxiv.org/abs/2304.08096

Frequently asked questions

What does the similarity threshold in a semantic cache do?

It decides whether a stored prompt is close enough for its answer to be returned. Microsoft API Management: “Lower values require higher semantic similarity for a match.” Google Apigee ties the direction to the measure: “dot product is a similarity, so a larger value means a closer match, while the other three are distances, where a smaller value does.”

What is semantic cache poisoning?

It is an attack on the stored answers. Zhang et al. (arXiv 2609.35908, version 1, 28 September 2026) write: “an attacker can cache a malicious response under a query with high cosine similarity to benign requests.” A later request that is similar enough can then receive that stored response instead of a fresh answer from the model.

What do AWS, Microsoft and Google say about semantic caching?

Amazon ElastiCache (no date on the page): “a semantic cache retrieves data based on semantic similarity”. Microsoft Azure API Management (updated 2026-08-19) looks up responses “based on vector proximity of the prompt to previous requests and a specified score threshold”. Google Apigee (updated 2026-12-05) uses Vertex AI embeddings and Vector Search to find similar prompts.

What is GPTCache?

Fu Bang's NLP-OSS 2023 paper describes it as “an open-source semantic cache that stores LLM responses”. Its README on GitHub states: “we no longer add support for new API or models”. On 5 December 2026 GitHub showed a last push on 22 September 2026 and version 0.1.44 of 1 August 2024 as latest release.