Back to System Design Mind Map
中文·English
🏗️ System DesignID: semantic-cache-gateway

Semantic Cache & Request Deduplication

语义缓存与请求去重
🎯Core Definition
The Semantic Cache & Request Deduplication Gateway (GPTCache, Redis Semantic Caching) is an intelligent acceleration layer positioned in front of LLM inference and RAG retrieval pipelines; unlike traditional exact-string hash caches, semantic caches embed incoming queries into dense vectors and execute sub-3ms cosine similarity lookups in memory: if similarity with a cached query exceeds a calibrated threshold τ\tau (e.g. cos(q1,q2)0.95\cos(q_1, q_2) \ge 0.95), the cached retrieval context and LLM response are returned instantly; paired with Singleflight distributed mutex locks, it prevents cache stampedes on viral prompts.
💡Use Cases
High-concurrency AI customer service desks, trending enterprise queries, and LLM API cost/latency optimization.
Key Problems Solved
LLMs are expensive and slow (seconds per response); semantic caching intercepts 30%-50% of recurring semantic intents, compressing response times from 2000ms to 5ms while slashing Token expenditure by over 40%.
🎯5 High-Frequency Exam Points
1
Compare Exact String Match vs Semantic Vector Match across cache hit rates, lookup latencies, and semantic hallucination risks?
2
How to rigorously calibrate the similarity threshold τ\tau to prevent false cache collisions on semantically opposite prompts ('open account' vs 'close account')?
3
Design a Singleflight concurrency barrier preventing Cache Stampedes when thousands of users ask identical breaking queries simultaneously?
4
How to design cascading cache invalidation via metadata reverse indexes when underlying knowledge base documents are updated?
5
Explain cryptographic and metadata-scoped partitioning ensuring Tenant A's private responses never leak to Tenant B's semantic cache hits?
Updated 2026-08-14
🎯
Test Your Knowledge: Practice Questions for "Semantic Cache & Request Deduplication"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardOnline Parallel Retrieval GatewayNext CardMulti-Tenant Partitioning & RBAC

🔗 More System Design Knowledge Cards

RecSys Multi-Stage Funnel & 50ms SLADSSM Two-Tower RetrievalYouTube DNN Candidate GenerationPre-Ranking Lightweight Architecture