Loading video...
Video Failed to Load
Batching strategies in LLM inference, clearly explained! (bookmark it) - Static - Dynamic - And continuous batching I wrote a detailed article explaining how each works and why serving LLMs is a different problem from traditional ML inference. The article is quoted below.
30,234 views • 1 month ago •via X (Twitter)
10 Comments

@akshay_pachaar always wondered how batching affects LLMs specifically. gonna dive into your article, thanks for breaking it down!

Continuous batching solved the head-of-line blocking problem but introduced its own headache with KV cache fragmentation once you have dozens of sequences finishing at different times. PagedAttention style memory management ends up being just as important as the batching strategy itself.

hit this last month self-hosting a small model. one long completion was holding the whole batch hostage and my p99 looked terrible while p50 was fine. took embarrassingly long to trace it. does the article explain why most frameworks still default to static?

LLM inference really is its own kind of systems problem.

continuous batching is the one that changed everything for me.

LLM inference isn't just about generating tokens—it's about deciding which tokens to generate next across hundreds of concurrent requests.

Great breakdown! Dynamic batching seems like a real game-changer for LLM inference. Looking forward to diving into the article to learn more!

Great breakdown, saving this one

Nice

One dimension these comparisons almost never carry: batching changes the text, not only the schedule. Someone published a clean measurement of it today, on llama.cpp with greedy decoding at temperature 0. Sequential runs were byte identical. At 64 slots, eight distinct prompts produced 27 distinct answers, and the same prompt returned up to five completions depending on which slot it landed in. The part he did not expect: for two of the three prompts he checked, none of the eight batched slots matched the sequential greedy output. Batching was not selecting among answers the model gives, it was producing ones it does not give at parallel 1. My own numbers agree from a different angle, repeats inside one configuration byte identical at 200 of 200 and agreement dropping to 112 of 200 when only the speculative path changed. The practical consequence for someone using your article to pick a strategy is that you evaluate at parallel 1 and serve at 64, so the thing you validated is not the thing you ship. Worth a line beside the throughput charts.


