Caching interview question

MLOps & ProductionCachingLLM Inference Optimizationeasy

A telecom support bot on a self-hosted vLLM server sends a 3,000-token system prompt plus the growing chat history on every turn. After you enable automatic prefix caching, which outcome should you expect?

  1. ALower time per output token on every turn, because decode skips attention over the cached prefix tokens, while TTFT stays the same because the full prompt still has to be sent.
  2. BIdentical user questions are answered straight from the cache without running the model, because the engine stores the full response for each prompt prefix it has already seen.
  3. CLower TTFT and less prefill compute on turns that share a cached prefix, the same decode work per output token, and fewer hits whenever memory pressure evicts the cached blocks.
  4. DGuaranteed hits for the system prompt, because cached blocks stay pinned in GPU memory until the server restarts, so the cache capacity has to be reserved when the server starts.
Show the answer and explanation

Correct answer: C, Lower TTFT and less prefill compute on turns that share a cached prefix, the same decode work per output token, and fewer hits whenever memory pressure evicts the cached blocks.

Explanation Caching

Automatic prefix caching (vLLM; SGLang's RadixAttention is the same idea organized as a radix tree) keeps the KV blocks of earlier requests after they finish. A new request whose token sequence starts with the same blocks reuses them, so only the new suffix needs prefill.

For this bot every turn begins with the same 3,000-token system prompt and then the previous turns, so turn n can reuse almost everything except the newest user message:

MetricEffect
TTFTlower: only uncached tokens are prefilled
Prefill GPU computelower, which frees capacity for other requests
Decode work per tokenunchanged: each new token still attends over the full context
Outputsame as without caching (up to floating-point noise)

Measured TPOT can still dip slightly under heavy load, but only indirectly: less prefill work competes with decoding for GPU time.

Cached blocks are not pinned: they live in the same pool as active sequences, and when memory is needed, unused cached blocks are evicted (typically least recently used). Under heavy load, or when a chat pauses long enough for other traffic to evict its blocks, hit rates fall.

Why the distractors fail: decode still reads the whole KV cache, cached or not, so caching does not make a decode step cheaper. The full prompt is still sent, but sending tokens is cheap; prefilling them is what costs time, which is why TTFT drops. Prefix caching stores KV states, not responses, and the model still generates every answer (a response cache is a different, application-level component). Nothing is reserved or guaranteed.

Interview tip: describe it as "skip prefill for repeated prefixes" and add the two conditions for hits: an identical token prefix from the first token, and the request reaching the replica that still holds those blocks.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More MLOps & Production questions

  1. A security review of a retail client's Google Cloud project finds that the Vertex AI training pipeline, a GKE scoring service and a nightly export job all run…
  2. On a GKE cluster you deploy a model server as a Deployment with 3 replicas and expose it with a Service. Which statement correctly describes these Kubernetes…
  3. Which statement best defines MLOps?
  4. An 8B support model (≈ 16 GB of BF16 weights) is served with a vLLM-style engine as shown below. At peak, the time per output token (TPOT) spikes and the…
  5. Re-running the training job below from the same git commit one month later gives a validation AUC of 0.861 instead of the logged 0.874. The library versions,…