liveBook · Manning

Batching pattern

As explained in Distributed Machine Learning Patterns

A data-processing pattern that divides a dataset into small batches so processing can operate within available memory.

The batching pattern divides a dataset into smaller batches so a machine-learning system can ingest and process data without loading the entire dataset into memory. section 2.0 section 2.10

A typical workflow is:

  • Divide the dataset into subsets or mini-batches small enough to load into memory. section 7.2.2
  • Load one batch, perform expensive mathematical operations, and use the result for a model-training iteration. section 7.2.2
  • Consume batches sequentially, repeating the process until the dataset has been processed. section 2.4

Batching reduces out-of-memory risk and allows larger datasets to be processed by reducing mini-batch size. It still depends on storing and partitioning the full dataset, so extremely large datasets may require sharding across machines. section 2.4 section 7.2.2

Expanded Fashion-MNIST

A decompressed 50-GB dataset can be divided into ten 5-GB batches and consumed sequentially for model training. A smaller example divides 1,000 records into batches of 500. section 2.4 section 7.2.2

Figure 7.6 The dataset is divided into two batches and processed sequentially. The first batch is consumed to train the model at time t0, and the second batch is consumed at time t1.
07-06

Shows a dataset divided into two batches and processed sequentially during model training. section 7.2.2

How Distributed Machine Learning Patterns covers it

How deep it goes
Explains mini-batch formation, sequential processing, memory benefits, sizing trade-offs, and the boundary where sharding becomes necessary.
Examples
Uses expanded Fashion-MNIST, ten 5-GB batches, 1,000-record batches, and sequential-processing diagrams.
What it assumes
Assumes familiarity with datasets and model training while teaching the ingestion workflow from dataset partitioning onward.
What you can do after
Apply it via sequential mini-batch ingestion to reduce memory pressure during model training.
How it connects
Connects data ingestion, model training, sharding, caching, and distributed training.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Distributed Machine Learning Patterns. The section links point to the parts of the book it draws on.