Lattice
Skip to content

Prefix caching

Reusing the KV cache for a prompt prefix that has already been processed, instead of recomputing it.

By Entry last reviewedmethod

What it implies

If a large share of your requests begin with the same few hundred tokens (a long system prompt, a cached document, a shared tool schema), this is worth more than every other optimisation combined. If your prompts are short and unrelated, neither vLLM's automatic prefix caching nor SGLang's RadixAttention will do much. It also makes a stable system prompt dramatically cheaper than a per-request one.

Tools in this index

Related terms

Rules of thumb

  • A definition is only useful next to the decision it changes. Read the linked layer to see where this term bites.
  • If a vendor's definition differs from this one, ask what it measures. Marketing definitions rarely name a number.
  • Every optimisation spends latency, memory or quality somewhere. Find out which before you turn it on.

Ask an AI about this page

Opens the assistant with this page’s link and a question already filled in.