At low batch sizes your decode is slower than the bandwidth math predicts, and the GPU timeline shows gaps between kernels. What is CPU overhead in LLM serving, and how do CUDA graphs and overlapped scheduling fix it?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
At small batch sizes a decode step is so short that the host side, not the GPU, becomes the bottleneck. One step is hundreds of small kernels (several per layer across dozens of layers), and each launch costs microseconds of CPU time in Python, the framework dispatcher and the driver. Add the scheduler's per-step work (choosing the batch, updating block tables, sampling, detokenizing, streaming) and the GPU idles between steps. A profile shows gaps on the GPU timeline and one pegged CPU core. On a small model, where a step's weight read takes well under a millisecond, overhead can be a large share of the step.
Full worked answer with diagram
At small batch sizes a decode step is so short that the host side, not the GPU, becomes the bottleneck. One step is hundreds of small kernels (several per layer across dozens of layers), and each launch costs microseconds of CPU time in Python, the framework dispatcher and the driver. Add the scheduler's per-step work (choosing the batch, updating block tables, sampling, detokenizing, streaming) and the GPU idles between steps. A profile shows gaps on the GPU timeline and one pegged CPU core. On a small model, where a step's weight read takes well under a millisecond, overhead can be a large share of the step.
The fixes, roughly in the order engines adopted them:
- CUDA graphs. Capture the whole decode step once and replay it with a single launch, so launch overhead collapses. The catch is that graphs are static in shape: engines capture a set of batch-size buckets at startup and pad each step to the nearest bucket, which costs memory and startup time. Dynamic pieces, such as some attention backends, MoE routing or custom ops, can break capture and force eager mode.
- Compilation and fusion.
torch.compileand hand-fused kernels merge elementwise work (norms, activations, rotary embeddings) into fewer, larger kernels, which means fewer launches and fewer HBM round trips. - Overlapped scheduling. Prepare step N+1 on the CPU while the GPU runs step N, so the scheduler leaves the critical path. SGLang's overlap scheduler and vLLM's async scheduling do this. The subtlety is that step N+1 needs the token sampled in step N, so everything else is prepared ahead and the token is filled in last.
- Move work off the hot loop. Run tokenization, detokenization, streaming and HTTP handling in separate processes from the engine core.
The interview point: this is why measured batch-1 tokens per second on a small model can sit well below the bandwidth ceiling, and why an engine upgrade sometimes buys more latency than a faster GPU. It matters most for small models, low batch, speculative decoding (many tiny verify steps), and architectures with weaker graph coverage.
Worth sketching. It shows where the idle time comes from and which fix removes each slice of it.
flowchart LR
A["Eager decode step"] --> B["Hundreds of kernel launches,<br/>microseconds of CPU each"]
B --> C["GPU idles between kernels"]
A --> D["CUDA graph captured once<br/>per batch-size bucket"]
D --> E["One replay per step"]
E --> F["Overlapped scheduling: CPU prepares<br/>step N+1 while N runs"]
F --> G["GPU timeline without gaps"]
What a good answer covers
- At small batch sizes a decode step is so short that the host side, not the GPU, becomes the bottleneck
- One step is hundreds of small kernels (several per layer across dozens of layers), and each launch costs…
- Add the scheduler's per-step work (choosing the batch, updating block tables, sampling, detokenizing,…
- A profile shows gaps on the GPU timeline and one pegged CPU core
- On a small model, where a step's weight read takes well under a millisecond, overhead can be a large…
Key terms: CUDA graphs · Compilation and fusion · Overlapped scheduling
In the glossary: Decode · MoE · HBM · SGLang · vLLM · Speculative decoding
Interviewer follow-ups to expect
Why do CUDA graphs need batch-size buckets, and what does padding to a bucket cost you?
How would you confirm from a profile that a latency problem is host overhead rather than memory bandwidth?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep