Skip to main content
← Lab

prefillcache

confirmedPython · llama.cppInference & servingJuly 5, 2026

the question

How much does prompt-prefix caching actually save, and how does the payoff scale with prefix length?

what came out

Warm prefill stays flat at ~8-11ms while cold grows linearly, so a reused shared prefix goes from an 8x speedup at 114 tokens to 81x at 1841 -- 88-99% of prefill eliminated, nearly free after the first request.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Machine-readable claims every reported number, in a checkable file.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/prefillcache