Llm Inference Serving hard
Speculative decoding with a small draft model cut inter-token latency by about 2x at low traffic. At peak, with about 200 sequences batched per replica, aggregate throughput is 15% lower than with speculation disabled. What explains this, and what is the fix?
- A The draft model's KV cache doubles memory per sequence, shrinking the batch; the fix is to let the draft model share the target model's KV cache.
- B Batching shifts the target model's sampling distribution and lowers acceptance; the fix is greedy decoding at peak so more drafts are accepted.
- C At large batch, decode is compute-bound, so verifying draft tokens that get rejected burns scarce FLOPs; scale back or disable speculation as batch grows.
- D Speculation only speeds up prefill, so at peak, when prefill dominates, it just adds overhead; the fix is to apply it to prompt processing alone.
Answer: C. At large batch, decode is compute-bound, so verifying draft tokens that get rejected burns scarce FLOPs; scale back or disable speculation as batch grows.
Speculative decoding **trades extra compute for fewer sequential steps**, which pays off only when decode is memory-bandwidth-bound and compute is idle. At large batch sizes the GPU is already compute-saturated, so rejected draft tokens become pure waste and speculation length should adapt to load. The draft model's KV cache is real but small, and batching does not change the target model's output distribution.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your 70B-class model servers each handle about 40 concurrent chats with 4K-token contexts. Product raises the maximum context to 32K tokens, and many users start using it. What is the main capacity consequence?
- A 70B-class model (80 layers, grouped-query attention with 8 KV heads of dimension 128) is served in fp16 on one 8-GPU node with about 640 GB of total HBM. Product wants 256 concurrent sessions, each holding a full 32K-token context. What is the binding constraint, and what does it imply?
- Your server reserves a contiguous KV region sized for max_tokens = 8,192 for every request at admission, but the average sequence ends near 600 tokens. The node reports out-of-KV-memory at about 20 concurrent requests while GPU compute sits at 30%. Which change best raises concurrency without restricting legitimate long outputs?
- You must summarize 10 million documents overnight, and no user is waiting on any single result. How should you configure the serving stack compared with your interactive chat deployment?
- You serve a 7B-parameter model in fp16 (about 14 GB of weights) for a chat app. Users say single-conversation token generation is too slow, and you are choosing new GPU hardware. Which hardware spec most directly increases per-sequence decode speed?
- Your RAG workload sends 8K-token prompts and gets ~150-token answers from a 70B-class model. You plan to move prefill and decode onto separate GPU pools so long prefills stop stalling decode. What new resource must you size carefully?