Model Online / On-Site
Duration
Modules 5 modules

Course Objective & Scope

In enterprise assistants and customer support bots, a large fraction of users ask identical or near-identical questions, while every request repeatedly processes thousands of tokens of identical system prompts, tool definitions and document context. This course teaches how to layer exact caching, semantic caching, prefix/prompt caching and embedding caching to slash both compute spend and response latency.

In hands-on labs participants build a semantic cache with Redis/Qdrant, restructure prompt templates to maximise prompt-cache hit rates on cloud APIs and vLLM, and calibrate similarity thresholds to prevent false-positive cache hits.

Who Should Attend?

  • Software and AI engineers building high-traffic LLM and RAG services
  • Platform and MLOps engineers managing model gateways and caching infrastructure
  • Solution architects looking to reduce API spend and response latency
  • Prerequisite: Python, basic Redis or vector database familiarity and LLM API experience

Key Takeaways

  • Structure prompts with static prefixes first and dynamic inputs last to maximise prompt-cache hits
  • Implement deterministic exact caching for LLM completions and embeddings using Redis
  • Design a low-risk semantic cache using vector similarity plus cross-encoder verification
  • Enforce tenant/role namespaces and TTL invalidation rules to prevent cross-user data leaks
  • Measure cache hit rate, false-positive rate and saved tokens and latency

Curriculum

LLM Caching Layers: What to Cache Where
  • Exact response cache, semantic cache, KV/prompt prefix cache and embedding/retrieval cache
  • Matching workloads (FAQ bots, RAG, code completion, personalised agents) to the right cache type
Prompt and Prefix Caching Engineering
  • How prefix caching works in OpenAI, Anthropic, Gemini and vLLM APC
  • Ordering system prompts, tool schemas, few-shot examples and dynamic timestamps/user context
Exact Caching and Embedding/Retrieval Caches
  • Normalized request hashing for exact-match caching with LiteLLM and Redis
  • Caching embedding vectors and reranker scores for repeated queries and documents
Semantic Cache Design and Preventing False Positives
  • Why naive semantic caches fail on numbers, dates, negations and near-homonyms
  • Combining strict similarity thresholds, entity matching and lightweight rerankers
Security, Cache Invalidation and Savings Measurement
  • Scoping cache keys by tenant and ACL permissions to prevent cross-user data leakage
  • Invalidating cached answers when source documents change and tracking net cost savings

Other Courses in This Category

Get in touch