Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Scaling AI Systems

Free · sign in to start and track progress

1 · Throughput under limits

  • 1Rate limits and quotas
  • 2Concurrency and flow control
  • 3Retries, backoff and overload
  • 4Backpressure, load shedding and batching

2 · Latency, resilience and capacity

  • 5Latency engineering for agents
  • 6Response caching and failover

    Exercise answers

    • Answer: Measure a semantic cache as a classifier
    • Answer: Simulate failover with a cold cache
  • 7Load testing and capacity planning
CapstoneMonth-end readiness for an agent fleetReference implementation

Module 2 · Latency, resilience and capacity · Lesson 6

Response caching and failover

Serve some answers without calling the model, exactly or by similarity, and know why similarity caching is unsafe for case-specific questions. Then keep the fleet running through provider overloads and regional incidents with Claude on several platforms, without a cold-cache stampede on the fallback.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uv

By the end of this lesson you can

  • Design exact-match response cache keys that include every input that changes the answer, including document versions and tenant
  • Explain how semantic caches decide hits, and quantify their false-positive cost as a classifier
  • Identify why semantic caching is dangerous for case-specific work, and name the uses where it is acceptable
  • Compare Claude on the Claude API, Amazon Bedrock and Google Cloud as failover targets on quotas, endpoints, residency and features
  • Plan failover so that the fallback's quota survives the cold-cache surge, with warm standby, stickiness and shedding

On this page

  • Part 1: response caching
  • Exact-match caching
  • Semantic caching
  • Why semantic caching is dangerous for legal work
  • Worked example: what a semantic cache costs in errors
  • Part 2: failover across platforms and regions
  • Why fail over
  • Where Claude runs
  • The cold-cache surge
  • Code: a sticky, breaker-aware router
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Part 1: response caching
  2. 02Part 2: failover across platforms and regions
  3. 03Misconceptions and limits
  4. 04Connections
  5. 05Summary

Sources & further reading

  • vCache: Verified Semantic Prompt CachingPaper · Schroeder et al. · 2025Shows that one static similarity threshold gives no correctness guarantee and unpredictable error rates, and learns a threshold per cached prompt online to meet a user-set error bound. Read the introduction and the problem statement.
  • From Similarity to Vulnerability: Key Collision Attack on LLM Semantic CachingPaper · Zhang, Liu, Xie, Huang, She · 2026Treats semantic cache keys as fuzzy hashes and shows an automated black-box attack that hijacks cached responses with an 86% hit rate, transferable across embedding models, including against LLM agents.
  • LangCache conceptsDocs · RedisA clear vendor statement of the trade-off. Semantic caching "gives up the guarantee that a cache hit is always correct", with a default threshold of 0.85, and attributes to scope entries.
  • Claude in Amazon BedrockDocs · AnthropicGlobal versus regional endpoints (regional at a 10% premium), EU inference profiles including London, default token quotas, and the features Bedrock doesn't support.
  • Claude Models on Google Cloud (Google managed)Docs · AnthropicGlobal, multi-region (us, eu) and regional endpoints, their pricing, which models each serves, Google-managed quotas and unsupported features.
  • Refusals and fallback (Claude API docs)Docs · AnthropicServer-side fallback is triggered only by safety-classifier refusals; rate limits, overloads and server errors are returned to you unchanged, so capacity failover is your job.
  • Data residency (Claude API docs)Docs · Anthropicinference_geo values on the Claude API (global and us only), the 1.1x price for US-only inference, and shared rate limits across geos.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 5 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks