Skip to content

Prefix Caching

Optimization of inference: if requests have the same beginning (common system prompt), its KV-cache is computed once and reused.

Why

  • cheaper — no payment for reprocessing the prefix;
  • faster — fewer computations per request;
  • more efficient for large-scale similar requests.

Example

A chatbot with a long instruction: the instruction is the same for all, only the user's question changes. The prefix cache saves on each request.

See also

← All terms