Graph
Batch

📦Batch

NEW

A set of training examples processed together in a single model update step.

DESCRIPTION

In machine learning, a batch groups multiple examples to compute gradients and update parameters efficiently. Mini-batches balance gradient estimate quality and compute efficiency, enabling GPU parallelism. Full-batch computes exact gradients but can be slow; stochastic uses single examples with noisy updates. Batch selection influences convergence, generalization, and stability. Practical training typically uses mini-batches tuned alongside learning rate and optimizer.

ALTERNATIVE DEFINITIONS

Google Developers ML Glossary

A set of examples used in one training iteration.

Concise definition focused on training iteration semantics.

Source

Stanford CS231n

In practice, we use a minibatch of examples to estimate the gradient at each step, which makes the updates less noisy and more efficient.

Emphasizes mini-batches for efficiency and reduced gradient noise.

Source

Batch Size Mini-Batch Epoch Stochastic Gradient Descent Full-Batch Gradient Descent Learning Rate Optimizer Convergence

COMPETING TERMS

Online Learning Streaming Training

KNOWLEDGE AREAS

AI Data Science

TARGET AUDIENCE

AI Engineer Data Scientist MLOps Engineer

EXTERNAL SOURCES

TOP QUESTIONS

Why use batches in training?

Batches enable efficient parallel computation, stabilize gradient estimates, and reduce memory overhead compared to full-batch training.

Category: Relevancy

How do batches relate to epochs?

An epoch is one pass over the dataset; it consists of multiple batches processed sequentially.

Category: Concept

Do larger batches always train faster?

They improve throughput but may hurt generalization or require learning rate scaling; beyond hardware limits, returns diminish.

Category: Tradeoff

What is mini-batch training?

Processing a small subset of examples per update, balancing gradient quality and computational efficiency.

Category: Definition

How to choose batch composition?

Shuffle data, optionally stratify by labels, and consider padding or bucketing for sequence lengths in NLP.

Category: Practice

Does batch order matter?

Shuffling each epoch reduces order effects and helps avoid systematic bias during training.

Category: Best practices

What is gradient accumulation?

Accumulating gradients across several small batches simulates a larger effective batch size within memory limits.

Category: Technique

How do batches affect Batch Normalization?

Small batches can yield noisy batch statistics, degrading BatchNorm performance; consider alternatives like LayerNorm.

Category: Interaction

Are batches relevant for inference?

Yes, batching improves throughput, but may add latency; tune batch sizes to meet SLAs.

Category: Operations