Why does batching help LLM decode disproportionately more than batching helps CNN inference?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Explain why a typical CNN classifier gets marginal throughput wins from batching while LLM decode sees ~10× or more. Tie the answer to where each workload sits at batch 1.
LLM decode at batch 1 is memory bound, so batching amortizes one weight read across many requests and throughput climbs nearly linearly. CNNs start compute bound, so batching just queues work.
Picture a chef who must walk to a far pantry, carry one heavy sack of flour back, and bake just one loaf with it. The walk dominates the time. If one customer orders a single loaf, the chef wastes the whole trip on that one loaf. But if ten customers each want a loaf, the chef makes one trip and bakes ten loaves from the same sack. The slow walk is paid once and shared across ten orders, so output jumps almost tenfold with barely more time. Now picture a different cook whose counter is already packed and whose hands never stop moving. Giving that cook ten orders does not help, because the hands were already the bottleneck. LLM decode is the first chef; the pantry walk is reading weights from memory.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: roofline model + arithmetic intensity + CNN compute bound versus decode memory bound at batch 1 + how batching amortizes weight reads + the critical batch size + continuous batching in production.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Claiming batching helps every workload equally, or that it helps because the GPU likes bigger matrices. It only helps when arithmetic intensity has headroom before the compute roof.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.