# Dynamic Batching

- **Canonical URL:** https://getaimath.com/dictionary/dynamic-batching/
- **Topics:** [LLM Inference: Prefill & Decode](https://getaimath.com/dictionary/category/llm-inference-prefill-and-decode/)
- **Last updated:** 2026-11-25

## What is Dynamic Batching?

**In one sentence:** Dynamic batching waits a short moment to collect incoming requests and then runs them together as a batch.

It balances waiting and efficiency: a few milliseconds of waiting can gather more requests to process together, which uses the hardware better.

![How an AI Replies: 1. Read Your Question → 2. Type the Answer — Simple two-step cartoon: Step 1 (Prefill) shows the AI scanning your entire question in one flash (causing the brief pause before it starts talking); Step 2 (Decode) shows it typing out the reply one word at a time.](https://getaimath.com/diagrams/llm-inference-prefill-and-decode.png)
*Napkin Diagram (LLM Inference: Prefill & Decode): Every AI reply has two halves: gulping down your whole prompt at once, then speaking the answer one word at a time.*

## What is an example of Dynamic Batching?

An image model server might wait up to 10 ms to batch several requests together.

## Why does Dynamic Batching matter?

Dynamic batching improves efficiency for many kinds of AI servers.

## Related Concepts

- [Static Batching](https://getaimath.com/dictionary/static-batching/): Static batching groups requests together and runs them as one fixed batch until all of them are finished.
- [Speculative Decoding](https://getaimath.com/dictionary/speculative-decoding/): Speculative decoding speeds up generation by letting a small fast model guess several tokens ahead, then having the big model check them all at once.
- [Continuous Batching](https://getaimath.com/dictionary/continuous-batching/): Continuous batching lets a server add new requests to a running batch as soon as others finish, instead of waiting for the whole batch.
- [Medusa Decoding](https://getaimath.com/dictionary/medusa-decoding/): Medusa decoding adds extra small prediction "heads" to a model so it can guess several future tokens at once, then verify them.
- [PagedAttention](https://getaimath.com/dictionary/pagedattention/): PagedAttention is a way to store the KV cache in small fixed-size blocks, like pages in a book, to avoid wasting memory.
- [Parallel Decoding](https://getaimath.com/dictionary/parallel-decoding/): Parallel decoding is any method that produces or checks several tokens at the same time instead of strictly one by one.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/dynamic-batching/)
