Regularization in Neural Networks

Regularization refers to methods that improve generalization by reducing a model’s effective capacity, variance, or sensitivity to noise. Unlike normalization layers, which stabilize optimization, regularizers shape the hypothesis space to avoid overfitting.

Regularization operates through different methods, including penalties on parameters and averaging hypotheses to reduce variance:

  • Weight decay adds an L2 penalty to the loss, such that the loss and gradient descent update rule become

    Weight decay shrinks weights toward zero, encouraging smoother, lower-norm solutions that reduce model complexity and avoid sharp minima.
    • Statistically, it corresponds to MAP estimation under a Gaussian prior, lowering the variance of the estimator and improving generalization.
    • Because models start with small weight values, stopping gradient descent early (i.e., when the validation error stops decreasing) implicitly acts as weight decay.
      ‎
  • Dropout randomly disables activations during training. For activation :

    It increases generalization by forcing redundant representations and reduces effective model capacity. At inference, dropout uses the expected activation by averaging over all possible combinations of input neurons.
    ‎
  • Residual (skip) connections add the input of a layer directly to its output in-between blocks, such that , where is a learned transformation (e.g., a feedforward block or attention module). They stabilize optimization by improving gradient flow by reducing the frequency of vanishing/shattered gradients, allowing very deep networks to train effectively, and encouraging solutions that remain close to the identity mapping when needed.
    ‎
  • Model averaging reduces variance by combining multiple hypotheses rather than relying on a single model. It includes ensembling strategies and explicit averaging of parameters.
    • Ensembling works by training multiple models and combining their predictions (usually by averaging). Ways to differentiate models are not specified, and the main goal is to reduce variance and improve generalization.
    • Bagging is an ensembling method that samples bootstrap datasets, trains one model per dataset and then averages the predictions. It is very useful for smaller/noisier datasets and decorrelates models via resampling.
    • Mixture-of-Experts (MoEs) route each input to a subset of expert networks, assigning learned gating weights (usually sparse) to each expert, such that

      MoEs regularize by activating only a few experts per input, creating structured sparsity and specialized submodels that reduce overfitting.

Examples

Vanishing Gradients & ResNets

The deeper a neural network grows, the more likely it will suffer from vanishing gradients because downstream layers (i.e., earlier layers) are the product of many backpropagated gradients–any of which may be close to zero. This example explores one approach to address vanishing gradients.

For one, the vanishing gradient problem can arise from saturating activation functions, such as the sigmoid.

One common way to tackle vanishing gradients is by adding residual connections. The figure
below shows a simplified example of a residual block. Assume that the weights consist of an
affine layer with zero biases.

Dropout

In this example we explore dropout as a form of regularization.