Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Prompt caching reuses prefill KV for a byte-identical prefix, so cached input bills at roughly 10 percent of normal; any variable content above stable content breaks the hit.
Imagine reading the same long instruction sheet aloud before every conversation. The first time you read it slowly, but you remember it, so next time you can skip straight to the new question. Prompt caching is that memory for the model. When the start of your prompt is exactly the same as before, the provider reuses the work it already did and charges you a small fraction for those repeated tokens. But the trick only works from the very beginning. If you change even one word near the top, like stamping today's date, the model has to reread everything below it from scratch and you pay full price again. So you keep the unchanging part at the front and put the part that changes at the very end.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: why prefill reuse enables the discount + cached read at ~10 percent and the write premium + byte-identical prefix matching + stable-first prompt layout + TTFT win and what silently breaks a hit.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Putting a per-request value like a timestamp, session ID, or freshly retrieved chunks above the stable system prompt. It poisons the prefix and forces full-price prefill on everything below.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.