Batch Size.

The number of training examples processed together in a single forward and backward pass before updating model parameters.

Batch size determines how many training examples are processed simultaneously during each optimization step in neural network training. This fundamental hyperparameter directly impacts memory usage, training stability, and computational efficiency. Larger batch sizes provide more stable gradient estimates but require more memory, while smaller batches use less memory but produce noisier gradients that can lead to less stable training.

During training, examples are grouped into batches and processed in parallel through the network. The gradients from all examples in the batch are averaged before updating the model weights, creating a trade-off between computational efficiency and gradient quality. Mini-batch gradient descent, using batch sizes between 32 and 512, represents a middle ground between the stability of full-batch training and the efficiency of single-example updates. The optimal batch size depends on the model architecture, available hardware, and specific training objectives.

Choosing the right batch size involves balancing multiple constraints and objectives. Larger batches generally train faster per epoch due to better hardware utilization but may require learning rate adjustments and can sometimes lead to poorer generalization. Smaller batches often generalize better and require less memory, making them essential for training large models on limited hardware. Common misconceptions include assuming larger batches are always better or that batch size doesn't affect final model performance, when in reality it significantly influences both training dynamics and final model quality.