- Type
- Inference optimisation technique
- Also known as
- Embedding-based response caching
- Key mechanism
- Cosine similarity of prompt embeddings
- Typical benefit
- Lower latency and cost on repeated queries
- Threshold
- Commonly 0.90-0.95 cosine similarity
- Related
- Prompt caching, Vector database, Embedding
- Type
- Inference optimisation technique
- Also known as
- Embedding-based response caching
- Key mechanism
- Cosine similarity of prompt embeddings
- Typical benefit
- Lower latency and cost on repeated queries
- Threshold
- Commonly 0.90-0.95 cosine similarity
- Related
- Prompt caching, Vector database, Embedding
Background
A conventional cache returns a stored value only when the key is identical, which rarely happens in chat: "what are your opening hours", "when do you open" and "buka pukul berapa" are three keys for one question. Vector search made meaning-addressable lookup cheap, and researchers have begun optimising the pattern directly — Semantic Caching for Low-Cost LLM Serving (2025) studies when cached inference responses can be safely reused without running the model again[2].
Semantic caching is distinct from prompt caching, the provider-side feature that discounts or accelerates an identical prompt by reusing its computed key-value prefix. Semantic caching sits at the application layer, reuses whole answers, and works across differently worded prompts.
How it works
The design is a trade-off: a threshold set too low produces false hits — an answer that looks relevant to a similar question but answers a subtly different one — while a threshold set too high yields few hits. On a hit, a database lookup measured in milliseconds replaces a model call measured in hundreds of milliseconds.
Benefits and risks
For workloads with repetitive questions — FAQs, catalogue lookups, status enquiries — vendor benchmarks report cost reductions of up to about 86% and latency improvements of around 88%[3], because repeated queries cost nothing after the first. Risks include staleness (a cached price or policy outlives its source), over-broad hits across different users or contexts, and the fact that cached prompts and responses usually contain personal data. Teams therefore apply TTLs, version keys and redaction to the cache, not just to the live call.
>See Also
🇲🇾 For Malaysian businesses paying USD-denominated API bills in ringgit, per-call savings translate directly into margin, and the highest-value targets are exactly the repetitive Bahasa Malaysia and English questions that Malaysian e-commerce, telco and government portals receive in volume. Self-hosted stacks — an embedding model and vector store such as pgvector, Redis or Chroma running alongside a self-hostable LLM gateway — also keep prompts inside local infrastructure, which matters under PDPA 2010: cached prompts containing customer names or identifiers are personal data, and their retention and masking policies must extend to the cache.
MDEC's Malaysia Digital incentives and the National AI Office's emphasis on efficient, governable AI both favour these lightweight optimisations, which need no model fine-tuning and are a realistic first efficiency measure for SMEs adopting AI.
References
- ↑TrueFoundry. Semantic Caching: Boost LLM Speed and Reduce Costs. https://www.truefoundry.com/blog/semantic-caching
- ↑Semantic Caching for Low-Cost LLM Serving (2025). arXiv:2508.07675. https://arxiv.org/html/2508.07675v1
- ↑ScyllaDB. Cut LLM Costs and Latency with Semantic Caching. https://www.scylladb.com/2025/11/24/cut-llm-costs-and-latency-with-scylladb-semantic-caching/