What is the primary reason batching is so much more effective for LLM decode than for CNN inference?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
LLM decode is memory-bandwidth-bound at batch 1, so batching amortizes the weight read across many tokens; a CNN is already compute-bound and has little to amortize.
Imagine a librarian who must walk to a huge back room to fetch one heavy reference book every time someone asks a question. If one person is waiting, the librarian makes the long walk for a single answer. That walk is the cost of loading the model weights from memory. Now imagine ten people ask questions that all need the same book. The librarian makes one walk and answers all ten at once. The walk cost is shared across everyone. That is batching for LLM decode. A CNN is different, more like a chef who already chops a whole crate of vegetables in one motion. The chef stays busy the whole time, so adding more orders barely helps because the work was already packed tight.
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 regime at batch 1 + why decode is bandwidth-bound + how batching raises arithmetic intensity + saturation at the compute roof + KV cache and continuous batching caveats.
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.
Attributing the batching win to LLMs having more parameters. The driver is the bottleneck regime, not model scale; a memory-bound workload has a weight read to amortize, a compute-bound one does not.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.