Token Efficiency Encyclopedia

Prompt Caching

Cache stable prompt prefixes (system prompts, large reference files, repository context) so repeated tokens are not re-processed or re-billed on every request.

How It Works

Inference servers or APIs detect that the beginning of a new request matches a previously seen prefix. They reuse the precomputed key-value attention state from the cache instead of recomputing it, reducing latency and cost.

What to Cache

Limitations

See Also

Tools