Title: A PAC-BAYESIAN APPROACH TO SPECTRALLY-NORMALIZED MARGIN BOUNDS FOR NEURAL NETWORKS

Abstract: We present a generalization bound for feedforward neural networks with ReLU activations in terms of the product of the spectral norm of the layers and the Frobenius norm of the weights. The key ingredient is a bound on the changes in the output of a network with respect to perturbation of its weights, thereby bounding the sharpness of the network. We combine this perturbation bound with the PAC-Bayes analysis to derive the generalization bound.

1. INTRODUCTION:

Learning with deep neural networks has enjoyed great success across a wide variety of tasks. Even though learning neural networks is a hard problem, even for one hidden layer (Blum & Rivest, 1993) , simple optimization methods such as stochastic gradient descent (SGD) have been able to minimize the training error. More surprisingly, solutions found this way also have small test error, even though the networks used have more parameters than the number of training samples, and have the capacity to easily fit random labels (Zhang et al., 2017) . Harvey et al. (2017) provided a generalization error bound by showing that the VC dimension of d-layer networks is depth times the number parameters improving over earlier bounds by Bartlett et al. (1999) . Such VC bounds which depend on the number of parameters of the networks, cannot explain the generalization behavior in the over parametrized settings, where the number of samples is much smaller than the number of parameters.

For linear classifiers we know that the generalization behavior depends on the norm and margin of the classifier and not on the actual number of parameters. Hence, a generalization bound for neural networks that only depends on the norms of its layers, and not the actual number of parameters, can explain the good generalization behavior of the over parametrized networks. Bartlett & Mendelson (2002) showed generalization bounds for feedforward networks in terms of unit-wise 1 norm with exponential dependence on depth. In a more recent work, Neyshabur et al. (2015a) provided generalization bounds for general class of group norms including Frobenius norm with same exponential dependence on the depth and showed that the exponential dependence is unavoidable in the worst case. Bartlett et al. (2017a) showed a margin based generalization bound that depends on spectral norm and 1 norm of the layers of the networks. They show this bound using a complex covering number argument. This bound does not depend directly on the number of parameters of the network but depends on the norms of its layers. However the 1 term has high dependence on the number of hidden units if the weights are dense, which is typically the case for modern deep learning architectures. Keskar et al. (2016) suggested a sharpness based measure to predict the difference in generalization behavior of networks trained with different batch size SGD. However sharpness is not a scale invariant measure and cannot predict the generalization behavior (Neyshabur et al., 2017) . Instead sharpness when combined with the norms of the network can predict the generalization behavior according to the PAC-Bayes framework (McAllester, 1999) . Dziugaite & Roy (2017) numerically evaluated a generalization error bound from the PAC-Bayes framework showing that it can predict the difference in generalization behavior of networks trained on true vs random labels. This generalization result is more of computational in nature and gives much tighter (non-vacuous) bounds compared with the ones in either (Bartlett et al., 2017a) or the ones in this paper.

In this paper we present and prove a margin based generalization bound for feedforward neural networks with ReLU activations, that depends on the product of the spectral norm of the weights in each layer, as well as the Frobenius norm of the weights.

Our generalization bound shares much similarity with a margin based generalization bound recently presented by Bartlett et al. (2017a) . Both bounds depend similarly on the product of the spectral norms of each layer, multiplied by a factor that is additive across layers. In addition, Bartlett et al. (2017a) bound depends on the elementwise 1 -norm of the weights in each layer, while our bound depends on the Frobenius (elementwise 2 ) norm of the weights in each layer, with an additional multiplicative dependence on the "width". The two bounds are thus not directly comparable, and as we discuss in Section 3, each one dominates in a different regime, roughly depending on the sparsity of the weights. We also discuss in what regimes each of these bounds could dominate a VC-bound based on the overall number of weights.

More importantly, our proof technique is entirely different, and arguably simpler, than that of Bartlett et al. (2017a) . We derive our bound using PAC-Bayes analysis, and more specifically a generic PAC-Bayes margin bound (Lemma 1). The main ingredient is a perturbation bound (Lemma 2), bounding the changes in the output of a network when the weights are perturbed, thereby its sharpness, in terms of the product of the spectral norm of the layers. This is an entirely different analysis approach from the covering number analysis of Bartlett et al. (2017a) . We hope our analysis can give more direct intuition into the different ingredients in the bound and will allow modifying the analysis, e.g. by using different prior and perturbation distributions in the PAC-Bayes bound, to obtain tighter bounds, perhaps with dependence on different layer-wise norms.

We note that other prior bounds in terms of elementwise or unit-wise norms (such as the Frobenius norm and elementwise 1 norms of layers), without a spectral norm dependence, all have a multiplicative dependence across layers or exponential dependence on depth (Bartlett & Mendelson, 2002; Neyshabur et al., 2015b) , or are for constant depth networks (Bartlett, 1998) . Here only the spectral norm is multiplied across layers, and thus if the spectral norms are close to one, the exponential dependence on depth can be avoided.

After the initial preprint of this paper, Bartlett et al. (2017b) presented an improved bound that replaces the dependency on 1 norm of the layers (Bartlett et al., 2017a) with 2,1 norm. This new generalization bound is strictly better than our Frobenius norm bound, and improves over existing results.

1.1. PRELIMINARIES:

Consider the classification task with input domain

X B,n = x ∈ R n | | n i=1 x 2

i ≤ B 2 and output domain R k where the output of the model is a score for each class and the class with the maximum score will be selected as the predicted label. Let f w (x) : X B,n → R k be the function computed by a d layer feed-forward network for the classification task with parameters w

= vec {W i } d i=1 , f w (x) = W d φ(W d-1 φ(....φ(W 1 x))

), here φ is the ReLU activation function. Let f i w (x) denote the output of layer i before activation and h be an upper bound on the number of output units in each layer. We can then define fully connected feedforward networks recursively:

f 1 w (x) = W 1 x and f i w (x) = W i φ(f i-1 w (x)).

Let . F , . 1 and . 2 denote the Frobenius norm, the element-wise 1 norm and the spectral norm respectively. We further denote the p norm of a vector by |.| p .

Margin Loss. For any distribution D and margin γ > 0, we define the expected margin loss as follows:

EQUATION

Let L γ (f w ) be the empirical estimate of the above expected margin loss. Since setting γ = 0 corresponds to the classification loss, we will use L 0 (f w ) and L 0 (f w ) to refer to the expected risk and the training error. The loss L γ defined this way is bounded between 0 and 1.

1.2. PAC-BAYESIAN FRAMEWORK:

The PAC-Bayesian framework (McAllester, 1998; 1999) provides generalization guarantees for randomized predictors, drawn form a learned distribution Q (as opposed to a learned single predictor) that depends on the training data. In particular, let f w be any predictor (not necessarily a neural network) learned from the training data and parametrized by w. We consider the distribution Q over predictors of the form f w+u , where u is a random variable whose distribution may also depend on the training data. Given a "prior" distribution P over the set of predictors that is independent of the training data, the PAC-Bayes theorem states that with probability at least 1 -δ over the draw of the training data, the expected error of f w+u can be bounded as follows (McAllester, 2003) :

EQUATION

)

To get a bound on the expected risk L 0 (f w ) for a single predictor f w , we need to relate the expected perturbed loss, E u [L 0 (f w+u )] in the above equation with L 0 (f w ). Toward this we use the following lemma that gives a margin-based generalization bound derived from the PAC-Bayesian bound (2): Lemma 1. Let f w (x) : X → R k be any predictor (not necessarily a neural network) with parameters w, and P be any distribution on the parameters that is independent of the training data. Then, for any γ, δ > 0, with probability ≥ 1 -δ over the training set of size m, for any w, and any random perturbation u s.t.

P u max x∈X |f w+u (x) -f w (x)| ∞ < γ 4 ≥ 1 2 , we have: L 0 (f w ) ≤ L γ (f w ) + 4 KL (w + u P ) + ln 6m δ m -1 .

In the above expression the KL is evaluated for a fixed w and only u is random, i.e. the distribution of w + u is the distribution of u shifted by w. The lemma is analogous to similar analysis of Langford & Shawe-Taylor (2003) and McAllester (2003) obtaining PAC-Bayes margin bounds for linear predictors, and the proof, presented in Section 4, is essentially the same. As we state the lemma, it is not specific to linear separators, nor neural networks, and holds generally for any real-valued predictor.

We next show how to utilize the above general PAC-Bayes bound to prove generalization guarantees for feedforward networks based on the spectral norm of its layers.

2. GENERALIZATION BOUND:

In this section we present our generalization bound for feedfoward networks with ReLU activations, derived using the PAC-Bayesian framework. Langford & Caruana (2001) , and more recently Dziugaite & Roy (2017) and Neyshabur et al. ( 2017), used PAC-Bayes bounds to analyze generalization behavior in neural networks, evaluating the KL-divergence, "perturbation error"

L[f w+u ] -L[f w ],

or the entire bound numerically. Here, we use the PAC-Bayes framework as a tool to analytically derive a margin-based bound in terms of norms of the weights. As we saw in Lemma 1, the key to doing so is bounding the change in the output of the network when the weights are perturbed. In the following lemma, we bound this change in terms of the spectral norm of the layers:

Lemma 2 (Perturbation Bound). For any B, d > 0, let f w : X B,n → R k be a d-layer neural network with ReLU activations. Then for any w, and x ∈ X B,n , and any perturbation u

= vec {U i } d i=1 such that U i 2 ≤ 1 d W i 2

, the change in the output of the network can be bounded as follows:

|fw+u(x) -fw(x)| 2 ≤ eB d i=1 Wi 2 d i=1 Ui 2 Wi 2 .

This lemma characterizes the change in the output of a network with respect to perturbation of its weights, thereby bounding the sharpness of the network as defined in Keskar et al. (2016) .

The proof of this lemma is presented in Section 4. Next we use the above perturbation bound and the PAC-Bayes result (Lemma 1) to derive the following generalization guarantee.

Theorem 1 (Generalization Bound). For any B, d, h > 0, let f w : X B,n → R k be a d-layer feedforward network with ReLU activations. Then, for any δ, γ > 0, with probability ≥ 1 -δ over a training set of size m, for any w, we have:

L0(fw) ≤ Lγ(fw) + O     B 2 d 2 h ln(dh)Π d i=1 Wi 2 2 d i=1 W i 2 F W i 2 2 + ln dm δ γ 2 m     .

Proof. The proof involves mainly two steps. In the first step we calculate what is the maximum allowed perturbation of parameters to satisfy a given margin condition γ, using Lemma 2. In the second step we calculate the KL term in the PAC-Bayes bound in Lemma 1, for this value of the perturbation.

Let

β = d i=1 W i 2 1/d

and consider a network with the normalized weights

W i = β Wi 2 W i .

Due to the homogeneity of the ReLU, we have that for feedforward networks with ReLU activations f w = f w , and so the (empirical and expected) loss (including margin loss) is the same for w and w.

We can also verify that

d i=1 W i 2 = d i=1 W i 2 and Wi F Wi 2 = Wi F Wi 2

, and so the excess error in the Theorem statement is also invariant to this transformation. It is therefore sufficient to prove the Theorem only for the normalized weights w, and hence we assume w.l.o.g. that the spectral norm is equal across layers, i.e. for any layer i, W i 2 = β.

Choose the distribution of the prior P to be N (0, σ 2 I), and consider the random perturbation u ∼ N (0, σ 2 I), with the same σ, which we will set later according to β. More precisely, since the prior cannot depend on the learned predictor w or its norm, we will set σ based on an approximation β. For each value of β on a pre-determined grid, we will compute the PAC-Bayes bound, establishing the generalization guarantee for all w for which |β -β| ≤ 1 d β, and ensuring that each relevant value of β is covered by some β on the grid. We will then take a union bound over all β on the grid. For now, we will consider a fixed β and the w for which |β -β| ≤ 1 d β, and hence 1 1 e β d-1 ≤ βd-1 ≤ eβ d-1 . Since u ∼ N (0, σ 2 I), we get the following bound for the spectral norm of U i (Tropp, 2012) :

P Ui∼N (0,σ 2 I) [ U i 2 > t] ≤ 2he -t 2 /2hσ 2 .

Taking a union bond over the layers, we get that, with probability ≥ 1 2 , the spectral norm of the perturbation U i in each layer is bounded by σ 2h ln(4dh). Plugging this spectral norm bound into Lemma 2 we have that with probability at least 1 2 ,

EQUATION

where we choose σ =

γ 42dB βd-1 √ h ln(4hd)

to get the last inequality. Hence, the perturbation u with the above value of σ satisfies the assumptions of the Lemma 1.

We now calculate the KL-term in Lemma 1 with the chosen distributions for P and u, for the above value of σ.

KL(w+u||P ) ≤ |w| 2 2σ 2 = 42 2 d 2 B 2 β2d-2 h ln(4hd) 2γ 2 d i=1 Wi 2 F ≤ O B 2 d 2 h ln(dh) β 2d γ 2 d i=1 Wi 2 F β 2 ≤ O B 2 d 2 h ln(dh) Π d i=1 Wi 2 2 γ 2 d i=1 Wi 2 F Wi 2 2 . 1 1 + 1 d d-1 ≤ 1 + 1 d d ≤ e, as 1 + x ≤ e x , for all x. Similarly 1 + 1 d-1 d-1 ≤ e, gives 1 e ≤ 1 -1 d d-1 .

Hence, for any β, with probability ≥ 1 -δ and for all w such that, |β -β| ≤ 1 d β, we have:

L0(fw) ≤ Lγ(fw) + O     B 2 d 2 h ln(dh)Π d i=1 Wi 2 2 d i=1 W i 2 F W i 2 2 + ln m δ γ 2 m     .

(4)

Finally we need to take a union bound over different choices of β. Let us see how many choices of β we need to ensure we always have β in the grid s. . Taking a union bound over the choices of β in this cover and using the bound in equation ( 4) gives us the theorem statement.

3. COMPARISON TO EXISTING GENERALIZATION BOUNDS:

In this section we will compare the bound of Theorem 1 with a similar spectral norm based margin bound recently obtained by Bartlett et al. (2017a; b) , as well as examine whether and when these bounds can improve over VC-based generalization guarantees.

The VC-dimension of fully connected feedforward neural networks with ReLU activation with d layers and h units per layer is Θ(d 2 h 2 ) (Harvey et al. (2017) ), yielding a generalization guarantee of the form:

L 0 (f w ) ≤ L0 (f w ) + Õ d 2 h 2 m (5)

where here and throughout this section we ignore logarithmic factors that depend on -the failure probability δ, the sample size m, the depth d and the number of units h. Bartlett et al. (2017a) showed a generalization bound for neural networks based on the spectral norm of its layers, using a different proof approach based on covering number arguments. For feedforward depth-d networks with ReLU activations, and when inputs are in X B,n , i.e. are of norm bounded by |x| 2 ≤ B, their generalization guarantee, ignoring logarithmic factors, ensures that, with high probability, for any w,

EQUATION

Comparing our Theorem 1 and the Bartlett et al. (2017a) bound ( 6), the factor

O 1 γ 2 B 2 Π d i=1 W i 2 2

appears in both bounds. The main difference is in the multiplicative factors,

d 2 h d i=1 Wi 2 F/ Wi 2 2 in Theorem 1 compared to d i=1 Wi 1/ Wi 2 2/3 3 in (6).

To get a sense of how these two bounds compare, we will consider the case where the norms of the weight matrices are uniform across layers-this is a reasonable situation as we already saw that the bounds are invariant to re-balancing the norm between the layers. But for the sake of comparison, we further assume that not only is the spectral norm equal across layers (this we can assume w.l.o.g.) but also the Frobenius W i F and element-wise 1 norm W i 1 are uniform across layers (we acknowledge that this setting is somewhat favorable to our bound compared to (6)). In this case the numerator in the generalization bound of Theorem 1 scales as:

EQUATION

while numerator in (6) scales as:

EQUATION

)

Comparing between the bounds thus boils down to comparing

√ h W i F with W i 1 . Recalling that W i is at most a h × h matrix, we have that W i F ≤ W i 1 ≤ h W i F .

When the weights are fairly dense and are of uniform magnitude, the second inequality will be tight, and we will have √ h W i F W i 1 , and Theorem 1 will dominate. When the weights are sparse with roughly a constant number of significant weights per unit (i.e. weight matrix with sparsity Θ(h)), the bounds will be similar. Bartlett et al. (2017a) bound will dominate when the weights are extremely sparse, with much fewer significant weights than units, i.e. when most units do not have any incoming or outgoing weights of significant magnitude.

It is also insightful to ask in what regime each bound could potentially improve over the VC-bound (5) and thus provide a non-trivial guarantee. To this end, we consider the most "optimistic" scenario where B 2 γ 2 Π d i=1 W i 2 2 = Θ(1) (it certainly cannot be lower than one if we have a non-trivial margin loss). As before, we also take the norms of the weight matrices to be uniform across layers, yielding the multiplicative factors in ( 7) and ( 8), which we must compare to the VC-dimension Θ(d 2 h 2 ). We get that the bound of Theorem 1 is smaller than the VC bound if

EQUATION

We always have

W i F ≤ √ h W i 2

, and this is tight only for orthogonal matrices, where all eigenvalues are equal. Satisfying (9), and thus having Theorem 1 potentially improving over the VC-bound, thus only requires fairly mild eigenvalue concentration (i.e. having multiple units be similar to each other), reduced rank or row-level sparsity in the weight matrices. Note that we cannot expect to improve over the VC-bound for unstructured "random" weight matrices-we can only expect norm-based guarantees to improve over the VC bound if there is some specific degenerate structure in the weights, and as we indeed see is the case here.

A similar comparison with Bartlett et al. (2017a) bound ( 6) and its multiplicative factor (8), yields the following condition for improving over the VC bound:

EQUATION

)

Since W i 1 can be as large as h 1.5 W i 2 , in some sense more structure is required here in order to satisfy (10), such as elementwise sparsity combined with low-rank row structure. As discussed above, Theorem 1 and Bartlett et al. (2017a) bound can each be better in different regimes. Also in terms of comparison to the VC-bound, it is possible for either one to improve over the VC bound while the other doesn't (i.e. for either ( 9) or ( 10) to be satisfied without the other one being satisfied), depending on the sparsity structure in the weights.

After the initial preprint of this paper, Bartlett et al. (2017b) presented an improved bound replacing the 1 norm term in the bound Bartlett et al. (2017a) with 2,1 norm (sum of 2 norms of each unit). This new bound depending on W i 2,1 is always better than the bound based on W i 1 and our bound based on √ h W i F . They match when each hidden unit has the same norm, making

W i 2,1 ≈ √ h W i F .

4. PROOFS OF LEMMAS:

In this section we present the proofs of Lemmas 1 and 2.

Proof of Lemma 1. Let w = w + u. Let S w be the set of perturbations with the following property:

S w ⊆ w max x∈X B,n |f w (x) -f w (x)| ∞ < γ 4 .

Let q be the probability density function over the parameters w . We construct a new distribution Q over predictors f w where w is restricted to S w with the probability density function:

q( w) = 1 Z q( w) w ∈ S w 0 otherwise.

Here Z is a normalizing constant and by the lemma assumption Z = P [w ∈ S w ] ≥ 1 2 . By the definition of Q, we have:

max x∈X B,n |f w(x) -f w (x)| ∞ < γ 4 .

Therefore, the perturbation can change the margin between two output units of f w by at most γ 2 ; i.e. for any perturbed parameters w drawn from Q:

max i,j∈[k],x∈X B,n |(|f w(x)[i] -f w(x)[j]|) -(|f w (x)[i] -f w (x)[j]|)| < γ 2

Since the above bound holds for any x in the domain X B,n , we can get the following a.s.:

L 0 (f w ) ≤ L γ 2 (f w) L γ

2 (f w) ≤ L γ (f w ) Now using the above inequalities together with the equation ( 2), with probability 1 -δ over the training set we have:

L 0 (f w ) ≤ E w L γ 2 (f w) ≤ E w L γ 2 (f w) + 2 2(KL ( w P ) + ln 2m δ ) m -1 ≤ L γ (f w ) + 2 2(KL ( w P ) + ln 2m δ ) m -1 ≤ L γ (f w ) + 4 KL (w P ) + ln 6m δ m -1 ,

The last inequality follows from the following calculation.

Let S c w denote the complement set of S w and qc denote the density function q restricted to S c w and normalized. Then, Proof of Lemma 2. Let ∆ i = f i w+u (x) -f i w (x) 2 . We will prove using induction that for any i ≥ 0:

KL(q||p) = ZKL(q||p) + (1 -Z)KL(q c ||p) -H(Z), where H(Z) = -Z ln Z -(1 -Z) ln(1 -Z) ≤

∆i ≤ 1 + 1 d i i j=1 Wj 2 |x| 2 i j=1

Uj 2 Wj 2 .

The above inequality together with 1 + 1 d d ≤ e proves the lemma statement. The induction base clearly holds since ∆ 0 = |x -x| 2 = 0. For any i ≥ 1, we have the following:

∆ i+1 = (W i+1 + U i+1 ) φ i (f i w+u (x)) -W i+1 φ i (f i w (x)) 2 = (W i+1 + U i+1 ) φ i (f i w+u (x)) -φ i (f i w (x)) + U i+1 φ i (f i w (x)) 2 ≤ ( W i+1 2 + U i+1 2 ) φ i (f i w+u (x)) -φ i (f i w (x)) 2 + U i+1 2 φ i (f i w (x)) 2 ≤ ( W i+1 2 + U i+1 2 ) f i w+u (x) -f i w (x) 2 + U i+1 2 f i w (x) 2 = ∆ i ( W i+1 2 + U i+1 2 ) + U i+1 2 f i w (x) 2 ,

where the last inequality is by the Lipschitz property of the activation function and using φ(0) = 0.

The 2 norm of outputs of layer i is bounded by |x| 2 Π i j=1 W j 2 and by the lemma assumption we have U i+1 2 ≤ 1 d W i+1 2 . Therefore, using the induction step, we get the following bound: 

5. CONCLUSION:

In this paper, we presented new perturbation bounds for neural networks thereby giving a bound on its sharpness. We also discussed how PAC-Bayes framework can be used to derive generalization bounds based on the sharpness of a model class. Applying this to the feedforward networks, we showed that a tighter generalization bound can be achieved based on the spectral norm and Frobenius norm of the layers. The simplicity of the proof compared to that of covering number arguments in Bartlett et al. (2017a) suggest that the PAC-Bayes framework might be an important tool in analyzing the generalization behavior of neural networks.

:



Figures and Tables:

t. | β -β| ≤ 1 d β. We only need to consider values of β in the range γ For β outside this range the theorem statement holds trivially: Recall that the LHS of the theorem statement, L 0 (f w ) is always bounded by 1. If β d < γ 2B , then for any x, |f w (x)| ≤ β d B ≤ γ/2 and therefore L γ = 1. Alternately, if β d > γ √ m 2B , then the second term in equation 2 is greater than one. Hence, we only need to consider values of β in the range discussed above. | β -β| ≤ 1 d γ 2B 1/d is a sufficient condition to satisfy the required condition that | β -β| ≤ 1 d β in the above range, thus we can use a cover of size dm 1 2d

1 is the binary entropy function. Since KL is always positive, we get,KL(q||p) = 1 Z [KL(q||p) + H(Z)) -(1 -Z)KL(q c ||p)] ≤ 2(KL(q||p) + 1).

Peer review (iclr2018):
 The authors prove a generalization guarantee for deep neural networks with ReLU activations, in terms of margins of the classifications and norms of the weight matrices. They compare this bound with a similar recent bound proved by Bartlett, et al. While, strictly speaking, the bounds are incomparable in strength, the authors of the submission make a convincing case that their new bound makes stronger guarantees under some interesting conditions. The analysis is elegant. It uses some existing tools, but brings them to bear in an important new context, with substantive new ideas needed. The mathematical writing is excellent. Very nice paper. I guess that networks including convolutional layers are covered by their analysis. It feels to me that these tend to be sparse, but that their analysis still my provides some additional leverage for such layers. Some explicit discussion of convolutional layers may be helpful.