liveBook · Manning

Batch size

As explained in Designing Deep Learning Systems: A guide for software engineers

The number of training examples processed together in one model-training step.

Batch size is the number of training examples processed together in one model-training step. It is a hyperparameter whose value must be set before training begins. section 5.0

Changing batch size can affect model quality, training time, and memory requirements, making it a practical configuration target for hyperparameter optimization. section 5.0

Use batch size as part of an HPO search rather than tuning it only by manual trial and error:

  • Define candidate values such as 8, 16, 32, 64, 128, and 256. section 5.2.1
  • Evaluate batch size together with other hyperparameters, such as learning rate, because their combination determines trial results. section 5.2.1
  • Prefer automatic HPO when the search space becomes large or manual comparisons become time-consuming and error-prone. section 5.2.1

Searching batch size with learning rate

A search over six batch-size values and six learning-rate values produces 36 training trials. Comparing their evaluation results identifies the best pair. section 5.2.1

Figure 5.1 This high-level view of the HPO workflow shows that the process is essentially an experiment to find the optimal hyperparameter values.

Use the HPO workflow diagram to see batch size as one configurable input in an experiment for finding effective hyperparameter values. section 5.2.1

How Designing Deep Learning Systems: A guide for software engineers covers it

How deep it goes
Defines batch size and demonstrates search-space tuning, but does not explain its training-loop internals.
Examples
Uses candidate values from 8 through 256 and a 36-trial batch-size and learning-rate search.
What it assumes
Assumes familiarity with model training while defining hyperparameters and their pre-training configuration role.
What you can do after
Apply batch size through automatic hyperparameter optimization and compare training evaluation results.
How it connects
Connects batch size with hyperparameter optimization, learning rate, model training, quality, time, and memory.

Also explained in

Compare how 12 books explain batch size →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing Deep Learning Systems: A guide for software engineers. The section links point to the parts of the book it draws on.