Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture Notes

Empirical Risk Minimization: Generalization, Rademacher Complexity, and Two-Layer Networks

ICTP Summer School on Machine Learning — Lecture 4 (Day 6, Morning)

These notes cover the first lecture of Day 6 by Andrea Montanari. The topic is the classical statistical learning theory framework: empirical risk minimization (ERM), the decomposition of risk into approximation and generalization error, and Rademacher complexity as the tool for controlling the generalization gap. The lecture culminates in a sharp bound on the Rademacher complexity of two-layer neural networks (Bartlett 1996), and an abstract detour into Banach-space approximation theory that leads to the Barron norm and explains why shallow networks can efficiently approximate a broad function class.

Supervised Learning Setup

We observe nn i.i.d. pairs (xi,yi)P(x_i, y_i) \sim \mathbb{P}, where

xiRd(feature vector),yiR(label or response).x_i \in \mathbb{R}^d \quad \text{(feature vector)}, \qquad y_i \in \mathbb{R} \quad \text{(label or response)}.

A model is a function f:RdRf : \mathbb{R}^d \to \mathbb{R}. Given a new test pair (xn+1,yn+1)(x_{n+1}, y_{n+1}) drawn from the same distribution, we want f(xn+1)yn+1f(x_{n+1}) \approx y_{n+1}.

Loss, Risk, and Empirical Risk

Fix a loss function :R×RR0\ell : \mathbb{R} \times \mathbb{R} \to \mathbb{R}_{\geq 0}, mapping (y,y^)(y,y^)(y, \hat{y}) \mapsto \ell(y, \hat{y}). The canonical example is the square loss (y,y^)=(yy^)2\ell(y, \hat{y}) = (y - \hat{y})^2.

The population risk (or test loss) of ff is

R(f)=E(y,f(x)),R(f) = \mathbb{E}\,\ell(y, f(x)),

where the expectation is over (x,y)P(x,y) \sim \mathbb{P}. Since P\mathbb{P} is unknown, we cannot minimize R(f)R(f) directly. We instead minimize the empirical risk

R^n(f)=E^n(y,f(x))=1ni=1n(yi,f(xi)).\hat{R}_n(f) = \hat{\mathbb{E}}_n\,\ell(y, f(x)) = \frac{1}{n}\sum_{i=1}^n \ell(y_i, f(x_i)).

By the law of large numbers, R^n(f)R(f)\hat{R}_n(f) \to R(f) almost surely for any fixed ff.

This third point is the fundamental tension of learning: by interpolating the training data one can drive R^n(f)\hat{R}_n(f) to zero, yet such a function generalizes arbitrarily poorly. Minimizing R^n\hat{R}_n over all measurable functions does not minimize RR.

The Approximation–Generalization Decomposition

Let F\mathcal{F} be a hypothesis class (e.g. neural networks of a given architecture). Define

f^n=arg minfFR^n(f),f=arg minfFR(f),fF=arg minfFR^n(f).\hat{f}_n = \operatorname*{arg\,min}_{f \in \mathcal{F}} \hat{R}_n(f), \qquad f_* = \operatorname*{arg\,min}_{f \in \mathcal{F}} R(f), \qquad f_{\mathcal{F}\infty} = \operatorname*{arg\,min}_{f \in \mathcal{F}} \hat{R}_n(f).

(Here ff_* minimizes the true risk within F\mathcal{F}, while f^n\hat{f}_n minimizes the empirical risk; they differ because R^n\hat{R}_n is a random function of the data.) We decompose the excess risk:

R(f^n)R(f)=[R(f^n)R^n(f^n)](I)+[R^n(f^n)R^n(f)](II)0+[R^n(f)R(f)](III).R(\hat{f}_n) - R(f_*) = \underbrace{\bigl[R(\hat{f}_n) - \hat{R}_n(\hat{f}_n)\bigr]}_{\text{(I)}} + \underbrace{\bigl[\hat{R}_n(\hat{f}_n) - \hat{R}_n(f_*)\bigr]}_{\text{(II)} \leq 0} + \underbrace{\bigl[\hat{R}_n(f_*) - R(f_*)\bigr]}_{\text{(III)}}.

Term (II) is 0\leq 0 because f^n\hat{f}_n minimizes R^n\hat{R}_n over F\mathcal{F}, so it does no worse than ff_*. Terms (I) and (III) are both instances of the fluctuation R^n(f)R(f)|\hat{R}_n(f) - R(f)| at a particular ff. Bounding them uniformly over F\mathcal{F} gives

R(f^n)R(f)supfFR(f)R^n(f)generalization error+O ⁣(1n)fluctuations.R(\hat{f}_n) - R(f_*) \lesssim \underbrace{\sup_{f \in \mathcal{F}} |R(f) - \hat{R}_n(f)|}_{\text{generalization error}} + \underbrace{\mathcal{O}\!\left(\tfrac{1}{\sqrt{n}}\right)}_{\text{fluctuations}}.

If ff_* is not in F\mathcal{F}, there is an additional approximation error term

inffFR(f)inffR(f)0,\inf_{f \in \mathcal{F}} R(f) - \inf_f R(f) \geq 0,

representing the best-in-class deficit. The full bound therefore reads

R(f^n)inffFR(f)best in class+supfFR(f)R^n(f)generalization gap+O ⁣(1n).\boxed{R(\hat{f}_n) \leq \underbrace{\inf_{f \in \mathcal{F}} R(f)}_{\text{best in class}} + \underbrace{\sup_{f \in \mathcal{F}} |R(f) - \hat{R}_n(f)|}_{\text{generalization gap}} + \mathcal{O}\!\left(\tfrac{1}{\sqrt{n}}\right).}

The picture below (from the lecture) shows the risk landscape: R(f)R(f) has a true minimizer ff^*, while R^n\hat{R}_n has a jagged empirical minimizer f^\hat{f} that may be far from ff^* if F\mathcal{F} is too rich.

Rademacher Complexity

The natural tool for bounding the generalization gap uniformly over F\mathcal{F} is the Rademacher complexity.

Definition

For a set ARnA \subseteq \mathbb{R}^n, define

Rdn(A):=EσsupaA1nσ,a,\mathrm{Rd}_n(A) := \mathbb{E}_\sigma \sup_{a \in A} \frac{1}{n} \langle \sigma, a \rangle,

where σ=(σ1,,σn)\sigma = (\sigma_1, \ldots, \sigma_n) are i.i.d. Uniform({+1,1})\mathrm{Uniform}(\{+1,-1\}) (Rademacher variables), independent of everything else. Geometrically, Rdn(A)\mathrm{Rd}_n(A) measures how well the set AA can be correlated with a random sign vector: it is large when AA contains vectors that “stick out” in every direction.

For a function class G={g:SR}G = \{g : S \to \mathbb{R}\} with data z1,,zniidPz_1, \ldots, z_n \overset{\text{iid}}{\sim} \mathbb{P}, define

Rdn(G):=EzEσsupgG1ni=1nσig(zi).\mathrm{Rd}_n(G) := \mathbb{E}_z\,\mathbb{E}_\sigma \sup_{g \in G} \frac{1}{n}\sum_{i=1}^n \sigma_i g(z_i).

The connection to the geometric definition is: fix z1,,znz_1, \ldots, z_n and let A={(g(z1),,g(zn)):gG}RnA = \{(g(z_1), \ldots, g(z_n)) : g \in G\} \subseteq \mathbb{R}^n (the “evaluation set”), e.g. the output vectors of a neural network class on the training points. Then Rdn(G)=Ez[Rdn(A)]\mathrm{Rd}_n(G) = \mathbb{E}_z[\mathrm{Rd}_n(A)].

Rademacher Complexity Controls Uniform Convergence

To apply this to learning, set zi=(yi,xi)z_i = (y_i, x_i), g(zi)=(yi,f(xi))g(z_i) = \ell(y_i, f(x_i)), and G=F:={(y,x)(y,f(x)):fF}G = \ell \circ \mathcal{F} := \{(y,x) \mapsto \ell(y,f(x)) : f \in \mathcal{F}\}. Then E^ng=R^n(f)\hat{\mathbb{E}}_n g = \hat{R}_n(f) and Eg=R(f)\mathbb{E} g = R(f), so the lemma gives

R(f^n)inffFR(f)+2Rdn(F)+O ⁣(1n).R(\hat{f}_n) \leq \inf_{f \in \mathcal{F}} R(f) + 2\,\mathrm{Rd}_n(\ell \circ \mathcal{F}) + \mathcal{O}\!\left(\tfrac{1}{\sqrt{n}}\right).

We want to compute Rdn(F)\mathrm{Rd}_n(\ell \circ \mathcal{F}); the contraction lemma reduces this to Rdn(F)\mathrm{Rd}_n(\mathcal{F}).

Contraction Inequality

Application. Assume \ell is LL-Lipschitz in its second argument. Using the triangle inequality to introduce the reference (yi,0)\ell(y_i, 0) (which handles the ϕi(0)=0\phi_i(0)=0 requirement):

Rdn(F)1nE[(y,0)2]1/2+LRdn(F).\mathrm{Rd}_n(\ell \circ \mathcal{F}) \leq \frac{1}{\sqrt{n}}\,\mathbb{E}\bigl[\ell(y,0)^2\bigr]^{1/2} + L\,\mathrm{Rd}_n(\mathcal{F}).

The first term is O(1/n)\mathcal{O}(1/\sqrt{n}) (for square-integrable yy). So the generalization gap is bounded by Rdn(F)\mathrm{Rd}_n(\mathcal{F}) up to O(1/n)\mathcal{O}(1/\sqrt{n}) corrections.

Rademacher Complexity of Two-Layer Neural Networks

We now compute Rdn(F)\mathrm{Rd}_n(\mathcal{F}) for a two-layer network class, following Bartlett (1996).

Setup

A two-layer network with mm hidden units and activation σ\sigma has the form

f(x;θ)=1mk=1makσ(wkx),θ={(ak,wk)}km.f(x; \theta) = \frac{1}{m}\sum_{k=1}^m a_k\,\sigma(w_k^\top x), \qquad \theta = \{(a_k, w_k)\}_{k \leq m}.

We constrain the parameters by

wkB2d(C)(wk2C),aB1m(r0m)(1mkakr0).w_k \in B_2^d(C) \quad (\|w_k\|_2 \leq C), \qquad a \in B_1^m(r_0 \cdot m) \quad \left(\frac{1}{m}\sum_k |a_k| \leq r_0\right).

Call this class Fm(C,r0)\mathcal{F}_m(C, r_0). The bound on aa in 1\ell^1 (rather than 2\ell^2) is the key structural choice; it limits the total variation of the output layer.

Computation of Rdn(Fm(C,r0))\mathrm{Rd}_n(\mathcal{F}_m(C, r_0))

Rdn(F)=Ex,σsupa,w1ni=1nσi1mk=1makσ(wkxi).\mathrm{Rd}_n(\mathcal{F}) = \mathbb{E}_{x,\sigma} \sup_{a, w} \left|\frac{1}{n}\sum_{i=1}^n \sigma_i \cdot \frac{1}{m}\sum_{k=1}^m a_k\,\sigma(w_k^\top x_i)\right|.

Interchanging the sums and bounding by 1\ell^1\ell^\infty duality:

1mkak(1niσiσ(wkxi))1ma1maxk1niσiσ(wkxi)r0maxk1niσiσ(wkxi).\frac{1}{m}\left|\sum_k a_k \left(\frac{1}{n}\sum_i \sigma_i\,\sigma(w_k^\top x_i)\right)\right| \leq \frac{1}{m}\|a\|_1 \cdot \max_k \left|\frac{1}{n}\sum_i \sigma_i\,\sigma(w_k^\top x_i)\right| \leq r_0 \max_k \left|\frac{1}{n}\sum_i \sigma_i\,\sigma(w_k^\top x_i)\right|.

Taking supremum over aa at cost r0r_0, and then supremum over all ww collapses the max over kk:

Rdn(F)r0Eσsupw:w2C1ni=1nσiσ(wxi).\mathrm{Rd}_n(\mathcal{F}) \leq r_0\,\mathbb{E}_\sigma \sup_{w:\|w\|_2 \leq C} \left|\frac{1}{n}\sum_{i=1}^n \sigma_i\,\sigma(w^\top x_i)\right|.

Applying the contraction inequality with the LL-Lipschitz activation σ\sigma (e.g. L=1L=1 for ReLU):

Lr0Eσsupw2C1ni=1nσiwxi=Lr0Eσsupw2Cw,1niσixi.\leq L r_0\,\mathbb{E}_\sigma \sup_{\|w\|_2 \leq C} \left|\frac{1}{n}\sum_{i=1}^n \sigma_i\,w^\top x_i\right| = L r_0\,\mathbb{E}_\sigma \sup_{\|w\|_2 \leq C} \left|\left\langle w,\, \frac{1}{n}\sum_i \sigma_i x_i \right\rangle\right|.

The sup over w2C\|w\|_2 \leq C of a linear form is CC times the 2\ell^2 norm of the argument:

=Lr0CEσ1niσixi2.= L r_0 C\,\mathbb{E}_\sigma \left\|\frac{1}{n}\sum_i \sigma_i x_i\right\|_2.

By Jensen’s inequality (concavity of the square root):

Lr0C(E1niσixi22)1/2=Lr0Cn(Ex22)1/2.\leq L r_0 C \left(\mathbb{E}\left\|\frac{1}{n}\sum_i \sigma_i x_i\right\|_2^2\right)^{1/2} = \frac{L r_0 C}{\sqrt{n}} \left(\mathbb{E}\|x\|_2^2\right)^{1/2}.

(The last step uses that σi\sigma_i are independent mean-zero, so cross-terms vanish.) Assuming Ex22Cd\mathbb{E}\|x\|_2^2 \leq C' d, we obtain the boxed result:

Rdn(Fm(C,r0))C~r0Cdn.\boxed{\mathrm{Rd}_n(\mathcal{F}_m(C, r_0)) \leq \tilde{C}\,r_0\,C\sqrt{\frac{d}{n}}.}

Crucially, this bound is independent of mm (the number of hidden units). Plugging back into the generalization bound:

R(f^n)inffFm(r0)R(f)+Cr0dn+Cn.R(\hat{f}_n) \leq \inf_{f \in \mathcal{F}_m(r_0)} R(f) + C\,r_0\sqrt{\frac{d}{n}} + \frac{C}{\sqrt{n}}.

This is the result of Bartlett (1996).

Abstract Detour: Banach-Space Approximation and Barron Spaces

The Rademacher bound above controls generalization given r0r_0 but leaves open: how large must mm be to make inffFm(r0)R(f)\inf_{f \in \mathcal{F}_m(r_0)} R(f) small? The following abstract framework, due to Maurey and Pisier, gives a clean answer.

Convex Hulls in Banach Spaces

Let (X,X)(X, \|\cdot\|_X) be a Banach space, GXG \subseteq X compact and centrosymmetric (gGgGg \in G \Rightarrow -g \in G). Define

conv(G)={i=1naigi:ai0,  iai=1,  giG,  nN}=FGF halfspaceF,\mathrm{conv}(G) = \left\{\sum_{i=1}^n a_i g_i : a_i \geq 0,\; \sum_i a_i = 1,\; g_i \in G,\; n \in \mathbb{N}\right\} = \bigcap_{\substack{F \supseteq G \\ F \text{ halfspace}}} F,

the closed convex hull of GG. Define also

BG=conv(G),B~G={x=Ggμ(dg):μ prob. measure on G}.B_G = \overline{\mathrm{conv}(G)}, \qquad \tilde{B}_G = \left\{x = \int_G g\,\mu(dg) : \mu \text{ prob. measure on } G\right\}.

The Atomic Norm

The atomic norm induced by GG is

xG=inf{λ>0:xBG(λ)}=inf{μ:x=gμ(dg),  μ not normalized},\|x\|_G = \inf\{\lambda > 0 : x \in B_G(\lambda)\} = \inf\{|\mu| : x = \int g\,\mu(dg),\; \mu \text{ not normalized}\},

where μ=μ(G)|\mu| = \mu(G) is the total mass.

Example 1. X=RnX = \mathbb{R}^n, G={±e1,,±en}G = \{\pm e_1, \ldots, \pm e_n\}. Then BG={x:x11}B_G = \{x : \|x\|_1 \leq 1\}, so xG=x1\|x\|_G = \|x\|_1 (the 1\ell^1 norm).

Example 2. X=SymnRn×nX = \mathrm{Sym}_n \subseteq \mathbb{R}^{n \times n}, G={±uu:u2=1}G = \{\pm uu^\top : \|u\|_2 = 1\}. Then BG={X:iλi(X)1}B_G = \{X : \sum_i |\lambda_i(X)| \leq 1\} (unit ball in the Schatten-1 / nuclear norm), so XG=X\|X\|_G = \|X\|_* (the nuclear norm).

Maurey–Pisier Approximation Theorem

The rate 1/m1/\sqrt{m} is the Monte Carlo rate: approximating an integral by a sample average.

Application: Barron Spaces and Two-Layer Networks

Set X=L2(Rd;P)X = L^2(\mathbb{R}^d; \mathbb{P}) (the Hilbert space of square-integrable functions under the data distribution), and let

G={±σ(w,):w21}=G+G.G = \{\pm\sigma(\langle w, \cdot\rangle) : \|w\|_2 \leq 1\} = G_+ \cup G_-.

The induced atomic norm is the Barron norm:

fσ=inf{ν:f()=G+σ(w,)ν+(dw)G+σ(w,)ν(dw)},\|f\|_\sigma = \inf\left\{|\nu| : f(\cdot) = \int_{G_+} \sigma(\langle w, \cdot\rangle)\,\nu_+(dw) - \int_{G_+} \sigma(\langle w, \cdot\rangle)\,\nu_-(dw)\right\},

where ν=ν+ν\nu = \nu_+ - \nu_- is a signed measure on G+={w:w21}G_+ = \{w : \|w\|_2 \leq 1\}. Equivalently,

fσ=inf{ν:f()=G+σ(w,)ν(dw),  ν signed measure on G+}.\|f\|_\sigma = \inf\left\{|\nu| : f(\cdot) = \int_{G_+} \sigma(\langle w, \cdot\rangle)\,\nu(dw),\; \nu \text{ signed measure on } G_+\right\}.

The class Fm(r0)\mathcal{F}_m(r_0) defined earlier corresponds to elements of BG(r0)B_G(r_0) (the ball of Barron norm r0\leq r_0) approximated by mm-neuron networks.

Combining with the Rademacher bound from the previous section, the total excess risk of the ERM estimator over Fm(r0)\mathcal{F}_m(r_0) satisfies

R(f^n)R(f)Cfσmapprox. error+fσCdngen. error.R(\hat{f}_n) - R(f_*) \lesssim \underbrace{\frac{C\|f_*\|_\sigma}{\sqrt{m}}}_{\text{approx. error}} + \underbrace{\|f_*\|_\sigma\cdot C\sqrt{\frac{d}{n}}}_{\text{gen. error}}.

Balancing these two terms by choosing mn/dm \asymp n/d gives R(f^n)R(f)=O(1/n/d)R(\hat{f}_n) - R(f_*) = \mathcal{O}(1/\sqrt{n/d}), a rate independent of the ambient dimension dd (up to the implicit dependence in fσ\|f_*\|_\sigma).

Physical interpretation. The Barron norm measures the “spectral complexity” of ff_* as a function of its Fourier/harmonic representation in the weight space. Functions that can be expressed as superpositions of neurons with bounded total variation in the weight space have small Barron norm. This is precisely the class for which shallow networks overcome the curse of dimensionality.

References
  1. Bartlett, P. L. (1996). For valid generalization the size of the weights is more important than the size of the network. Advances in Neural Information Processing Systems, 9.