Sam Babichenko

Reading notes / Generalization bounds

Limits of uniform convergence

Nagarajan and Kolter, 2019

Context. After Zhang et al., the program was to apply uniform convergence only to the networks SGD actually reaches, measured by norms of the learned weights, margins or PAC-Bayes posteriors. These bounds were known to be numerically large; this paper finds that on MNIST they can even grow with the sample size while the test error falls, and asks whether the tool itself is at fault. It constructs settings where gradient descent provably reaches test error at most ϵ\epsilon while every two-sided uniform convergence bound, even one over only the hypotheses the algorithm outputs on typical samples, is at least 1−ϵ1-\epsilon. An overparameterized learner can output a function that is simple on typical inputs plus a component that memorizes its training set. That component has almost no effect on fresh data but makes each learned hypothesis fail completely on a "mirror" sample that is itself a typical draw, and uniform convergence, which needs one set of typical samples common to all hypotheses, cannot exclude the mirrors. The linear example is the regime of benign overfitting with one strong signal direction plus many weak, equal-variance noise directions: its one-step classifier is essentially the minimum-norm interpolant there, so the mechanism that makes interpolation benign is the one that defeats uniform convergence.

Setting. Binary labels, a real-valued hypothesis hh, and the ramp loss L(γ)(y′,y)L^{(\gamma)}(y',y) (1 if yy′≤0yy'\le0, 1−yy′/γ1-yy'/\gamma on (0,γ)(0,\gamma), 0 if yy′≥γyy'\ge\gamma), with test and training averages LDL_{\mathcal D} and L^S\hat L_S. The generalization error ϵgen(m,δ)\epsilon_{\mathrm{gen}}(m,\delta) is the smallest value with Pr⁡S∼Dm[LD(hS)−L^S(hS)≤ϵgen]≥1−δ\Pr_{S\sim\mathcal D^m}[L_{\mathcal D}(h_S)-\hat L_S(h_S)\le\epsilon_{\mathrm{gen}}]\ge1-\delta. The tightest algorithm-dependent uniform convergence bound ϵunif-alg(m,δ)\epsilon_{\mathrm{unif\text{-}alg}}(m,\delta) keeps a set of samples Sδ\mathcal S_\delta with Pr⁡[S∈Sδ]≥1−δ\Pr[S\in\mathcal S_\delta]\ge1-\delta, restricts the class to the algorithm's outputs on it, and is the smallest value for which some such set satisfies sup⁡S∈Sδ sup⁡h∈Hδ∣LD(h)−L^S(h)∣≤ϵunif-alg,Hδ={hS′:S′∈Sδ}.\sup_{S\in\mathcal S_\delta}\ \sup_{h\in\mathcal H_\delta}\big|L_{\mathcal D}(h)-\hat L_S(h)\big|\le\epsilon_{\mathrm{unif\text{-}alg}},\qquad\mathcal H_\delta=\{h_{S'}:S'\in\mathcal S_\delta\}. Any VC, Rademacher or covering bound on a class containing the algorithm's outputs upper bounds it. The linear example: x=(x1,x2)∈RK×RDx=(x_1,x_2)\in\mathbb R^K\times\mathbb R^D, yy uniform on {±1}\{\pm1\}, x1=2yux_1=2yu for a fixed uu with ∥u∥=1/m\|u\|=1/\sqrt m, and x2∼N(0,32DID)x_2\sim N(0,\frac{32}DI_D) independent of yy. Starting from w=0w=0, one gradient step of size 1 on ∑iyih(xi)\sum_iy_ih(x_i) with h(x)=w⊤xh(x)=w^\top x gives, for any batch size, w1=2mu,w2=∑i=1myix2,i.w_1=2mu,\qquad w_2=\sum_{i=1}^my_ix_{2,i}.

Theorem 3.1 (uniform convergence fails for the linear classifier). For any ϵ>0\epsilon\gt0, δ≤1/4\delta\le1/4 and γ∈[0,1]\gamma\in[0,1], if D=Ω(max⁡{mln⁡mδ, mln⁡1ϵ})D=\Omega\big(\max\{m\ln\frac m\delta,\ m\ln\frac1\epsilon\}\big), then for the loss L(γ)L^{(\gamma)}, ϵgen(m,δ)≤ϵ\epsilon_{\mathrm{gen}}(m,\delta)\le\epsilon while ϵunif-alg(m,δ)≥1−ϵ\epsilon_{\mathrm{unif\text{-}alg}}(m,\delta)\ge1-\epsilon. For every γ≥0\gamma\ge0, ϵunif-alg(m,δ)≥1−ϵgen(m,δ)\epsilon_{\mathrm{unif\text{-}alg}}(m,\delta)\ge1-\epsilon_{\mathrm{gen}}(m,\delta), and the appendix shows that the usual route LD(0)≤L^S(γ)+ϵunif-algL^{(0)}_{\mathcal D}\le\hat L^{(\gamma)}_S+\epsilon_{\mathrm{unif\text{-}alg}} then cannot certify anything below 1/21/2, whatever γ\gamma. The same lower bound holds for a hypothesis-specific bound on hSh_S alone, as long as it must hold for all samples in Sδ\mathcal S_\delta.

Other results. (1) An infinite-width network with frozen N(0,I)N(0,I) hidden weights, exponential activations and one trained output layer gives the same conclusion, with a proof, when DD grows only like ln⁡m\ln m. (2) A wide two-layer ReLU network trained by SGD on two concentric spheres in R1000\mathbb R^{1000} (radii 1 and 1.1) misclassifies, at every mm tested, the whole sample obtained by projecting each training point onto the other sphere and flipping its label, while its test error falls like m−0.5m^{-0.5}; this part is empirical. (3) Two standard derandomized PAC-Bayes bounds are lower bounded through ϵunif-alg\epsilon_{\mathrm{unif\text{-}alg}}, in the linear example by e−3/2(1−ϵ)−(1−e−3/2)ϵ≈0.22e^{-3/2}(1-\epsilon)-(1-e^{-3/2})\epsilon\approx0.22 and 1−e3/2ϵ1-e^{3/2}\epsilon.

Step 1

On MNIST the norms in the bounds, and so the bounds, grow with the sample size. A depth-5, width-1024 ReLU network is trained by SGD until 99% of the training points have margin at least 10, which fixes the margin term. From m=128m=128 to 32,768 the test error falls like m−0.43m^{-0.43}, while the distance from initialization grows at least like m0.4m^{0.4}, the product of spectral norms grows polynomially, and so does the distance between the weights learned from two independent samples with the same initialization. That last distance lower bounds the diameter of the region SGD explores, so recentering the bounds at a better point than the initialization would not help. The spectrally normalized bounds of Neyshabur et al. and Bartlett et al. grow like m0.68m^{0.68} and are far above 1 throughout, and still like m0.48m^{0.48} with γ\gamma the median margin. With squared loss, which stops at a finite distance, the norms still grow, so cross-entropy pushing the weights to infinity is not the cause; other widths and larger batches help only partly, and pseudo-overfitting (bumps at the training points that inflate margins) is not the main cause, since mean train and test margins converge. The paper blames the uniform convergence step itself.

Step 2

If each learned hypothesis has a typical mirror sample on which it always errs, no uniform bound can be small. Uniform convergence may discard a set of samples of mass δ\delta, but it must be the same set for every hypothesis. Suppose the algorithm generalizes, yet each hSh_S errs everywhere on a bad sample S′=ϕ(S)S'=\phi(S), where ϕ\phi maps Dm\mathcal D^m to itself. Since ϕ(S)\phi(S) has the law of SS, Pr⁡[ϕ(S)∉Sδ]≤δ\Pr[\phi(S)\notin\mathcal S_\delta]\le\delta, and a union bound shows that for any Sδ\mathcal S_\delta the four good events occur together with positive probability: Pr⁡S[S∈Sδ, ϕ(S)∈Sδ, LD(hS)≤ϵ, L^ϕ(S)(hS)=1]≥1−3δ−Pr⁡[L^ϕ(S)(hS)≠1]>0.\Pr_S\big[S\in\mathcal S_\delta,\ \phi(S)\in\mathcal S_\delta,\ L_{\mathcal D}(h_S)\le\epsilon,\ \hat L_{\phi(S)}(h_S)=1\big]\ge1-3\delta-\Pr\big[\hat L_{\phi(S)}(h_S)\ne1\big]\gt0. Any S⋆S_\star in this event puts hS⋆∈Hδh_{S_\star}\in\mathcal H_\delta and ϕ(S⋆)∈Sδ\phi(S_\star)\in\mathcal S_\delta, so the supremum in the definition is at least 1−ϵ1-\epsilon. The rest of the paper realizes ϕ\phi with gradient descent.

Step 3

The linear classifier generalizes because its memorizing part has almost no effect on fresh points. On a training point the output is yih(xi)=4+∥x2,i∥2+yi x2,i⊤∑j≠iyjx2,j≈4+32±O(32m/D),y_ih(x_i)=4+\|x_{2,i}\|^2+y_i\,x_{2,i}^\top\sum_{j\ne i}y_jx_{2,j}\approx4+32\pm O\big(32\sqrt{m/D}\big), by a chi-square tail bound and Hoeffding, so training margins are large and almost all of each comes from w2w_2 memorizing the sample. On a fresh xx, x2x_2 is independent of w2w_2, so yh(x)=4+x2⊤w2yh(x)=4+x_2^\top w_2 with x2⊤w2∼N(0,1024 m/D)x_2^\top w_2\sim N(0,1024\,m/D) given the sample, and the error is about Pr⁡[N(0,1)>D/m/8]\Pr[N(0,1)\gt\sqrt{D/m}/8], at most ϵ\epsilon once D≳mln⁡(1/ϵ)D\gtrsim m\ln(1/\epsilon). So D≫mD\gg m is what keeps the memorization from affecting test points: the mm noise vectors are nearly orthogonal (Gram matrix close to 32Im32I_m), and w2w_2 fits each label through its own direction without pointing where a test point is likely to be. It also makes ww essentially the minimum-norm interpolant, X⊤(XX⊤)−1y≈X⊤y/36X^\top(XX^\top)^{-1}y\approx X^\top y/36; in my simulation (K=5K=5, m=100m=100, D=20,000D=20{,}000) the cosine between the two is 0.997, both have about 4% test error, and both misclassify all of the bad sample of Step 4.

Step 4

Negating the noise gives a typical sample on which hSh_S is always wrong. Let S′={((x1,−x2),y):((x1,x2),y)∈S}S'=\{((x_1,-x_2),y):((x_1,x_2),y)\in S\}. The same expansion with the sign of x2x_2 flipped gives yih(x1,−x2,i)=4−∥x2,i∥2−yi x2,i⊤∑j≠iyjx2,j≈4−32<0,y_ih(x_1,-x_{2,i})=4-\|x_{2,i}\|^2-y_i\,x_{2,i}^\top\sum_{j\ne i}y_jx_{2,j}\approx4-32\lt0, so with high probability hSh_S misclassifies every point of S′S' and L^S′(hS)=1\hat L_{S'}(h_S)=1 for every γ≥0\gamma\ge0. Since x2x_2 is a centered Gaussian independent of (x1,y)(x_1,y), negation preserves D\mathcal D, and S′∼DmS'\sim\mathcal D^m. Step 2 then gives ϵunif-alg≥1−ϵ\epsilon_{\mathrm{unif\text{-}alg}}\ge1-\epsilon whenever δ≤1/4\delta\le1/4, and no better-chosen class avoids this, even one that fixes w1w_1 at its learned value and truncates w2w_2 to any set of mass 1−δ1-\delta.

Step 5

The argument uses two-sidedness, and the extensions follow from it. At the pair (hS⋆,S⋆′)(h_{S_\star},S_\star') the empirical error exceeds the test error, which a hypothetical one-sided bound on LD−L^SL_{\mathcal D}-\hat L_S allows; existing techniques bound the absolute deviation, and the paper notes it is not known how to make them one-sided. A hypothesis-dependent bound fails too, since the bound for hS~h_{\tilde S} must hold on every S∈SδS\in\mathcal S_\delta, including S~′\tilde S'. The PAC-Bayes KL form kl(L^S(Q) ∥ LD(Q))≤(KL(Q∥P)+ln⁡2mδ)/(m−1)\mathrm{kl}(\hat L_S(Q)\,\|\,L_{\mathcal D}(Q))\le(\mathrm{KL}(Q\|P)+\ln\frac{2m}\delta)/(m-1) is itself two-sided, so derandomizing it, by adding perturbation terms or by sandwiching the margin loss of a perturbed QhQ_h between losses of hh, gives a deterministic bound lower bounded through ϵunif-alg\epsilon_{\mathrm{unif\text{-}alg}}, with the constants of item (3). Bounds on a stochastic network concern a different classifier and are not covered.

Step 6

The same failure appears in networks. For the exponential network, one gradient step on the output layer gives a kernel machine in which each training point adds a term yiexp⁡(∥(z+xi)/2∥2)y_i\exp(\|(z+x_i)/2\|^2), playing the role of w2w_2; the bad sample negates every coordinate except the noise, ((−x1,x2),−y)((-x_1,x_2),-y), and Steps 3 and 4 go through with DD only of order ln⁡m\ln m. For the ReLU network on spheres there is no formula: the bad sample has law Dm\mathcal D^m by rotation invariance and is measured to be misclassified entirely, so Step 2 applies. Two-dimensional slices show the boundary bent around each training point so that its projection falls on the wrong side. The claim depends on the setup: it needs enough width or input dimension relative to mm, and with outer radius 2 SGD separates the spheres cleanly and S′S' is classified correctly.

Consequences and limits. The paper conjectures that SGD on a wide network learns w=w1+w2w=w_1+w_2 in some feature space, where w1w_1 gives a simple boundary a uniform bound could certify and w2w_2 is sample-specific noise, negligible on test points; bounds that succeed on compressed, stochastic or further optimized networks may work by suppressing w2w_2. Restricting the class to what the algorithm's implicit bias allows is then not enough, because the bias itself includes memorization. The paper points to algorithmic stability and new tools instead, and the benign-overfitting analyses, which compute one estimator's risk directly, are a route of that kind. Limits: the result concerns two-sided bounds and leaves open one-sided ones and runs with explicit regularization; in the linear example the generalization error grows with mm (it is of order e−D/me^{-D/m}), which the appendix addresses, in a sketch; the learner is a single gradient step; and the ReLU evidence is a measurement in one tuned setup. For norm-based bounds the MNIST result means that a bound that grows with mm while the error falls does not track generalization.

Terms

ϵgen(m,δ)\epsilon_{\mathrm{gen}}(m,\delta)
high-probability gap between test and training loss of the learned hSh_S
ϵunif-alg(m,δ)\epsilon_{\mathrm{unif\text{-}alg}}(m,\delta)
smallest uniform bound over the algorithm's own outputs on one set Sδ\mathcal S_\delta of mass 1−δ1-\delta
L(γ)L^{(\gamma)}
ramp loss: 1 below margin 0, linear to 0 at margin γ\gamma
x1=2yu, ∥u∥=1/mx_1=2yu,\ \|u\|=1/\sqrt m
the signal coordinates; the only part of the input correlated with the label
x2∼N(0,32DID)x_2\sim N(0,\frac{32}DI_D)
isotropic noise coordinates, D≫mD\gg m; ∥x2∥2≈32\|x_2\|^2\approx32
w1=2mu, w2=∑iyix2,iw_1=2mu,\ w_2=\sum_iy_ix_{2,i}
one-step classifier; w2w_2 memorizes the sample
S′S'
bad sample: noise negated (linear), or projected to the other sphere with flipped label (ReLU)
Two-sided bound
controls ∣LD(h)−L^S(h)∣|L_{\mathcal D}(h)-\hat L_S(h)|; the argument needs the side L^S>LD\hat L_S\gt L_{\mathcal D}
Pseudo-overfitting
output bumps at training points that inflate train margins; ruled out on MNIST
Distance between solutions
∥wS−wS~∥\|w_S-w_{\tilde S}\| for two samples, same initialization; grows like m0.4m^{0.4}
w=w1+w2w=w_1+w_2 conjecture
simple part plus sample-specific part that is small on test points

Quiz

  1. In the proof, why can the bad sample S′S' not be placed in the excluded set of mass δ\delta?
  2. Why does a hypothesis-dependent bound, one that may depend on the learned weights, still fail in the linear example?
  3. Why does the linear example connect to benign overfitting in the min-norm sense?

Sources