Generalization Theory & PAC-Bayes
Why do overparameterized networks generalize? Formal treatment of VC dimension, Rademacher complexity, PAC-Bayes bounds, the role of flatness/sharpness of minima, and the lottery ticket hypothesis.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- Classical Generalization Bounds
- VC Dimension of Neural Networks
- Rademacher Complexity
- PAC-Bayes Bounds
- Flat vs Sharp Minima
- Implicit Regularization of SGD
- Double Descent Revisited
- Common Pitfalls
- Research Perspective
- Summary
- Exercises
Learning Objectives
- State the classical uniform convergence bound and identify why it fails for deep networks.
- Define VC dimension and Rademacher complexity.
- State the PAC-Bayes theorem and interpret the KL divergence penalty.
- Explain the flat minima hypothesis and its connection to generalization.
- Describe how SGD implicitly regularizes toward low-complexity solutions.
Notation
- — population risk, — empirical risk
- — hypothesis class
- — VC dimension
- — Rademacher complexity
- — posterior distribution over hypotheses
- — prior distribution over hypotheses
- — KL divergence from prior to posterior
Core Intuition
Classical statistical learning theory says: more parameters = higher complexity = more overfitting. Yet modern neural networks with millions of parameters generalize well despite perfectly fitting (interpolating) training data. This "mystery of generalization" in deep learning requires going beyond traditional bounds and understanding the implicit biases of the optimization algorithm, architecture, and parameterization.
Generalization Gap
Classical Generalization Bounds
Uniform convergence: With probability , for all :
The "complexity" term depends on the measure: VC dimension, covering numbers, or Rademacher complexity.
VC Dimension of Neural Networks
Definition. The VC dimension of is the largest set of points that can be shattered (classified in all possible ways) by functions in .
For neural networks: A network with weights has VC dimension (Bartlett et al., 1998). For a modern network with parameters and samples, the bound gives:
This is vacuous (greater than the maximum possible loss). Classical bounds completely fail to explain neural network generalization.
Rademacher Complexity
Definition. The empirical Rademacher complexity of :
where are independent Rademacher random variables.
Interpretation: How well can correlate with random noise? High correlation = high complexity.
Bound: .
For neural networks with bounded weights (spectral norm constraints), norm-based Rademacher bounds can be non-vacuous.
PAC-Bayes Bounds
The PAC-Bayes framework bounds the expected risk of a distribution over hypotheses:
Theorem (McAllester, 1999). For any prior (chosen before seeing data) and any , with probability over the draw of training data, for all posteriors :
Interpretation: The generalization gap is bounded by how much the learned distribution diverges from the prior . If training doesn't move far from initialization (small KL), generalization is guaranteed.
Application to neural networks: Let (centered at initialization) and (centered at learned weights). Then:
The bound is tighter when parameters stay close to initialization and when the posterior is concentrated (low ).
Flat vs Sharp Minima
Hypothesis: Networks that converge to "flat" minima (large region with low loss) generalize better than those at "sharp" minima.
Formalization (Keskar et al., 2017): Sharpness of minimum :
Flat minima are robust to perturbations → robust to train/test distribution shift.
Connection to PAC-Bayes: A flat minimum allows a wide Gaussian posterior around with low expected empirical risk, reducing the KL term and yielding a tighter bound.
SAM (Sharpness-Aware Minimization): Explicitly minimizes the worst-case loss in a neighborhood, seeking flat minima:
Implicit Regularization of SGD
SGD with finite learning rate introduces implicit biases:
- Minimum-norm bias: Gradient flow from zero initialization converges to the minimum-norm interpolant (see Gradient Flow).
- Noise-induced regularization: SGD noise (from mini-batches) helps escape sharp minima, favoring flat ones.
- Edge of stability: With large learning rate, SGD oscillates at the edge of stability, implicitly regularizing the largest Hessian eigenvalue.
- Label noise robustness: Early in training, SGD learns signal (low-frequency patterns) before noise (high-frequency) — "early stopping" regularizes even without explicit stopping.
Double Descent Revisited
The test error as a function of model complexity ():
In the heavily overparameterized regime, many interpolating solutions exist; SGD selects the one with favorable properties (minimum norm, flat, aligned with data structure).
Common Pitfalls
Pitfall 1. Citing VC dimension bounds for neural networks as meaningful. They are astronomically loose — orders of magnitude above any achievable gap.
Pitfall 2. Equating "interpolation" with "overfitting." In the overparameterized regime, interpolating models can generalize perfectly well due to implicit regularization.
Pitfall 3. Assuming flatness alone explains generalization. Flatness is parameterization-dependent (reparameterizing weights can make any minimum appear flat or sharp).
Research Perspective
Understanding why deep networks generalize remains one of the central open problems in machine learning theory. Current leading explanations involve: (1) implicit bias of SGD toward low-complexity solutions, (2) the structure of real data (low intrinsic dimension), (3) architecture-induced biases (convolutions, attention), and (4) the neural tangent kernel regime for very wide networks. No single theory fully explains all observations.
Summary
- Classical VC/Rademacher bounds are vacuous for modern networks.
- PAC-Bayes provides tighter bounds via the KL between learned and prior distributions.
- Flat minima generalize better; SGD is biased toward finding them.
- Implicit regularization of SGD (minimum norm, noise-induced) partially explains generalization.
- Double descent shows that more parameters can improve generalization beyond the interpolation threshold.
Exercises
Exercise 1. Compute the VC dimension of the class of linear classifiers in and verify it equals .
Exercise 2. For a prior and posterior , compute .
Exercise 3. Show that adding Gaussian noise to weights is equivalent to L2 regularization in expectation (for quadratic loss).
Exercise 4. For a linear model interpolating points in dimensions, derive the minimum-norm solution and show it generalizes better than a random interpolant.
Exercise 5. Explain why the "edge of stability" phenomenon (loss oscillating but not diverging with large learning rate) constitutes implicit regularization of the Hessian's top eigenvalue.