Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Core concepts

Learning Rate and Batch Size

About 3683 characters Updated Nov 30, 2026 19 views AI wiki

The learning rate is the coefficient for how far each step of gradient descent moves along the gradient direction, and the batch size is the number of samples used for each parameter update. Together they determine training stability, convergence speed, and final generalization ability; they are the two hyperparameters most in need of joint tuning in deep learning, and they form an implicit trade-off relationship.

Core Principles

A parameter update can be written as "new parameter equals old parameter minus learning rate times the gradient of the current batch." If the learning rate is too large, updates jump across the bottom of the loss valley, oscillating back and forth or even diverging; if too small, training is slow and easily trapped in flat regions or near local minima. Batch size affects the quality of the gradient: the larger the batch, the smaller the estimation variance of the gradient, the closer the direction to the true gradient, and the higher the hardware throughput; the smaller the batch, the noisier the gradient, and this noise itself has a regularizing effect that often brings better generalization.

The two are empirically linked: the linear scaling rule states that when the batch is enlarged several times, the learning rate can be approximately increased in the same proportion to keep the expected step of parameter updates consistent. But this rule fails when the batch is too large, because a larger learning rate exceeds the upper bound for stable training; then learning rate warmup is needed, letting the learning rate rise linearly from a very small value over the first few hundred to few thousand steps, preventing early gradient explosion from destroying training.

Key Points

Learning rate schedules: common strategies include step decay (multiplying by 0.1 every several epochs), cosine annealing (smoothly decreasing to near zero along a cosine curve), linear warmup plus linear decay, and periodic schedules with restarts. In practice, warmup plus cosine annealing is a relatively safe default.

Batch selection: constrained by GPU memory, it is commonly between 16 and 256. Gradient accumulation can simulate a large batch on devices with small memory, but it does not have the same equivalent effect on batch normalization statistics, which needs attention. If the model contains batch normalization, an extremely small batch makes the statistics variance too large and training unstable, so group normalization or layer normalization can be used instead.

Adaptive methods: Adam and its variants maintain first- and second-order moment estimates for each parameter, and the actual step is normalized, so sensitivity to the learning rate is lower than with stochastic gradient descent. In practice, however, Adam often needs a smaller learning rate, and on fully connected or convolutional networks it generalizes slightly worse than stochastic gradient descent with well-tuned momentum. AdamW fixes the regularization problem of original Adam by decoupling weight decay and has become the mainstream default.

Discriminative fine-tuning: when fine-tuning a pretrained model, lower layers are often given a smaller learning rate and upper layers a larger one, because lower-layer features are more general and do not need major changes. Learning rate sweeps are also common: run several short trainings from very small to very large learning rates, observe the loss curve, and pick the left boundary of the non-exploding range, then shrink it appropriately.

Common Misconceptions

First, believing larger batches are always better. The gains from a very large batch are mainly hardware efficiency, generalization often gets worse, and returns diminish noticeably. Second, judging the learning rate only by training loss. Training loss decreasing normally while validation loss fluctuates sharply often indicates the effective learning rate is too high or the batch is too small. Third, running the whole process with a fixed learning rate, so that late-stage loss bounces around the minimum and wastes budget.

Application Scenarios

Image classification training, large language model pretraining, online incremental training of recommendation models, budget allocation for hyperparameter search, training strategies on small-memory devices, and accelerating convergence in fine-tuning.