firehose> #llmops

Prompt Caching

Prompt caching reuses the model's work on a stable prompt prefix across calls: mark a long, unchanging span (a system prompt, a big document, a tool schema, few-shot examples) as cacheable, and subsequent requests that share that prefix skip re-processing it — cutting both cost and time-to-first-token on the repeated portion. The economic shape is the point: when the same large context is sent many times (an agent loop re-sending its instructions each turn, a RAG app re-sending the same corpus, a chatbot with a fat system prompt), the prefix is the dominant cost and caching it is the single biggest lever. The ordering constraint follows directly — put the stable content first and the volatile content last, so the cacheable prefix is as long as possible before the first byte that changes (this is why it pairs with Evergreen vs Volatile Context). Speculative prompt caching extends the idea by warming the cache for a prefix the system predicts will be reused, before the reuse actually arrives.

Anthropic's Claude Cookbooks ship this as a first-party recipe (misc/prompt_caching.ipynb and misc/speculative_prompt_caching.ipynb), attributed here as the source's; the concept is a durable inference-economics technique independent of any one vendor's cache-lifetime or pricing.

Claims


Linked from