Skip navigation
Batching strategies in LLM inference, clearly explained!
0:00 / 0:21

Batching strategies in LLM inference, clearly explained!

Akshay 🚀

@akshay_pachaar291K followers

Visit on X
298 likesDownloadOriginal post

30,234 views

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.

10 Comments

Comments from the original post on X (Twitter)

  • Hussain Hashim | Building SundayBack's profile picture

    @itsthedonhashim

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

    1 like

  • Vikrant Guleria's profile picture

    @vguleria19

    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.

  • Gregor's profile picture

    @bygregorr

    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?

  • Workspai's profile picture

    @workspai_com

    LLM inference really is its own kind of systems problem.

  • Anoy's profile picture

    @Anoyroyc

    continuous batching is the one that changed everything for me.

  • DISCOVER Robotics's profile picture

    @DISCOVERrobotic

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

  • Grace Green's profile picture

    @GraceGreencait

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

  • AI Mastery Guide's profile picture

    @aiseomastery

    Great breakdown, saving this one

  • Lee Garcia's profile picture

    @LeeGarciacAi

    Nice

  • Taiko TOEDA's profile picture

    @TaikoToeda

    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.