Code RoomLLM prefix KV cache sharing
HardPrep Room Coding #3481

LLM prefix KV cache sharing

System designDistributed systemsSenior–Staff~50 min

Design the prompt/KV-cache layer for an LLM-serving system where most requests share a large, mostly-static prefix (a long system prompt + retrieved context) and differ only in a short user suffix. At 5k concurrent requests, recomputing the prefix's attention KV every time wastes most of the GPU. Walk through how you cache and reuse the prefix KV across requests, how you manage GPU memory as a finite resource shared by all in-flight sequences, and the correctness traps in reusing cached KV.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify5:30 left
Estimate5:30 planned
Design16:30 planned
Deep dive13:30 planned
Failure9:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.