Skip to content

Prefix Cache Reuse

Definition

Prefix Cache Reuse is a technique where the KV cache for a matching initial fragment of several requests is computed once and reused. It is applied in systems with a common system prompt, few-shot examples, or long context.

Conditions for Triggering

  • Exact token match of the prefix.
  • Match of generation parameters (model, weight version).
  • Availability of free space in the KV block pool.

Effect

graph LR
  R1[Request A: prefix P + X] --> C[Prefix cache P]
  R2[Request B: prefix P + Y] --> C
  C --> O[Reduction in prefill time]
The time to the first token is reduced proportionally to the reused prefix share. The greatest effect is achieved with long system prompts and repeating templates.

See Also