How machines learn
Regularization, Early Stopping, and Capacity Control
Understand structural constraints, penalties, noise, data augmentation, and early stopping as different ways to control effective capacity.
By the end you can
- Define regularization as a preference or constraint that discourages fragile fitting
- Compare explicit penalties, structural limits, data augmentation, stochastic noise, and early stopping
- Explain why regularization strength must be selected with validation evidence
- Recognize when regularization hides a deeper data, split, or target problem
Regularization changes which good training fits are preferred
Many parameter settings can achieve similar training loss. Regularization gives the learning procedure a reason to prefer some of them: smaller coefficients, smoother functions, fewer branches, stable representations, or behavior unchanged by valid transformations.
The aim is not to make the model weak. It is to reduce reliance on detail that lacks enough evidence to be trusted.
That the training fits really are interchangeable has been measured. A 1,649,402-parameter Inception was trained on CIFAR-10 in several configurations, and reached 100.0% training accuracy in every one of them. What moved was the test accuracy: 89.05% with random crops and weight decay, 85.75% with neither. On ImageNet the same architecture went from 77.84% top-1 and 93.92% top-5 with augmentation, dropout and weight decay to 59.80% and 80.38% with all three switched off. The regularizers were not stopping the network from fitting the training set. It fitted the training set perfectly either way. They were selecting which perfect fit it settled on. The five authors who ran the experiment, writing in 2016, state the consequence flatly: “Explicit regularization may improve generalization performance, but is neither necessary nor by itself sufficient for controlling generalization error.” The same network also reached 100.0% training accuracy on CIFAR-10 after the labels were randomised. On test it then scored 9.78%. A perfect fit with nothing in it to transfer.
Dropout is the clearest demonstration that this is a preference rather than a punishment. Randomly deleting units during training, reported in 2014, took the best convolutional network on Street View House Numbers from 3.95% error to 3.02%, with dropout on the fully connected layers. Applied to every layer, it reached 2.55%. On CIFAR-10 the same progression ran 14.98% to 14.32% to 12.61%. On CIFAR-100 it ran 43.48% to 37.20%. The networks were not made smaller. They were made unable to depend on any particular unit being present.
Regularization encodes a preference about which fitted solutions are more likely to transfer.
Visual
Different controls act at different parts of learning
The word regularization covers several mechanisms with distinct effects. Each acts at a different point in the pipeline, and each of the five below is demonstrated later in this lesson by a measured case rather than by assertion.
Model structure
Limit depth, interactions, parameters, rules, or other representational freedom.
Objective penalties
Add costs for large, complex, or undesirable parameter patterns.
Data transformations
Create valid variations that teach invariance and expand evidence.
Training noise
Use stochastic masks, batches, or perturbations that discourage brittle co-adaptation.
Stopping time
Select a checkpoint before continued fitting specializes too strongly to training data.
Comparison
L1, L2, and other penalties express different preferences
The names matter less at this stage than the behavior they encourage.
Two of the claims in this comparison are not folklore. The exact-zero behaviour of the L1 penalty is design intent, and it is stated by the person who introduced the method. Robert Tibshirani, presenting the lasso in 1996: “Because of the nature of this constraint it tends to produce some coefficients that are exactly 0 and hence gives interpretable models.” Driving coefficients to exactly zero while keeping ridge-like stability was the point of the constraint, not a lucky side effect.
The caution that a zero coefficient does not prove irrelevance is likewise a theorem rather than an opinion. Martin J. Wainwright analysed the same estimator in 2006 and found a sharp threshold. Recovering the true sparsity pattern holds above it and fails below it. The threshold relates the number of observations to the problem dimension and the number of non-zero coefficients. Below it the zeros report the size of the sample, not the irrelevance of the features.
L2-style penalty
Discourages large parameter magnitudes smoothly.
- Often spreads influence across features
- Can stabilize correlated inputs
- Strength is a hyperparameter
- Does not guarantee interpretability
L1-style penalty
Encourages many coefficients toward exactly zero in suitable models.
- Can produce sparse solutions
- Feature scaling matters
- Correlated features can be unstable
- Zero coefficients do not prove irrelevance
Structural constraint
Restricts the model family directly.
- Examples include depth or rank limits
- Often easy to explain
- May create abrupt capacity changes
- Can underfit if too strict
Key idea
Data augmentation teaches an invariance
Flipping an image, masking words, adding noise to audio, or perturbing a numeric value is valid only if the target should remain stable under that transformation, since an augmentation that changes label meaning teaches contradictions.
Treat each transformation as a domain claim. Test it on realistic examples and inspect performance separately on original and transformed data.
The best-known demonstration is also an admission. The 60-million-parameter network that won ImageNet in 2012 had exactly two defences against overfitting: label-preserving data augmentation, and dropout in the first two fully-connected layers. The augmentation was random 224x224 crops and horizontal reflections of the 256x256 images, which enlarged the training set by a factor of 2048. Not one of those 2048 variants is new evidence about the world. Each is a restatement of the authors' judgement that a shifted or mirrored photograph keeps its label. Of that scheme they wrote: “Without this scheme, our network suffers from substantial overfitting, which would have forced us to use much smaller networks.” The entry won ILSVRC-2012 with an official top-5 error of 0.15315, against 0.26172 for the second-placed ISI entry. The factor of 2048 bought the capacity to keep the large network. What paid for it was domain knowledge about what a label survives.
Augmentation is not free data; it is encoded knowledge about what changes should not matter.
Visual
Training time itself controls effective complexity
A flexible model may first learn broad patterns and later specialize to training detail.
Stopping time is a regularizer in the formal sense, not a convenience. Two independent groups established that. The 2014 one opens its abstract with the definition: “Early stopping is a form of regularization based on choosing when to stop running an iterative algorithm.” Its data-dependent stopping rule uses no hold-out or cross-validation data at all, attains minimax-optimal rates for Sobolev and other kernel classes, and is tightly connected to the solution path of kernel ridge regression — the stopping index doing the work a ridge penalty would do. A 2007 paper had reached the same equivalence from the other side. It derived the stopping rule by solving an explicit bias–variance trade-off, and obtained the minimax optimal rate O(m^-1/2) in some cases.
The stages below are the usual ordering, not a law. A 2022 experiment trained a network on division modulo 97 with 50% of the table held out. Training accuracy became close to perfect in under 10^3 optimization steps. Validation accuracy needed close to 10^6 steps to reach the same level, with very little evidence of any generalization before 10^5. The abstract states it: “In some situations we show that neural networks learn through a process of "grokking" a pattern in the data, improving generalization performance from random chance level to perfect generalization, and that this improvement in generalization can happen well past the point of overfitting.” A validation-plateau rule firing at 10^4 steps would have kept a checkpoint two orders of magnitude before the model learned the task. The phase transition was independently reproduced and reverse-engineered on modular addition at ICLR 2023. A stopping rule is a bet that the validation curve being watched is the ordinary one.
Initial fit
The model begins capturing strong, common structure.
Useful refinement
Validation improves as the representation becomes task-relevant.
Diminishing returns
Validation changes little while training continues to improve.
Specialization risk
Validation worsens or slice behavior becomes unstable.
Selected checkpoint
A predefined stopping rule keeps an earlier state.
Analogy
An analogy: pruning a productive plant
A fruit tree is pruned so energy is not spent on dense growth that blocks light and weakens fruit production. The goal is not the smallest tree; it is productive structure.
Regularization similarly limits or redirects flexibility toward useful behavior. A model's “productive” structure is inferred from data and metrics, not grown.
Steps
Choose strength as a trade-off, not a ritual
Regularization should be tuned along with capacity and evaluated beyond one aggregate score. Step 4 is not decoration: the section on the cost of control below reports a case in which the aggregate improved while one small subgroup paid for the improvement.
1. Establish the gap
Measure training and validation behavior under a realistic split.
2. Pick one mechanism
Change penalty, structure, augmentation, noise, or stopping rule.
3. Sweep meaningful strengths
Include a weak, moderate, and clearly strong setting.
4. Inspect slices and calibration
Look for benefits and losses hidden by the average.
5. Confirm stability
Repeat promising settings and check a final untouched test.
Example
Do not regularize away evidence of a broken problem
These situations require root-cause work before another penalty setting.
The first and the fifth of them are not house preference. Three regulators — the FDA, Health Canada and the UK's MHRA — jointly issued ten guiding principles for machine learning in medical devices on 27 October 2021. Principle 4 is titled “Training Data Sets Are Independent of Test Sets”, and reads in full: “Training and test datasets are selected and maintained to be appropriately independent of one another. All potential sources of dependence, including patient, data acquisition, and site factors, are considered and addressed to assure independence.” Site is named there explicitly, alongside patient and data acquisition. Principle 6 requires that “Model design is suited to the available data and supports the active mitigation of known risks, like overfitting, performance degradation, and security risks”. A regularization sweep run on a split that violates principle 4 is tuning a number that measures nothing. Three regulators have put that in writing.
- Validation contains future data or duplicates, making the gap uninterpretable.
- Training and serving features are computed differently.
- Labels changed definition halfway through collection.
- The target has little plausible signal in the available inputs.
- One site or group dominates the dataset and the intended launch is broader.
- Poor training fit indicates underfitting or optimization failure rather than excessive specialization.
Every constraint trades one kind of error for another
Stronger regularization usually increases bias while reducing variance. That trade can improve validation performance. It may also erase rare legitimate patterns.
Report which slices lose performance, not only whether the aggregate improves; the “simpler” solution is preferable only when its mistakes are more acceptable for the intended decision.
Who pays has been measured. A 2019 experiment trained a ResNet18 on 29,500 lighter-skin images from Diversity in Faces plus 500 darker-skin images from UTKFace. The control it studied is one of the five levers above: noise added during training, together with clipping. That control cost accuracy far more on the 500-image subgroup than on the majority. The same effect turned up in sentiment analysis of African-American English tweets at epsilon = 3.87 and 8.99, and in iNaturalist species classification at epsilon = 4.67. The authors state the pattern themselves: “Furthermore, accuracy of DP models tends to decrease more on classes that already have lower accuracy in the original, non-DP model, i.e., "the poor become poorer."” A second group confirmed the same disparity at KDD in 2021 and proposed DPSGD-F to remove it. The direction of the damage is predictable. Constraint falls hardest where the evidence was thinnest, which is precisely where an aggregate score is least able to register it.
The trade is not even monotone. Deep double descent was posted in December 2019 and published in the Journal of Statistical Mechanics in 2021. Its six authors worked on CIFAR-10, CIFAR-100 and two machine-translation datasets. As model size grows, they showed, test performance “first gets worse and then gets better”. The same pattern appears “as a function of the number of training epochs”. There are also “certain regimes where increasing (even quadrupling) the number of train samples actually hurts test performance”. A sweep of three settings along one axis can read such a curve backwards.
Key takeaways
- Regularization favors some training fits over others: a 1,649,402-parameter Inception hit 100.0% training accuracy on CIFAR-10 in every configuration and still ranged from 85.75% to 89.05% on test.
- Structural limits, objective penalties, augmentation, stochastic noise, and early stopping act through different mechanisms. Early stopping is a proved regularizer with minimax-optimal rates, not folk practice.
- Data augmentation is a domain assumption. The factor-2048 expansion behind the ILSVRC-2012 winner was crops and reflections its authors judged label-preserving, not new evidence.
- Regularization strength is chosen with validation evidence and confirmed on untouched data, but the curve can mislead: grokking reached near-perfect training accuracy under 10^3 steps and near-perfect validation only around 10^6.
- Stronger control can improve the aggregate while harming rare patterns. Differentially private training cost a 500-image subgroup far more accuracy than the 29,500-image majority.
- Leakage, inconsistent pipelines, weak labels, missing signal, and optimization failure require root-cause repair rather than stronger penalties. That is why guiding principle 4 demands train/test independence down to site factors.