Zubnet AIसीखेंWiki › Batch Size & Epoch
Training

Batch Size & Epoch

Mini-Batch, Training Epoch
Batch size ये है कि model अपने parameters update करने से पहले कितने training examples process करता है। एक epoch पूरे training dataset के through एक complete pass है। 1 million examples पर 1,000 batch size के साथ 3 epochs के लिए trained एक model प्रति update 1,000 examples process करता है, per epoch 1,000 updates लेता है, और total 3,000 updates।

यह क्यों matter करता है

Batch size और epochs training में सबसे fundamental controls हैं। Batch size training speed, memory usage, और यहाँ तक कि model क्या सीखता है उसे भी affect करता है (small batches noise add करते हैं जो generalization में help कर सकता है; large batches faster converge होते हैं लेकिन worse generalize कर सकते हैं)। Epochs की संख्या determine करती है कि model हर example को कितनी बार देखता है — बहुत कम और underfit, बहुत ज़्यादा और overfit।

Deep Dive

In practice, stochastic gradient descent processes the training data in random mini-batches. Each batch gives an estimate of the true gradient — larger batches give better estimates (less noise) but cost more memory and compute per step. Typical batch sizes range from 32 (small models, single GPU) to millions of tokens (LLM pre-training across thousands of GPUs).

The Large-Batch Training Challenge

LLM pre-training uses enormous effective batch sizes (millions of tokens per update) distributed across many GPUs. At this scale, the learning rate must be carefully tuned — the linear scaling rule (double the batch size, double the learning rate) works up to a point, then breaks down. Gradient accumulation lets you simulate large batches on smaller hardware by accumulating gradients across multiple forward passes before updating.

Epochs in the LLM Era

Modern LLM pre-training typically runs for less than one epoch on the full dataset — the data is so large that the model never sees all of it. This is a shift from classical ML where 10–100 epochs was normal. Research suggests that repeating data (multiple epochs) can actually hurt LLM performance due to memorization effects, though this depends on data quality. Fine-tuning, by contrast, typically runs for 1–5 epochs on a much smaller dataset.

संबंधित अवधारणाएँ

← सभी Terms
← Backpropagation Beam Search →