M10-036M10: Engineering Deep-Dive & Technical BQAI Infra Deep-Dive & Postmortem BQHard
⚡Flashcard Drill➔Mastery:

AI Infra Deep-Dive: Solving KV Cache Exhaustion & Preemption Thrashing in vLLM

🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
Next: M10-037 →
📐 Mathematical Definition
KV Saturation  ⟹  Swap/Recompute Thrashing  ⟹  P99 TPOT↑10×\text{KV Saturation} \implies \text{Swap/Recompute Thrashing} \implies \text{P99 TPOT} \uparrow 10\times
⚡ One-Sentence Core Answer
Catch silent KV cache saturation and preemption/recomputation thrashing via num_preemptions telemetry, then stabilize P99 TPOT using Chunked Prefill and KV-budgeted admission control.

📌 Key Takeaways

  • •
    Symptom: normal average latency masked sudden 5-second P99 TPOT freezes during bursty long-document traffic
  • •
    Telemetry Culprit: gpu_cache_usage_perc pinned at 99.8% while num_preemptions_total spiked—growing decode sequences constantly preempted and recomputed KV blocks
  • •
    Three-Part Fix: enabled Chunked Prefill to bound per-step compute, activated APC prefix sharing (-35% KV pressure), and added KV-headroom admission control
  • •
    Impact: eliminated 5s freezes, dropped P99 TPOT from 420ms to 55ms, and boosted sustainable concurrency 40%

📐 Mathematical Derivations

Max concurrency obeys Nmax⁡≤MKV_pool(Lˉin+Lˉout)⋅ckvN_{\max} \le \frac{M_{\text{KV\_pool}}}{(\bar{L}_{\text{in}} + \bar{L}_{\text{out}}) \cdot c_{\text{kv}}}; GQA plus FP8 KV quantization reduces ckvc_{\text{kv}} by 4-8x.

🏭 Production Trade-offs

Queueing excess requests cleanly at the gateway beats admitting them into a 99%-full GPU pool only to trigger PCIe swap or recomputation thrashing.
⚠️ Common Interview Pitfalls
  • ✕
    Advertising max_model_len=128K without KV-aware concurrency admission limits
  • ✕
    Tracking mean TPS while ignoring num_preemptions and P99 inter-token latency spikes
🎯 Interviewer Follow-up Inquiries
  • ?
    How do you validate that FP8 KV Cache quantization doubles capacity without degrading long-context Needle-in-a-Haystack accuracy?
  • ?
    How does the router track live per-replica KV headroom without stale cache herd effects?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
📚

Associated Knowledge Base Guides & Mindmaps

← PreviousM10-035: AI Infra Postmortem BQ: Root-Causing & Stopping a Cascading Cluster OOM Storm📋 Back to BankNext →M10-037: AI Infra Optimization BQ: Lifting Distributed Training MFU From 28% to 52%+