Prefill processes all input tokens in parallel to build KV cache entries and emit the first token (determining Time-to-First-Token, TTFT). Decode generates one token at a time using cached keys/values (Time-per-Output-Token, TPOT). Reusing a static system/document prefix hits provider prompt cache, slashing TTFT and input token costs. Longer contexts can degrade needle-in-a-haystack recall.
Follow-up Interview Question · Why should dynamic variables (user query, timestamp) go at the end of a prompt instead of the top?