Try it: Cache hit versus miss
See how hit rate and wrong-hit rate change latency, cost and correctness. All defaults are illustrative; measure your own traffic before relying on any of these numbers.
Questions arriving per second.
Share of questions answered from the cache. Lower thresholds raise it.
Hits that returned an answer to a different question. Lower thresholds raise it too.
Embedding the question plus the vector search.
Full time for the model to answer on a miss.
- Latency on a hit
- 25 ms
- lookup = 25 ms
- Latency on a miss
- 3,025 ms
- 25 + 3000 = 3025 ms
- Average latency
- 2,125 ms
- 30% × 25 + 70% × 3025 = 2125 ms
- Model calls
- 35 per second
- 50 × (1 − 30%)
- Model cost saved
- 30 %
- equal to the hit rate
- Wrong answers
- 6 per 1000 questions
- 1000 × 30% × 2%
Assumptions
- Every request pays for the lookup; misses also pay the full model time.
- Hit rate and wrong-hit rate are inputs you would measure on your own traffic, not predictions.
- Model cost is proportional to the number of model calls.