Skip to content
AI.info

Training and optimization

Regularization as a Portfolio

Compare explicit penalties, stochastic layers, target smoothing, early stopping, model averaging, and data-side regularization without treating them as interchangeable.

By the end you can

Visual

Regularization can act on parameters, representations, targets, data, or selection

Methods with the same goal can alter different mechanisms. A small Inception of 1,649,402 parameters reached 100.0% training accuracy on CIFAR-10 in every configuration its authors tested — explicit regularizers on, explicit regularizers off. So the branch you reach for below matters more than how hard you pull it. Two branches can also collide badly enough to cost 8.87 accuracy points, as the next section shows.

FigureHierarchy · 6 levels
  • Parameter control

    Weight decay, norm constraints, or structured penalties alter parameter updates.

    • Representation noise

      Dropout and stochastic depth perturb internal computation during training.

      • Target shaping

        Label smoothing or soft targets change the desired output distribution.

        • Data variation

          Augmentation expands the evidence and encodes invariances.

          • Training duration

            Early stopping limits how long the model fits the training set.

            • Trajectory aggregation

              EMA or SWA combines parameter states across time.

Example

Regularizers can reinforce or undermine each other

These interactions should be tested rather than assumed. The measured cases below are not warnings about hypothetical portfolios: each is a published number produced by adding a second regularizer to a network that was already working.

  • Strong augmentation plus label smoothing: Both may reduce confidence, potentially harming rare-class recall or selective prediction.
  • Weight decay plus normalization: Scale-invariant parameters can respond differently from ordinary matrix weights.
  • Dropout plus batch normalization: A DenseNet on CIFAR-100 scored 77.42% test accuracy with no dropout in each bottleneck. With dropout 0.5 in each bottleneck it scored 68.55%. That is 8.87 points lost by adding a regularizer. Li and colleagues named the cause in 2019: “The inconsistency of variances in Dropout and BN (we name this scheme “variance shift”) causes the unstable numerical behavior in inference that leads to erroneous predictions finally.” BN's stored moving variance no longer matches the real activation variance at test time.
  • Early stopping plus schedule decay: A checkpoint chosen before the refinement phase may make the schedule look ineffective.
  • EMA plus BatchNorm: Averaged weights and stored running statistics are separate state. Izmailov and colleagues could not score their averaged weights straight away. Their fix, under the heading “Batch normalization”: “we run one additional pass over the data, as in Garipov et al. [2018], to compute the running mean and standard deviation of the activations for each layer of the network”. PyTorch ships that step as a function: “torch.optim.swa_utils.update_bn() is a utility function used to update SWA/EMA batch normalization statistics at the end of training”.

Analogy

A training plan with several forms of restraint

An athlete’s plan holds resistance work, varied drills, recovery, and a competition schedule at once. Each limits a different failure and each becomes counterproductive in excess.

None of them covers for another. Drop recovery and no amount of extra drilling replaces it, which is why a portfolio needs several regularizers rather than a larger dose of one.

Regularization works as a coordinated portfolio, not a pile of penalties.

Steps

Build a minimal regularization portfolio

Add methods one at a time, in an order that keeps you able to say what each one did.

Step 4 is the one most often skipped. A regularizer's coefficient is not its only setting. Its position in the schedule is another.

Timing has been measured. ResNet-18 and All-CNN were trained on CIFAR-10 and CIFAR-100 with SGD, momentum 0.9 and an exponentially decaying learning rate. Golatkar and colleagues then moved weight decay and data augmentation around in time. Switching both off after the first ~100 epochs left final accuracy essentially unchanged. Their first finding reads: “Applying weight decay or data augmentation beyond the initial transient of training does not improve generalization”.

Switching weight decay on late did damage. Discussing their Figure 1: “delaying WD by 50 epochs causes a 40% increase in test error, from 5% regularizing all along, to 7%”. Both runs converge in the same loss landscape. Both use the same coefficient. Only the timing differs.

The 2019 paper is called Time Matters in Regularizing Deep Networks, and its abstract draws the conclusion: “This suggests that what matters for training deep networks is not just whether or how, but when to regularize”. An ablation that only turns methods on and off will not see any of this.

FigureProcess · 6 steps
  1. 1. Diagnose the gap

    Use learning curves, label audits, and slice errors to name the likely failure.

  2. 2. Strengthen data first

    Improve coverage or augmentation when the missing variation is known.

  3. 3. Add one model-side method

    Choose decay, dropout, smoothing, or another targeted mechanism.

  4. 4. Retune optimization

    Regularization can change stable learning rates and useful training duration.

  5. 5. Test interactions

    Compare combinations only after individual effects are understood.

  6. 6. Simplify the winner

    Remove terms whose absence does not hurt held-out behavior.

Key idea

A regularizer can convert an overfitting story into an underfitting problem

If training performance degrades sharply and validation does not improve, the regularizer may be too strong or aimed at the wrong cause. More regularization is not automatically safer.

Track both fit and generalization gaps, plus the slices that motivated the change. Remove methods that do not earn their complexity.

The purpose is useful generalization, not the smallest possible training score gap.

Regularization is a response to a diagnosed generalization problem

A model can overfit through excessive capacity, noisy labels, shortcut features, narrow data coverage, or checkpoint selection. No single regularizer addresses every cause. And the whole explicit portfolio buys less than its reputation suggests.

There is a number for that. A small Inception of 1,649,402 parameters was trained on CIFAR-10 in four configurations. All four reached 100.0% training accuracy. Their test figures were 89.05%, 89.31%, 86.03% and 85.75%. Turning on both explicit regularizers — random cropping plus weight decay — moved test accuracy from 85.75% to 89.05%. Then the same team relabelled CIFAR-10 at random. The same architecture still reached 100.0% training accuracy on pure noise, at 9.78% test accuracy. Zhang and colleagues drew the conclusion in 2017: “Explicit regularization may improve generalization performance, but is neither necessary nor by itself sufficient for controlling generalization error.”

An independent group at MILA/Montréal re-ran the question on their own CNNs, on CIFAR-10 and on random labels, across dropout, input dropout, Gaussian noise and weight decay. Their finding: “Our findings extend their claim and indicate that explicit regularizations can substantially limit the speed of memorization of noise data without significantly impacting learning on real data”. Explicit regularization slows memorization. It does not prevent it.

So begin with evidence from learning curves and error slices. Add the smallest change that targets the failure you observed, then check what else it moved. And notice how far apart the standard settings are.

Dropout was published in 2014, by Srivastava, Hinton and colleagues. Each unit is retained with a probability p. That p can be chosen on a validation set, or it “can simply be set at 0.5, which seems to be close to optimal for a wide range of networks and tasks”. Not everywhere, though: “for the input units, however, the optimal probability of retention is usually closer to 1 than to 0.5”.

Label smoothing carries a much smaller number. Szegedy and colleagues applied it on ImageNet “with K = 1000 classes”, taking “u(k) = 1/1000 and ε = 0.1”, and reported “a consistent improvement of about 0.2% absolute both for top-1 error and the top-5 error”. Half the units removed in one method. A tenth of the target mass redistributed in the other. Two regularizers, two very different magnitudes, and no reason to expect one coefficient's intuition to transfer to the other.

A regularization portfolio should be justified, not inherited as ritual.

Comparison

Five common methods change different parts of learning

Their names should not be treated as equivalent strength knobs. One name can even cover two different operations. Adding an L2 term to the loss and decaying the weights directly are the same thing under plain SGD. Under Adam they are not.

Loshchilov and Hutter open their abstract with the distinction: “L2 regularization and weight decay regularization are equivalent for standard stochastic gradient descent (when rescaled by the learning rate), but as we demonstrate this is not the case for adaptive gradient algorithms, such as Adam.” Then they size it: “we show that Adam generalizes substantially better with decoupled weight decay than with L2 regularization, achieving 15% relative improvement in test error”. The result holds across CIFAR-10 and ImageNet32x32, across training budgets from 100 to 1800 epochs, and across three learning-rate schedules — fixed, drop-step and cosine annealing.

The decoupled form is the one PyTorch ships as torch.optim.AdamW, documented as an optimizer “where weight decay does not accumulate in the momentum nor variance”. That is what the weight-decay row's parameterization risk means in practice. The same nominal coefficient is a different intervention depending on the optimizer it is wired into.

Weight averaging is the cheapest entry on this list. Izmailov and colleagues averaged points along the SGD trajectory, called it Stochastic Weight Averaging, and reported gains on CIFAR-10, CIFAR-100 and ImageNet. Their own summary is blunt: SWA “is extremely easy to implement, improves generalization, and has almost no computational overhead”. Cost is not the reason to leave averaging out of a portfolio. Though, as the interactions section showed, the averaged weights still need their BatchNorm statistics recomputed before they can be scored.

FigureComparison · 5 columns

Weight decay

Shrinks selected parameters during optimization.

  • Acts on: parameter trajectory
  • Possible benefit: controlled norms
  • Risk: parameterization dependence
  • Audit: group and schedule policy

Dropout

Randomly removes activations or paths during training.

  • Acts on: internal computation
  • Possible benefit: reduce co-adaptation
  • Risk: train/eval mismatch
  • Audit: placement and rate

Label smoothing

Moves target mass away from a hard one-hot vector.

  • Acts on: target distribution
  • Possible benefit: less overconfidence
  • Risk: altered calibration or retrieval
  • Audit: downstream uncertainty use

Early stopping

Selects a checkpoint before further training harms validation evidence.

  • Acts on: duration and selection
  • Possible benefit: limit fitting
  • Risk: validation overuse
  • Audit: patience and noise

Model averaging

Combines weights from several trajectory points.

  • Acts on: final parameter state
  • Possible benefit: smoother solution
  • Risk: incompatible states
  • Audit: normalization statistics

Regularization decisions need more than average validation accuracy

Examine calibration, abstention, rare classes, robustness, representation quality, and downstream transfer where relevant. A method can improve one metric by erasing distinctions another task needs. And that trade has been measured on a single setting of a single coefficient.

Label smoothing cut expected calibration error for Inception-v4 on ImageNet from 0.071 to 0.035 at α = 0.1. For ResNet-56 on CIFAR-100 it cut the same measure from 0.150 to 0.024 at α = 0.05. Then the same smoothing degraded the same network in a different role. Müller and colleagues list it among their 2019 contributions: “We show that label smoothing impairs distillation, i.e., when teacher models are trained with label smoothing, student models perform worse.” The smoothed logits lose the between-class similarity information a student needs. A validation-accuracy column would have shown none of this, in either direction.

Report training cost and sensitivity as well. A fragile portfolio that requires a broad sweep may not be the practical winner.

Regularization changes the learned function and its uncertainty, not only the validation gap.

Key takeaways