Log inStart free
LESSON 34.03 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Semantic caching

Watch a cache answer a repeated question without running the model.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 34.03 · CACHE BAY3 REPEATS OF 12 · EXACT TEXT KEY: 0 HITS
01
Stage 1 of 6 · Repeated questions
Q02, Q04 and Q12 ask earlier questions in other words. An exact-text key misses all 3; a semantic cache at 0.90 finds them.
Explain it simply

Each line is one chat request, in the order it arrives. The teal arcs join two questions that mean the same thing. A cache keyed on the exact text only finds the same words. So it misses every one of these repeats, and the model answers each again.

Twelve requests in a column. Arcs join Q02 to Q01, Q04 to Q03 and Q12 to Q07. Each repeat shows: exact text key, miss.

requests, embeddingssimilarity, cache hitsthreshold, GPU timewrong answers
repeated questionsrequest, in arrival orderQ01How do I change my flight date?Q02Can I move my flight to Friday?same question as Q01 · exact text key: missQ03What is the baggage limit?Q04How many bags can I bring?same question as Q03 · exact text key: missQ05Why was I charged twice for one booking?Q06My hotel booking vanished after I paid.Q07Is there a cancellation fee?Q08Plan a 3-day trip to Lisbon on a budget.Q09Is breakfast included at my hotel?Q10How do I cancel and get a refund?Q11Compare two routes to Tokyo with one stop.Q12How much is the cancellation fee?same question as Q07 · exact text key: missrepeated questionsrequest, in arrival orderQ01How do I change my flight date?Q02Can I move my flight to Friday?same question as Q01 · exact text key: missQ03What is the baggage limit?Q04How many bags can I bring?same question as Q03 · exact text key: missQ05Why was I charged twice for one booking?Q06My hotel booking vanished after I paid.Q07Is there a cancellation fee?Q08Plan a 3-day trip to Lisbon on a budget.Q09Is breakfast included at my hotel?Q10How do I cancel and get a refund?Q11Compare two routes to Tokyo with one stop.Q12How much is the cancellation fee?same question as Q07 · exact text key: miss
Toy: 12 chat requests of 34.01, 8-feature embeddings, 1 H100 at batch 32
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
hit  ⟺  text(q)=text(e)\text{hit} \iff \sy{k}{data}{\text{text}(q)} = \text{text}(e)
same text: 0 of 12\text{same text: } 0 \text{ of } 12

An exact key hits only when the stored text is the same.

Common mix-ups

MYTHA lower threshold gives more savings at no cost.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With an exact-text key, how many of the 12 requests are cache hits?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.