Sam Babichenko

Reading notes / Generalization bounds

Spectrally normalized margin bounds

Bartlett et al., 2017

Context. Zhang et al. showed that standard networks fit random labels, so any bound that depends only on the architecture and the sample size is vacuous. Margin theory had shown, for two-layer sigmoid networks, that at a given margin the size of the weights matters more than their number. The open question was which norm-based quantity controls deep ReLU networks without factors that grow with depth, width or the number of classes, and whether it moves with the difficulty of the labels. At margin γ\gamma, a network's capacity is its Lipschitz constant, the product of the layers' spectral norms, times a correction for how far each layer is from a reference matrix in a norm whose balls have small covering numbers, all divided by γ\gamma. The division makes the measure invariant to rescaling (with zero reference matrices), and on Zhang's test it is larger for random labels than for true ones. The correction is bounded by an effective-rank-type ratio, ∥A⊤∥2,1/∥A∥σ≤width⋅r0(A⊤A)\|A^\top\|_{2,1}/\|A\|_\sigma\le\sqrt{\text{width}\cdot r_0(A^\top A)}, with r0r_0 the stable rank of the benign-overfitting papers.

Setting. A network with weights A=(A1,…,AL)A=(A_1,\dots,A_L) computes FA(x)=σL(ALσL−1(⋯σ1(A1x)⋯ ))∈RkF_A(x)=\sigma_L(A_L\sigma_{L-1}(\cdots\sigma_1(A_1x)\cdots))\in\mathbb R^k, where each fixed σi\sigma_i is ρi\rho_i-Lipschitz with σi(0)=0\sigma_i(0)=0 (ReLU has ρ=1\rho=1), and WW is the largest width. It predicts arg⁡max⁡jFA(x)j\arg\max_jF_A(x)_j; the margin is M(v,y)=vy−max⁡j≠yvj\mathcal M(v,y)=v_y-\max_{j\ne y}v_j, and R^γ\hat R_\gamma is the empirical ramp loss at margin γ\gamma. Fix reference matrices MiM_i (zero for AlexNet, the identity for a ResNet); ∥Ai⊤∥2,1\|A_i^\top\|_{2,1} sums the ℓ2\ell_2 norms of the incoming weights of layer ii's units. The spectral complexity is RA=(∏i=1Lρi∥Ai∥σ)(∑i=1L∥Ai⊤−Mi⊤∥2,12/3∥Ai∥σ2/3)3/2,R_A=\Big(\prod_{i=1}^L\rho_i\|A_i\|_\sigma\Big)\Big(\sum_{i=1}^L\frac{\|A_i^\top-M_i^\top\|_{2,1}^{2/3}}{\|A_i\|_\sigma^{2/3}}\Big)^{3/2}, and ∥X∥2\|X\|_2 is the Frobenius norm of the data matrix.

Theorem 1.1 (spectrally normalized margin bound). For i.i.d. data from any distribution on Rd×{1,…,k}\mathbb R^d\times\{1,\dots,k\}, with probability at least 1−δ1-\delta, every margin γ>0\gamma\gt0 and every network FAF_A satisfy Pr⁡[arg⁡max⁡jFA(x)j≠y]≤R^γ(FA)+O~(∥X∥2RAγnln⁡W+ln⁡(1/δ)n).\Pr\big[\arg\max_jF_A(x)_j\ne y\big]\le\hat R_\gamma(F_A)+\tilde O\Big(\frac{\|X\|_2R_A}{\gamma n}\ln W+\sqrt{\frac{\ln(1/\delta)}n}\Big). The complexity term is RAR_A times the root-mean-square input norm over γn\gamma\sqrt n. Depth, width and kk enter only through logarithms and the norms themselves, and the bound holds uniformly over networks and margins, so it may be evaluated at the weights SGD returns.

Theorem 3.4 (lower bound). With ReLU activations, scalar output and hidden widths at least 2, the Rademacher complexity of {FA:∏i∥Ai∥σ≤r}\{F_A:\prod_i\|A_i\|_\sigma\le r\} on the sample is at least c r∥X∥2/nc\,r\|X\|_2/n. So the product of spectral norms cannot be removed, and the lower bound matches the scaling of the upper bound; the (2,1)(2,1) correction is left untested.

Step 1

Reduce to covering the matrix of network outputs, with no cost in kk. The Rademacher bound for the ramp loss gives Pr⁡[error]≤R^γ(f)+2R(Fγ∣S)+3ln⁡(2/δ)/(2n)\Pr[\text{error}]\le\hat R_\gamma(f)+2\mathfrak R(\mathcal F_\gamma|_S)+3\sqrt{\ln(2/\delta)/(2n)}, with Fγ\mathcal F_\gamma the class of margin losses. The margin operator is 2-Lipschitz in ℓ2\ell_2 and the ramp is 1/γ1/\gamma-Lipschitz, so a Frobenius-norm cover of the k×nk\times n output matrix at scale γϵ/2\gamma\epsilon/2 covers that class at scale ϵ\epsilon. One cover of the whole output vector adds no factor of kk, where bounding each output coordinate separately adds a factor k\sqrt k.

Step 2

One layer is covered by Maurey sparsification, at a cost free of dimension. For a data matrix X∈Rn×dX\in\mathbb R^{n\times d} and weights A∈Rd×mA\in\mathbb R^{d\times m}, ln⁡N({XA:∥A∥2,1≤a},ϵ,∥⋅∥2)≤⌈a2∥X∥22ϵ2⌉ln⁡(2dm).\ln\mathcal N\big(\{XA:\|A\|_{2,1}\le a\},\epsilon,\|\cdot\|_2\big)\le\Big\lceil\frac{a^2\|X\|_2^2}{\epsilon^2}\Big\rceil\ln(2dm). After normalizing columns, XAXA is a∥X∥2a\|X\|_2 times a point in the convex hull of 2dm2dm rank-one atoms of Frobenius norm at most 1. Maurey's lemma replaces that point by the average of k=a2∥X∥22/ϵ2k=a^2\|X\|_2^2/\epsilon^2 atoms sampled from its weights, and there are at most (2dm)k(2dm)^k such averages, so dd and mm appear only inside the log. A Frobenius bound on AA would bring in an extra dimension factor, even for X=IX=I.

Step 3

Push an empirical cover through the layers, so errors grow by the spectral norms and log covers add. Covering the image of the sample instead of the parameters keeps the parameter count out. Let XiX_i be layer ii's outputs on the sample and X^i\hat X_i a cover element. Cover Ai+1X^iA_{i+1}\hat X_i with Step 2 and apply σi+1\sigma_{i+1}; the triangle inequality and the Lipschitz bounds give ∥Xi+1−X^i+1∥≤ρi+1∥Ai+1∥σ∥Xi−X^i∥+ρi+1ϵi+1,\|X_{i+1}-\hat X_{i+1}\|\le\rho_{i+1}\|A_{i+1}\|_\sigma\|X_i-\hat X_i\|+\rho_{i+1}\epsilon_{i+1}, so the output error is ∑jϵjρj∏l>jρl∥Al∥σ\sum_j\epsilon_j\rho_j\prod_{l>j}\rho_l\|A_l\|_\sigma, and since each layer's cover is chosen given the earlier ones, log covers add. Step 2 needs a norm bound on its input: because σj(0)=0\sigma_j(0)=0 and the covers are proper (each cover element is itself the image of the sample under admissible weights), it is at most ∥X∥2∏j<iρj∥Aj∥σ\|X\|_2\prod_{j\lt i}\rho_j\|A_j\|_\sigma. Centering the cover at MiM_i does not change these bounds.

Step 4

Budgeting the error across layers produces the spectral complexity. With ∥Ai∥σ≤si\|A_i\|_\sigma\le s_i and ∥Ai⊤−Mi⊤∥2,1≤bi\|A_i^\top-M_i^\top\|_{2,1}\le b_i, layer ii costs a log cover of order ci/ϵi2c_i/\epsilon_i^2 while its error is amplified by the later spectral norms. Minimizing ∑ici/ϵi2\sum_ic_i/\epsilon_i^2 under the linear error budget makes layer ii's share of the output error proportional to (bi/si)2/3(b_i/s_i)^{2/3}, and the minimum is ln⁡N({FA(X⊤)},ϵ,∥⋅∥2)≤∥X∥22ln⁡(2W2)ϵ2(∏jρj2sj2)(∑i(bisi)2/3)3,\ln\mathcal N\big(\{F_A(X^\top)\},\epsilon,\|\cdot\|_2\big)\le\frac{\|X\|_2^2\ln(2W^2)}{\epsilon^2}\Big(\prod_j\rho_j^2s_j^2\Big)\Big(\sum_i\Big(\frac{b_i}{s_i}\Big)^{2/3}\Big)^3, that is (∥X∥2RA/ϵ)2ln⁡(2W2)(\|X\|_2R_A/\epsilon)^2\ln(2W^2). The exponents 2/32/3 and 3/23/2 come from the solution of this allocation problem, and the product of spectral norms is how much an error at any layer can be amplified on the way to the output.

Step 5

Dudley's entropy integral turns the cover into a Rademacher bound with one extra log factor. After the margin loss, ln⁡N(ϵ)≤R/ϵ2\ln\mathcal N(\epsilon)\le\mathcal R/\epsilon^2 with R=2∥X∥2RAln⁡(2W2)/γ\sqrt{\mathcal R}=2\|X\|_2R_A\sqrt{\ln(2W^2)}/\gamma, and the entropy integral, for the unnormalized ℓ2\ell_2 data metric, gives R(Fγ∣S)≤inf⁡α>0(4αn+12n∫αnRϵ dϵ)=inf⁡α>0(4αn+12Rnln⁡nα).\mathfrak R(\mathcal F_\gamma|_S)\le\inf_{\alpha\gt0}\Big(\frac{4\alpha}{\sqrt n}+\frac{12}{n}\int_\alpha^{\sqrt n}\frac{\sqrt{\mathcal R}}{\epsilon}\,d\epsilon\Big)=\inf_{\alpha\gt0}\Big(\frac{4\alpha}{\sqrt n}+\frac{12\sqrt{\mathcal R}}{n}\ln\frac{\sqrt n}\alpha\Big). Entropy of order 1/ϵ21/\epsilon^2 is Dudley's borderline case, where the integral diverges only logarithmically at 0, so α=1/n\alpha=1/n costs just a factor ln⁡n\ln n. This proves the bound for norm bounds and a margin fixed in advance.

Step 6

A union bound over a grid makes it hold for every network and margin at once. The norms of the weights SGD returns depend on the sample. Divide the space of margins and norms into grid cells, apply Step 5 in each with failure probabilities summing to δ\delta, and use the smallest cell containing the network. The cost is logarithms of the norms and of n/γn/\gamma, absorbed by the O~\tilde O.

Step 7

The lower bound, by embedding linear predictors. Any linear function x↦⟨a,x⟩x\mapsto\langle a,x\rangle with ∥a∥2≤r\|a\|_2\le r is a ReLU network of the given depth with ∏i∥Ai∥σ=2r\prod_i\|A_i\|_\sigma=2r: split ⟨a,x⟩\langle a,x\rangle into its positive and negative parts in the first layer, carry them through identity blocks, and output their difference. The linear class has Rademacher complexity at least c r∥X∥2/nc\,r\|X\|_2/n by Khintchine-Kahane. (A separate remark explains why the product of norms appears instead of the norm of the product: with ReLUs, ∏iAi=0\prod_iA_i=0 need not give the zero function.)

Step 8

On real and random labels, the normalized margins order problems by difficulty. The experiments plot the distribution of normalized margins M(FA(x),y)/(RA∥X∥2/n)\mathcal M(F_A(x),y)/(R_A\|X\|_2/n), which controls the bound up to logs, for an AlexNet-like network trained with plain SGD and no regularization, with the same settings on every dataset (the figures use ℓ1\ell_1 in place of (2,1)(2,1), a difference the paper reports as negligible). Raw margins look alike for true and random CIFAR10 labels; normalized, the random-label distribution sits far to the left, and MNIST far to the right of CIFAR10. Over training the product of spectral norms keeps growing after the excess risk levels off, while the margin-normalized version stays flat. These are qualitative comparisons: the paper reports no value of the bound, and Nagarajan and Kolter's evaluation on MNIST networks puts it far above 1.

Consequences and limits. This was the first margin bound for deep ReLU networks to pass the randomization test qualitatively, and its proof pattern (cover each layer in a norm Maurey can handle, propagate an empirical cover with Lipschitz constants, allocate the error across layers) became the template for later norm-based bounds. "No dependence on width" is about explicit factors: for a dense layer with i.i.d. N(0,1/d)N(0,1/d) entries, ∥A⊤∥2,1/∥A∥σ≈d/2\|A^\top\|_{2,1}/\|A\|_\sigma\approx d/2 (my check: 32, 129, 514 for d=64,256,1024d=64,256,1024), so with Mi=0M_i=0 the correction factor grows with width unless the learned weights are far from random. The Lipschitz constant is a worst case over all inputs, while what matters is the behavior near the data. Nagarajan and Kolter later show that this bound grows with nn on MNIST runs while the test error falls.

Terms

RA=∏iρi∥Ai∥σ(∑i∥Ai⊤−Mi⊤∥2,12/3/∥Ai∥σ2/3)3/2R_A=\prod_i\rho_i\|A_i\|_\sigma\big(\sum_i\|A_i^\top-M_i^\top\|_{2,1}^{2/3}/\|A_i\|_\sigma^{2/3}\big)^{3/2}
spectral complexity: Lipschitz constant times a per-layer distance correction
M(v,y)=vy−max⁡j≠yvj\mathcal M(v,y)=v_y-\max_{j\ne y}v_j
multiclass margin; 2-Lipschitz in ℓ∞\ell_\infty, hence in ℓ2\ell_2
R^γ\hat R_\gamma
empirical ramp loss; at most the fraction of training points with margin ≤γ\le\gamma
∥A⊤∥2,1\|A^\top\|_{2,1}
sum over units of the ℓ2\ell_2 norms of their incoming weights
∥X∥2/n\|X\|_2/n
root-mean-square input norm over n\sqrt n
Maurey sparsification
a point of a convex hull is within diam/k\mathrm{diam}/\sqrt k of an average of kk sampled atoms
Empirical cover through layers
cover each layer's output on the sample; errors grow by ρi∥Ai∥σ\rho_i\|A_i\|_\sigma, log covers add
(∑i(bi/si)2/3)3(\sum_i(b_i/s_i)^{2/3})^3
value of the optimal allocation of cover resolution across layers
Dudley entropy integral
turns ln⁡N(ϵ)∝1/ϵ2\ln\mathcal N(\epsilon)\propto1/\epsilon^2 into a Rademacher bound with one ln⁡n\ln n
Normalized margin
M(FA(x),y)/(RA∥X∥2/n)\mathcal M(F_A(x),y)/(R_A\|X\|_2/n); its distribution is what the experiments compare
Stable rank r0(A⊤A)=∥A∥F2/∥A∥σ2r_0(A^\top A)=\|A\|_F^2/\|A\|_\sigma^2
∥A⊤∥2,1/∥A∥σ≤di r0(A⊤A)\|A^\top\|_{2,1}/\|A\|_\sigma\le\sqrt{d_i\,r_0(A^\top A)}

Quiz

  1. In a ReLU network with reference matrices Mi=0M_i=0, multiply the last weight matrix by c>0c\gt0. How does the complexity term ∥X∥2RA/(γn)\|X\|_2R_A/(\gamma n) change if γ\gamma is chosen at a fixed quantile of the training margins?
  2. For a dense d×dd\times d layer with i.i.d. N(0,1/d)N(0,1/d) entries, roughly how large is ∥A⊤∥2,1/∥A∥σ\|A^\top\|_{2,1}/\|A\|_\sigma?
  3. On CIFAR10 the raw margins of networks trained on true and on random labels look alike. What do the experiments gain by dividing the margins by RA∥X∥2/nR_A\|X\|_2/n?
  4. What does the lower bound of Theorem 3.4 establish about the spectral complexity?

Sources