The short version
- People ask the same questions in different words. A cache stores answers so the system can reuse them.
- A semantic cache matches by meaning, so “reset my password” and “how do I change my password” share one answer.
- Cache only what is safe to share and still current. Personal and fast-changing answers should not be reused.
The idea
A cache stores the result of work so it need not be repeated. For AI systems there are three levels.
Exact cache. The same input returns the stored output. This is simple and safe, and it rarely hits, because wording varies.
Semantic cache. The question is embedded and compared with past questions. If one is close enough, its answer is returned and no model call is made. This hits more often and can match questions that only look alike.
Prompt cache. A feature from model providers. When many requests start with the same long text, such as system instructions or a manual, the provider stores that part and charges much less to reuse it. The model still writes a fresh answer.
A help desk keeps a list of answers to common questions. An agent who has heard a question before does not research it again. The skill is in knowing when a question only sounds the same.
- New question
- Close to a past question?
- Yes: return the saved answer
- No: call the model and save the result
The key setting is the similarity threshold. If it is too loose, users get answers to a different question. If it is too tight, the cache never hits. Every entry also needs an expiry, and entries must be cleared when the source content changes.
An example
An HR assistant gets 4,000 questions a month, and most are about the same 60 topics. A semantic cache answers the common policy questions instantly at almost no cost. Questions about an individual’s leave balance are excluded, because the answer differs for each person. When the travel policy changes, all cached answers that cite it are cleared.
Common mistakes
- Caching answers that include personal data.
- No expiry, so an old policy lives on in the cache.
- A threshold tuned on five examples.
- Ignoring prompt caching, which is often the easiest saving available.
What to do this week
- Group last month’s questions by topic and see how repetitive they are.
- Ask whether prompt caching is switched on for your long system prompts.
- List the answer types that must never be cached.
The terms, in plain language
| Term | What it means |
|---|---|
| Cache | A store of earlier results for reuse |
| Semantic cache | A cache that matches questions by meaning |
| Prompt cache | A provider feature that discounts repeated prompt text |
| Similarity threshold | How close two questions must be to share an answer |
| Invalidation | Clearing cached answers when the source changes |
Section 4.7 of the AI Engineering Guide · Last reviewed November 2026




