Dive into Deep Learning · §36.10
Generalization Bounds, Symmetrization, and Rademacher Complexity
uniform convergence · union bound · ghost-sample symmetrization · Rademacher complexity · margin bounds · double descent & benign overfitting
Motivation & Selection Bias
Empirical Verification
Repeating the 1{,}000-coin experiment 2{,}000 times shows that the single-coin 95\% confidence band fails almost every time (96\%\text{--}97\%) when applied to the post-hoc winner:
best of 1000 coins: median 0.66, 90% of experiments in [0.64, 0.69]
95% half-width: one coin 0.136, all 1000 coins 0.230
experiments in which the best coin leaves the one-coin band: 97%
The Supremum Over a Function Class
\bigl\lvert\hat{R}_S(\hat{f}) - R(\hat{f})\bigr\rvert \le \sup_{f \in \mathcal{F}} \bigl\lvert\hat{R}_S(f) - R(f)\bigr\rvert
Logarithmic Cost of Search
\sup_{f \in \mathcal{F}} \bigl\lvert\hat{R}_S(f) - R(f)\bigr\rvert \le \sqrt{\frac{\log(2\lvert\mathcal{F}\rvert/\delta)}{2n}}
Non-Adaptive vs. Adaptive Queries
Measuring Infinite Function Classes
\widehat{\mathfrak{R}}_S(\mathcal{F}) = \mathbb{E}_{\boldsymbol{\varepsilon}}\Biggl[\sup_{f \in \mathcal{F}} \frac{1}{n}\sum_{i=1}^n \varepsilon_i\,f(\mathbf{x}_i)\Biggr]
From Singletons to Shattering Classes
Rademacher complexity scales smoothly from zero for a fixed function up to 1 for a class that memorizes arbitrary sign patterns on S = (\mathbf{x}_1, \dots, \mathbf{x}_n):
| Function Class \mathcal{F} | Empirical Rademacher Complexity \widehat{\mathfrak{R}}_S(\mathcal{F}) | Scaling with Sample Size n |
|---|---|---|
| Singleton class \{f\} | \mathbb{E}_{\boldsymbol{\varepsilon}}\bigl[\frac{1}{n}\sum_i \varepsilon_i f(\mathbf{x}_i)\bigr] = 0 | Identically 0 (no selection) |
| Two constants \{+1, -1\} | \mathbb{E}_{\boldsymbol{\varepsilon}}\bigl[\lvert\bar{\varepsilon}\rvert\bigr] \approx \sqrt{\frac{2}{\pi n}} | Shrinks at rate O(n^{-1/2}) |
| Finite class in [-1, 1] | \le \sqrt{\frac{2\log\lvert\mathcal{F}\rvert}{n}} (Massart’s lemma) | Logarithmic in \lvert\mathcal{F}\rvert, O(\sqrt{\log\lvert\mathcal{F}\rvert / n}) |
| VC binary class in \{-1, +1\} | \le C\sqrt{\frac{d_{\mathrm{VC}}\log n}{n}} | Controlled by VC dimension d_{\mathrm{VC}} |
| All functions into [0, 1] | \mathbb{E}_{\boldsymbol{\varepsilon}}\bigl[\frac{1}{n}\sum_i \mathbf{1}\{\varepsilon_i = +1\}\bigr] = \frac{1}{2} | Constant \frac{1}{2} (no generalization) |
| All functions into [-1, 1] | \mathbb{E}_{\boldsymbol{\varepsilon}}\bigl[\frac{1}{n}\sum_i \varepsilon_i^2\bigr] = 1 (on distinct \mathbf{x}_i) | Constant 1 (complete memorization) |
Generalization Bound for Infinite Classes
To bound generalization risk, we apply Rademacher complexity to the [0, 1]-valued loss class \mathcal{G} = \{z = (\mathbf{x}, y) \mapsto \ell(f(\mathbf{x}), y) : f \in \mathcal{F}\}. With probability at least 1 - \delta over an i.i.d. sample S of size n, simultaneously for every g \in \mathcal{G}:
R(g) \le \hat{R}_S(g) + 2\,\mathfrak{R}_n(\mathcal{G}) + \sqrt{\frac{\log(1/\delta)}{2n}}
The Three-Step Symmetrization Argument
\mathbb{E}_S\Bigl[\sup_{g \in \mathcal{G}}\bigl(R(g) - \hat{R}_S(g)\bigr)\Bigr] \le 2\,\mathfrak{R}_n(\mathcal{G})
Norm-Bounded Linear Predictors
Proving R_S(F) <= B r / sqrt(n)
Bounding the expected Euclidean norm of \mathbf{s} = \sum_{i=1}^n \varepsilon_i \mathbf{x}_i by its root-mean-square norm via Jensen’s inequality (\mathbb{E}\|\mathbf{s}\|_2 \le \sqrt{\mathbb{E}\|\mathbf{s}\|_2^2}) yields a closed-form upper bound:
\mathbb{E}_{\boldsymbol{\varepsilon}}\Biggl[\Biggl\|\sum_{i=1}^n \varepsilon_i \mathbf{x}_i\Biggr\|_2\Biggr] \le \sqrt{\sum_{i=1}^n \sum_{j=1}^n \mathbb{E}[\varepsilon_i \varepsilon_j]\,\langle\mathbf{x}_i, \mathbf{x}_j\rangle} = \sqrt{\sum_{i=1}^n \|\mathbf{x}_i\|_2^2} \le r\sqrt{n} \implies \widehat{\mathfrak{R}}_S(\mathcal{F}) \le \frac{Br}{\sqrt{n}}
From Real-Valued Scores to Classification Risk
P\bigl(y\langle\mathbf{w}, \mathbf{x}\rangle \le 0\bigr) \le \hat{R}_\gamma(\mathbf{w}) + \frac{2Br}{\gamma\sqrt{n}} + \sqrt{\frac{\log(1/\delta)}{2n}}
Empirical Rademacher Complexity in Code
Averaging the exact supremum \frac{B}{n}\bigl\|\sum_{i=1}^n \varepsilon_i \mathbf{x}_i\bigr\|_2 over 2{,}000 random sign vectors for n = 50 unit vectors (B = r = 1) across dimensions d \in \{2, 20, 1000\} confirms our theory:
d = 2: Monte-Carlo R_S = 0.123, bound B r / sqrt(n) = 0.141
d = 20: Monte-Carlo R_S = 0.141, bound B r / sqrt(n) = 0.141
d = 1000: Monte-Carlo R_S = 0.141, bound B r / sqrt(n) = 0.141
The Interpolation Boundary
What happens when a model family is overparameterized (p = 2n = 100 standard Gaussian features on n = 50 points) and can interpolate every random sign vector \boldsymbol{\varepsilon} \in \{\pm 1\}^n via \mathbf{w} = \boldsymbol{\Phi}^+\boldsymbol{\varepsilon}?
mean ||w|| = 0.99 (predicted 1.01), largest 1.31
typical fit: mean ||w|| * mean row norm / sqrt(n) = 1.40
r = 12.4, B r / sqrt(n) with B = largest ||w||: 2.3
Analytical Mechanism of Double Descent
\mathbf{w} = \boldsymbol{\Phi}^+\mathbf{y} = \sum_{i=1}^{\min(n,p)} \frac{\langle\mathbf{u}_i, \mathbf{y}\rangle}{\sigma_i}\,\mathbf{v}_i
The Three Regimes in Code
Singular Values, Norms, and Baselines
Inspecting all nine diagnostics across p \in \{15, 38, 40, 42, 50, 80, 400\} reveals three essential nuances:
p test train norm s_min capacity clean noise ratio_q ratio
15 0.65 0.28 1.9 1 1.3 0.67 0.0066 3.7 1.8
38 3.3 0.0081 5.5 0.08 6 2.9 0.31 6.8e+02 32
40 71 2.3e-28 29 0.016 34 58 4.2 1.5e+04 4.2e+02
42 3.4 1.3e-29 6 0.076 6.5 2.9 0.26 5.8e+02 26
50 0.74 6.6e-30 2.7 0.25 3.1 0.64 0.063 62 6.3
80 0.22 7e-30 1.3 0.71 1.8 0.19 0.021 10 2.1
400 0.049 5.3e-30 0.4 2.6 1.3 0.04 0.0095 2.3 0.95
least squares on the 15 raw inputs: test MSE 0.0066
clean error exceeds the noise error because a linear teacher is poorly approximated by 40 ReLU ridges along \mathbf{u}_n.Clean Error vs. Noise Error
\mathbb{E}_{\boldsymbol{\xi}}\bigl[\mathrm{MSE}_{\mathrm{test}}\bigr] = \frac{1}{n_{\mathrm{te}}}\bigl\|\boldsymbol{\Phi}_{\mathrm{te}}\boldsymbol{\Phi}^+\mathbf{y}_0 - \mathbf{y}_{\mathrm{te}}\bigr\|_2^2 + \frac{\sigma_\xi^2}{n}\sum_{i=1}^n \frac{\|\boldsymbol{\Phi}_{\mathrm{te}}\mathbf{v}_i\|_2^2 / n_{\mathrm{te}}}{\|\boldsymbol{\Phi}\mathbf{v}_i\|_2^2 / n}
Test-to-Train Feature Energy Ratios
What Theory Certifies and What Remains Open
How do we reconcile our Rademacher margin bound \frac{Br}{\gamma\sqrt{n}} with the empirical double-descent sweep?
Single Model, Finite Pool, Linear Margin, Interpolating Regime
| Setting | Complexity Measure | Generalization Gap Bound / Scaling | Key Requirement or Limitation |
|---|---|---|---|
| Single Fixed Model \{f\} | \mathfrak{R}_n = 0 | \sqrt{\frac{\log(2/\delta)}{2n}} | f must be fixed before drawing test set S |
| Finite Candidate Pool \mathcal{F} | \log\lvert\mathcal{F}\rvert | \sqrt{\frac{\log(2\lvert\mathcal{F}\rvert/\delta)}{2n}} | Pool \mathcal{F} must be non-adaptive (no leaderboard feedback) |
| General Infinite Class \mathcal{G} | 2\,\mathfrak{R}_n(\mathcal{G}) | 2\,\mathfrak{R}_n(\mathcal{G}) + \sqrt{\frac{\log(1/\delta)}{2n}} | Requires losses bounded in [0, 1] and i.i.d. data |
| Linear Margin Classifier | \frac{Br}{\gamma\sqrt{n}} | \hat{R}_\gamma(\mathbf{w}) + \frac{2Br}{\gamma\sqrt{n}} + \sqrt{\frac{\log(1/\delta)}{2n}} | Dimension-free; vacuous once Br/\gamma \gtrsim \sqrt{n} |
| Two-Layer ReLU Network | \frac{2B_1 B_2 r}{\sqrt{n}} | Controlled by \ell_1 \times \ell_2 path norms | Width-independent, but trained norms often exceed \sqrt{n} |
| Minimum-Norm Interpolant | \sigma_{\min}(\boldsymbol{\Phi}) & effective ranks | Noise error \frac{\sigma_\xi^2}{n}\sum_i \frac{\|\boldsymbol{\Phi}_{\mathrm{te}}\mathbf{v}_i\|^2/n_{\mathrm{te}}}{\|\boldsymbol{\Phi}\mathbf{v}_i\|^2/n} | Algorithm-dependent; spikes at p = n, benign for p \gg n |
Check Your Understanding
Answers:
Key Takeaways
| Concept | Mathematical Form | Statistical & Deep Learning Role |
|---|---|---|
| Uniform Convergence | \sup_{f \in \mathcal{F}} \lvert\hat{R}_S(f) - R(f)\rvert \le t | Protects data-dependent model selection \hat{f} = \operatorname{argmin}_f \hat{R}_S(f) |
| Finite-Class Union Bound | \lvert\hat{R}_S(f) - R(f)\rvert \le \sqrt{\frac{\log(2\lvert\mathcal{F}\rvert/\delta)}{2n}} | Searching \lvert\mathcal{F}\rvert fixed models costs only \log\lvert\mathcal{F}\rvert thanks to exponential tails |
| Rademacher Complexity | \widehat{\mathfrak{R}}_S(\mathcal{F}) = \mathbb{E}_{\boldsymbol{\varepsilon}}\bigl[\sup_{f \in \mathcal{F}} \frac{1}{n}\sum_i \varepsilon_i f(\mathbf{x}_i)\bigr] | Ghost-sample symmetrization reduces generalization gap to fitting random signs |
| Linear & Margin Bounds | \widehat{\mathfrak{R}}_S(\mathcal{F}) \le \frac{Br}{\sqrt{n}}; R_{0\text{--}1} \le \hat{R}_\gamma + \frac{2Br}{\gamma\sqrt{n}} + \sqrt{\frac{\log(1/\delta)}{2n}} | Capacity depends on norm product Br/\gamma, not dimension d |
| SVD Interpolation Peak | \mathbf{w} = \boldsymbol{\Phi}^+\mathbf{y} = \sum_{i=1}^q \frac{\langle\mathbf{u}_i, \mathbf{y}\rangle}{\sigma_i}\mathbf{v}_i | Collapse of \sigma_{\min} at p = n explodes \|\mathbf{w}\|_2 and test error |
| Benign Overfitting | \text{Noise MSE} = \frac{\sigma_\xi^2}{n}\sum_{i=1}^n \frac{\|\boldsymbol{\Phi}_{\mathrm{te}}\mathbf{v}_i\|^2/n_{\mathrm{te}}}{\|\boldsymbol{\Phi}\mathbf{v}_i\|^2/n} | For p \gg n, noise is absorbed in low-energy directions where test features are also small |