glossary

Context and retrieval

Semantic cache

A semantic cache returns a previous answer when a new question is close to an earlier one in embedding space, which skips a model call, and it matches by similarity rather than by an identical prompt prefix.

Abracadabra Team Glossary

How it works

The cache stores a question embedding beside the answer that was produced for it. A new question is embedded with the same model. If it is close enough, under a threshold the application chooses, the stored answer is returned and the model is not called. That saves latency and cost when people really do ask the same thing. Closeness is meaning, not bytes. This is the opposite of prompt caching, which reuses computation only when a prefix is identical and still runs the model for the tail. A semantic cache never sees the tail. It bets that the old answer still applies.

The bet fails when similar wording hides a different account, product, date or plan. A stale answer also survives after the source page changes, until something invalidates that entry. The trace should say that a reply was served from the cache, which question it matched, and how close that match was, or a wrong answer looks like a model fault.

A worked example

A handset answer served for a network switch

A mobile network caches answers to common questions. Someone once asked "Can I keep my number if I change handset?" and the stored reply explains how to move a physical SIM into a new phone. A later person asks "Can I keep my number if I change network?" The embeddings are close. The cache returns the SIM-swap steps and does not call the model. The person says that is not what they meant, and says it again, naming the other network. The porting steps were never generated for this question. They were reused because the sentences sat near each other. An identical-prefix cache would have missed, called the model, and had a chance to read the word "network". The semantic cache treated nearness as sameness and skipped that chance.

Illustrative example, not a production trace and not a measured result.

What goes wrong

  • A similar question about a different plan, date or account receives the stored answer, and the person has to say they are not in that situation. The model was not called.
  • The source page changes and the cached answer keeps quoting the old fee or the old steps, because nothing invalidated the entry when the page was edited.
  • The hit is not marked on the trace, so a reviewer edits the system prompt while the model is not even being called for that question.

How to measure it

Mark every reply served from the cache with the matched question and the distance. Read the sessions where the person says the answer is about the wrong case, the wrong date or the wrong product, and group them by the cached entry.

After you tighten the threshold, add a key such as plan type, or invalidate on a source edit, compare task success and cost per task for that cohort. A fall in hits is not a failure if the remaining hits stop being corrected.

Further reading

How Abracadabra helps

A person who says the answer describes the wrong plan or the wrong kind of change is correcting a cache hit, not a fresh generation. After the threshold or the invalidation rule changes, compare task success for that task and cohort.

When context is lost, people restate a fact or repeat the request. Abracadabra pins those corrections and repeated intents to the turn. After a change to what the agent keeps, compare task success for that task and cohort with the previous period.

Request access to read this on your own agent.

See it in your own agent's conversations.

Each task, the step where it stops, and the conversations behind every count. Free during early access.