Semantic Cache Invalidation
Definition
Semantic Cache Invalidation — procedures for maintaining the freshness of Semantic Caching: removal of entries that have become incorrect due to changes in the knowledge base, model updates, or access rights.
Reasons for Invalidation
- Document updates in Vector DB or Knowledge Base.
- Change of version of LLM or System Prompt.
- User permission changes affecting the permissible response.
- Expiration of TTL of an entry.
Strategies
| Strategy | Description |
|---|---|
| TTL | Automatic removal based on time |
| Event-driven | Invalidation triggered by source update events |
| Versioned key | Key includes model and index version |
| Manual purge | Manual cleanup based on administrative request |
Risks
- Stale cache leads to Hallucination relative to current data.
- Too aggressive invalidation reduces hit rate and economic benefit.