Semantic cache

A semantic cache answers a question from the stored answer to a similar one. Merging 8 phrasings of a topic into 1 entry gave a 66 percent hit ratio with a 150 s lifetime. Each entry is a model output, so its lifetime also caps how long an old answer can live.

Play a level

See it on the board

The same traffic runs on two boards. The simulator measured both when this page was built.

Board to show
GPU server (H100)GPU server (H100)HTTP/2UsersSemantic ca…1 vCPU · 1 GBAPI server1 vCPU · 1 GBLoad balanc…1 vCPU · 1 GBLLM server1 vCPU · 1 GBLLM server1 vCPU · 1 GB
HTTP/2HTTP/2HTTP/2HTTP/2UsersSemantic c…API serverLoad balan…LLM serverLLM server
Entries live 3,600 s: misses a goal
GPU server (H100)GPU server (H100)HTTP/2UsersSemantic ca…1 vCPU · 1 GBAPI server1 vCPU · 1 GBLoad balanc…1 vCPU · 1 GBLLM server1 vCPU · 1 GBLLM server1 vCPU · 1 GB
HTTP/2HTTP/2HTTP/2HTTP/2UsersSemantic c…API serverLoad balan…LLM serverLLM server
Entries live 150 s: meets the goals
See it on the board
Measure Goal Entries live 3,600 s Entries live 150 s
p99 latency under 6 s 4.9 s Pass 5.2 s Pass
Data age under 180 s 152.1 s Pass 152.1 s Pass
Error rate under 1% 0% Pass 0% Pass
Quality at least 0.98 0.93 Fail 0.99 Pass
Monthly cost 3,812 USD/mo 3,812 USD/mo
Error rate 0% 0%

Key numbers

Part values and prices from the catalog. The mini board has 40 requests/s, 3,000 topics and 2 GPUs.
NumberValue
Default similarity needed for a hit0.95 ratio
Cache read, median0.1 ms
One H100 GPU host1,900 USD/mo
Many phrasings, one answerTap or press Space to match questions by meaning

Similar meaning · hit ratio 66% · 14 of 40 chats/s reach the GPUs, which serve about 24

How it works

People ask the same thing in many ways. A support bot gets 3,000 topics, and each topic comes in about 8 phrasings. An exact cache treats each phrasing as its own key. The hit ratio stays near 42 percent, and the GPUs, which serve about 24 chats/s, saturate at 40 requests/s.

A semantic cache compares the meaning of a question with the stored questions. If a stored question is similar enough, above a threshold, it returns that stored answer. The 8 phrasings of a topic merge into 1 entry. Far fewer requests reach the model.

The cached value is a model answer, and an answer can become wrong. In the mini board 2 requests/s are staff rewrites of answers. A cached answer that staff have edited must not be served for more than 3 minutes. So the lifetime of an entry is a trade. At 60 s the hit ratio is only 43 percent. At 300 s a stale answer lives 305 s, which is too long. At 150 s the hit ratio is 66 percent, and the oldest stale answer is 152 s.

The threshold is a second trade. A low threshold gives more hits, but it can return an answer to a question that is not the same. Test the threshold on real pairs of questions.

In the levels you tune the lifetime and check the hit ratio and the age of the oldest answer.