liveBook · Manning

Batching

As explained in LLMs in Production

A microbatch is a subdivision of a larger batch that is processed as one unit within a parallel training pipeline.

Microbatching divides a large training batch into smaller units that move through a pipeline. Earlier handoffs keep downstream GPUs working instead of waiting, reducing the pipeline’s idle bubble. section 3.3.2

Use microbatching with these constraints in mind:

  • Increase the microbatch count to improve utilization, especially as the number of pipeline GPUs grows. section 3.3.2
  • Expect higher memory demand because cached activations grow linearly with each microbatch. section 3.3.2
  • Keep the overall batch size and model memory requirements in view; larger GPUs can provide better utilization than many smaller ones. section 3.3.2

Estimating the idle bubble

For four GPUs and one large batch, the pipeline can leave devices idle 75% of the time. Using four microbatches reduces the reported idle time to about 43%. section 3.3.2

Figure 3.6 The bubble problem. When data runs through a broken-up model, the GPUs holding the model weights are underutilized while they wait for their counterparts to process the data. A simple way to reduce this bubble is to use microbatching.
figure

Use the bubble diagram to see how smaller batches shorten waits between pipeline stages. section 3.3.2

How LLMs in Production covers it

How deep it goes
Explains handoff timing, idle-percentage estimation, and memory trade-offs, but stops short of detailed scheduling implementations.
Examples
Compares four GPUs with one batch against four microbatches and illustrates the pipeline bubble visually.
What it assumes
Assumes familiarity with GPUs and distributed training while defining microbatches through pipeline-stage behavior.
What you can do after
Apply microbatching to reduce pipeline stalls while evaluating GPU count, batch size, and activation memory.
How it connects
Connects microbatching to pipeline parallelism, cached activations, model compression, and PipeDream.

Also explained in

Compare how 15 books explain batching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.