liveBook · Manning

Batching

As explained in Machine Learning System Design

A model-training approach that learns from a collected batch of data rather than updating continuously per incoming example.

Batching processes a collected group of examples or requests together instead of updating or serving each one continuously. In model serving, it primarily improves throughput, but the right design depends on the allowed latency and workload shape. section 15.2.2 section 15.2.1

Choose the batching pattern against the product and system constraints:

  • Use offline batches when predictions can wait; use dynamic batching when requests arrive online and a short accumulation window remains acceptable. section 15.2.2 section 15.5.1
  • Set a time or request-count limit, such as waiting 20 milliseconds or 32 requests, whichever comes first, to balance responsiveness and throughput. section 15.2.2
  • Group variable-length language-model inputs by size to reduce padding overhead, accepting smaller batches or a longer accumulation window. section 15.2.2
  • Treat batch throughput, latency, cost, scaling, data security, and prediction quality as operational requirements rather than implementation details. section 15.5.1 section 15.2.1

Retail demand forecasting

A retailer can run daily, weekly, and monthly forecasts over large datasets using scheduled containers, horizontally scaled batch jobs, and results written back to storage. Monitoring tracks job success, duration, failures, processed rows, resource use, accuracy, and data validation. section 15.5.1

Batch learning also supports scheduled model updates: retraining on the latest data changes the model, so the resulting behavior must be checked against the reason for retraining and the expected output quality. section 14.1.2

How Machine Learning System Design covers it

How deep it goes
Explains offline, dynamic, and size-grouped batching with latency, padding, scaling, and monitoring tradeoffs.
Examples
Uses dynamic API request windows, size-grouped language-model inputs, and scheduled retail demand forecasts.
What it assumes
Assumes familiarity with model serving, inference, latency, throughput, and scheduled retraining.
What you can do after
Apply it via scheduled jobs or dynamic inference windows while monitoring throughput, latency, failures, resources, and prediction quality.
How it connects
Connects batching to throughput, latency, inference optimization, model serving, parallelism, retraining, and monitoring.

Also explained in

Compare how 15 books explain batching →

Related concepts

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