Robust Large Margin Deep Neural Networks

The generalization error of deep neural networks via their classification margin is studied in this paper. Our approach is based on the Jacobian matrix of a deep neural network and can be applied to networks with arbitrary nonlinearities and pooling layers, and to networks with different architectures such as feed forward networks and residual networks. Our analysis leads to the conclusion that a bounded spectral norm of the network's Jacobian matrix in the neighbourhood of the training samples is crucial for a deep neural network of arbitrary depth and width to generalize well. This is a significant improvement over the current bounds in the literature, which imply that the generalization error grows with either the width or the depth of the network. Moreover, it shows that the recently proposed batch normalization and weight normalization reparametrizations enjoy good generalization properties, and leads to a novel network regularizer based on the network's Jacobian matrix. The analysis is supported with experimental results on the MNIST, CIFAR-10, LaRED, and ImageNet datasets.


I. INTRODUCTION
In recent years, deep neural networks (DNNs) achieved state-of-the-art results in image recognition, speech recognition and many other applications [1]- [4].DNNs are constructed as a series of non-linear signal transformations that are applied sequentially, where the parameters of each layer are estimated from the data [3].Typically, each layer applies on its input a linear (or affine) transformation followed by a point-wise non-linearity such as the sigmoid function, the hyperbolic tangent function or the Rectified Linear Unit (ReLU) [5].Many DNNs also include pooling layers, which act as down-sampling operators and may also provide invariance to various input transformations such as translation [6], [7].They may be linear, as in average pooling, or non-linear, as in max-pooling.
There were various attempts to provide a theoretical foundation for the representation power, optimization and generalization of DNNs.For example, the works in [8], [9] showed that neural networks with a single hidden layer -shallow networks -can approximate any measurable Borel function.On the other hand, it was shown in [10] that a deep network can divide the space into an exponential number of sets, which can not be achieved by shallow networks that use the same number of parameters.Similarly, the authors in [11] conclude that functions implemented by DNNs are exponentially more expressive than functions implemented by shallow networks.The work in [12] shows that for a given number of parameters and a given depth, there always exists a DNN that can be approximated by a shallower network only if the number of parameters in the shallow network is exponential in the number of layers of the deep network.
Scattering transform -a convolutional DNN like transform, which is based on the wavelet transform and pointwise non-linearities -provides insights into translation invariance and stability to deformations of convolutional DNNs [13]- [15].
DNNs with random weights are studied in [16], where it is shown that such networks perform distance preserving embedding of low-dimensional data manifolds.The authors in [17] model a loss function of DNN with a spin-glass model and show that for large networks the local optima of the loss function are close to the global optima.Optimization aspects of DNNs are studied from the perspective of tensor factorization in [18] where it is shown that if a network is large, then it is possible to find the global minima from any initialization with a gradient descent algorithm.The role of DNNs in improving convergence speed of various iterative algorithms is studied in [19].
Optimization dynamics of a deep linear network is studied in [20], where it is shown that the learning speed of deep networks may be independent of their depth.Reparametrization of DNN for more efficient learning is studied in depth in [21].A modified version of stochastic gradient descent for optimization of DNNs that are invariant to weight rescaling in different layers is proposed in [22], where it is shown the weight matrix rows is proposed in [24].It is shown empirically that such reparametrization leads to a faster training and a smaller GE.Learning of DNN by bounding the spectral norm of the weight matrices is proposed in [25].Other methods for DNN regularization include weight decay, dropout [26], constraining the Jacobian matrix of encoder for regularization of auto-encoders [27], and enforcing a DNN to be a partial isometry [28].
An important theoretical aspect of DNNs is the effect of their architecture, e.g.depth and width, on their GE.Various measures such as the VC-dimension [29], [30], the Rademacher or Gaussian complexities [31] and algorithmic robustness [32] have been used to bound the GE in the context of DNNs.For example, the VC-dimension of DNN with the hard-threshold non-linearity is equal to the number of parameters in the network, which implies that the sample complexity is linear in the number of parameters of the network.The GE can also be bounded independently of the number of parameters, provided that the norms of the weight matrices (the network's linear components) are constrained appropriately.Such constraints are usually enforced by training networks with weight decay regularization, which is simply the 1 -or 2 -norm of all the weights in the network.For example, the work [33] studies the GE of DNN with ReLUs and constraints on the norms of the weight matrices.However, it provides GE bounds that scale exponentially with the network depth.Similar behaviour is also depicted in [34].The authors in [32] show that DNNs are robust provided that the 1 -norm of the weights in each layer is bounded.The bounds are exponential in the 1 -norm of the weights if the norm is greater than 1.
The GE bounds in [30], [32], [33] suggest that the GE of a DNN is bounded only if the number of training samples grows with the DNN depth or size.However, in practice increasing network's depth or size often leads to a lower GE [4], [35].Moreover, recent work in [36] shows that a 2 layer DNN with ReLUs may fit any function of n samples in d dimensions provided that it has 2n + d parameters, which is often the case in practice.They show that the nature of the GE depends more on the nature of the data than on the architecture of the network as the same network is able to fit both structured data and random data, where for the first the GE is very low and for the latter it is very large.The authors conclude that data agnostic measures such as the Rademacher complexity or VC-dimension are not adequate to explain the good generalization properties of modern DNN.
Our work complements the previous works on the GE of DNNs by bounding the GE in terms of the DNN classification margin, which is independent of the DNN depth and size, but takes into account the structure of the data (considering its covering number) and therefore avoids the issues presented above.
The extension of our results to invariant DNN is provided in [37].

A. Contributions
In this work we focus on the GE of a multi-class DNN classifier with general non-linearities.We establish new GE bounds of DNN classifiers via their classification margin, i.e. the distance between the training sample and the non-linear decision boundary induced by the DNN classifier in the sample space.The work capitalizes on the algorithmic robustness framework in [32] to cast insight onto the generalization properties of DNNs.In particular, the use of this framework to understand the operation of DNNs involves various innovations, which include: • We derive bounds for the GE of DNNs by lower bounding their classification margin.The lower bound of the classification margin is expressed as a function of the network's Jacobian matrix.
• Our approach includes a large class of DNNs.For example, we consider DNNs with the softmax layer at the network output; DNNs with various non-linearities such as the Rectified Linear Unit (ReLU), the sigmoid and the hyperbolic tangent; DNNs with pooling, such as down-sampling, average pooling and max-pooling; and networks with shortcut connections such as Residual Networks [4].
• Our analysis shows that the GE of a DNN can be bounded independently of its depth or width provided that the spectral norm of the Jacobian matrix in the neighbourhood of the training samples is bounded.We argue that this result gives a justification for a low GE of DNNs in practice.Moreover, it also provides an explanation for why training with the recently proposed weight normalization or batch normalization can lead to a small GE.In such networks the 2 -norm of the weight matrices is fixed and 2 -norm regularization does not apply.The analysis also leads to a novel Jacobian matrix-based regularizer, which can be applied to weight normalized or batch normalized networks.
• We provide a series of examples on the MNIST, CIFAR-10, LaRED and ImageNet datasets that validate our analysis and demonstrate the effectiveness of the Jacobian regularizer.
Our contributions differ from the existing works in many ways.In particular, the GE of DNNs has been studied via the algorithmic robustness framework in [32].Their bounds are based on the per-unit 1 -norm of the weight matrices, and the studied loss is not relevant for classification.Our analysis is much broader, as it aims at bounding the GE of 0-1 loss directly and also considers DNNs with pooling.Moreover, our bounds are a function of the network's Jacobian matrix and are tighter than the bounds based on the norms of the weight matrices.
The work in [28] shows that learning transformations that are locally isometric is robust and leads to a small GE.Though they apply the proposed technique to DNNs they do not show how the DNN architecture affects the GE as our work does.
The authors in [25] have observed that contractive DNNs with ReLUs trained with the hinge loss lead to a large classification margin.However, they do not provide any GE bounds.Moreover, their results are limited to DNNs with ReLUs, whereas our analysis holds for arbitrary non-linearities, DNNs with pooling and DNNs with the softmax layer.
The work in [27] is related to ours in the sense that it proposes to regularize auto-encoders by constraining the Frobenious norm of the encoder's Jacobian matrix.However, their work is more empirical and is less concerned with the classification margin or GE bounds.They use the Jacobian matrix to regularize the encoder whereas we use the Jacobian matrix to regularize the entire DNN.
Finally, our DNN analysis, which is based on the network's Jacobian matrix, is also related to the concept of sensitivity analysis that has been applied to feature selection for SVM and neural networks [38], [39], and for the construction of radial basis function networks [40], since the spectral norm of the Jacobian matrix quantifies the sensitivity of DNN output with respect to the input perturbation.

B. Paper organization
Section II introduces the problem of generalization error, including elements of the algorithmic robustness framework, and introduces DNN classifiers.Properties of DNNs are described in Section III.The bounds on the classification margin of DNNs and their implication for the GE of DNNs are discussed in Section IV.Generalizations of our results are discussed in Section V. Section VI presents experimental results.
The paper is concluded in Section VII.The proofs are deferred to the Appendix.

C. Notation
We use the following notation in the sequel: matrices, column vectors, scalars and sets are denoted by boldface upper-case letters (X), boldface lower-case letters (x), italic letters (x) and calligraphic upper-case letters (X ), respectively.The convex hull of X is denoted by conv(X ).I N ∈ R N ×N denotes the identity matrix, 0 M ×N ∈ R M ×N denotes the zero matrix and 1 N ∈ R N denotes the vector of ones.
The subscripts are omitted when the dimensions are clear from the context.e k denotes the k-th basis vector of the standard basis in R N .x 2 denotes the Euclidean norm of x, X 2 denotes the spectral norm of X, and X F denotes the Frobenious norm of X.The i-th element of the vector x is denoted by (x) i , and the element of the i-th row and j-th column of X is denoted by (X) ij .The covering number of X with d-metric balls of radius ρ is denoted by N (X ; d, ρ).

II. PROBLEM STATEMENT
We start by describing the GE in the framework of statistical learning.Then, we dwell on the GE bounds based on the robustness framework by Xu and Manor [32].Finally, we present the DNN architectures studied in this paper.

A. The Classification Problem and Its GE
We consider a classification problem, where we observe a vector x ∈ X ⊆ R N that has a corresponding class label y ∈ Y.The set X is called the input space, Y = {1, 2, . . ., N Y } is called the label space and N Y denotes the number of classes.The samples space is denoted by S = X × Y and an element of S is denoted by s = (x, y).We assume that samples from S are drawn according to a probability distribution P defined on S. A training set of m samples drawn from P is denoted by The goal of learning is to leverage the training set S m to find a classifier g(x) that provides a label estimate ŷ given the input vector x.In this work the classifier is a DNN, which is described in detail in Section II-C.
The quality of the classifier output is measured by the loss function (g(x), y), which measures the discrepancy between the true label y and the estimated label ŷ = g(x) provided by the classifier.Here we take the loss to be the 0-1 indicator function.Other losses such as the hinge loss or the categorical cross entropy loss are possible.The empirical loss of the classifier g(x) associated with the training set and the expected loss of the classifier g(x) are defined as and respectively.An important question, which occupies us throughout this work, is how well l emp (g) predicts l exp (g).The measure we use for quantifying the prediction quality is the difference between l exp (g) and l emp (g), which is called the generalization error:

B. The Algorithmic Robustness Framework
In order to provide bounds to the GE for DNN classifiers we leverage the robustness framework [32], which is described next.
The algorithmic robustness framework provides bounds for the GE based on the robustness of a learning algorithm that learns a classifier g leveraging the training set S m : March 1, 2022 DRAFT Definition 1 ( [32]).Let S m be a training set and S the sample space.A learning algorithm is (K, (S m ))robust if the sample space S can be partitioned into K disjoint sets denoted by K k , k = 1, . . ., K, such that for all s i ∈ S m and all s ∈ S Note that s i is an element of the training set and s is an arbitrary element of the sample space S.
Therefore, a robust learning algorithm chooses a classifier g for which the losses of any s and s i in the same partition K k are close.The following theorem provides the GE bound for robust algorithms. 1heorem 1 (Theorem 3 in [32]).If a learning algorithm is (K, (S m ))-robust and (g(x), y) ≤ M for all s = (x, y) ∈ S, then for any δ > 0, with probability at least 1 − δ, The first term in the GE bound in ( 8) is constant and depends on the training set S m .The second term behaves as O(1/ √ m) and vanishes as the size of the training set S m approaches infinity.M = 1 in the case of 0-1 loss, and K corresponds to the number of partitions of the samples space S.
A bound on the number of partitions K can be found by the covering number of the samples space S.
The covering number is the smallest number of (pseudo-)metric balls of radius ρ needed to cover S, and it is denoted by N (S; d, ρ), where d denotes the (pseudo-)metric. 2The space S is the Cartesian product of a continuous input space X and a discrete label space Y, and we can write where N Y corresponds to the number of classes.The choice of metric d determines how efficiently one may cover X .A common choice is the Euclidean metric which we also use in this paper.The covering number of many structured low-dimensional data models can be bounded in terms of their "intrinsic" properties, for example: • a Gaussian mixture model (GMM) with L Gaussians and covariance matrices of rank at most k leads to a covering number N (X ; d, ρ) = L(1 + 2/ρ) k [41]; • k-sparse signals in a dictionary with L atoms have a covering number N (X ; d, ρ) • C M regular k-dimensional manifold, where C M is a constant that captures its "intrinsic" properties, has a covering number N (X ; d, ρ) = CM ρ k [42].
1) Large Margin Classifier: An example of a robust learning algorithm is the large margin classifiers, which we consider in this work.The classification margin is defined as follows: Definition 2 (Classification margin).The classification margin of a training sample s i = (x i , y i ) measured by a metric d is defined as The classification margin of a training sample s i is the radius of the largest metric ball (induced by d) in X centered at x i that is contained in the decision region associated with class label y i .The robustness of large margin classifiers is given by the following Theorem.
Theorems 1 and 2 imply that the GE of a classifier with margin γ is upper bounded by (neglecting the Note that in case of a large margin classifier the constant (S m ) in ( 8) is equal to 0, and the GE approaches zero at a rate √ m as the number of training samples grows.The GE also increases sub-linearly with the number of classes N Y .Finally, the GE depends on the complexity of the input space X and the classification margin via the covering number N (X ; d, γ/2).
For example, if we take X to be a C M regular k-dimensional manifold then the upper bound to the GE behaves as: Fig. 1.DNN transforms the input vector x to the feature vector z by a series of (non-linear) transforms.
. Assume also that classifier g(x) achieves a classification margin γ and take (g(x i ), y i ) to be the 0-1 loss.Then for any δ > 0, with probability at least 1 − δ, Proof: The proof follows directly from Theorems 1 and 2.
Note that the role of the classifier is captured via the achieved classification margin γ.If we can always ensure a classification margin γ = 1, then the GE bound only depends on the dimension of the manifold k and the manifold constant C M .We relate this bound, in the context of DNNs, to other bounds in the literature in Section IV.

C. Deep Neural Network Classifier
The DNN classifier is defined as where where φ l (•, θ l ) represents the l-th layer with parameters θ l , l = 1, . . ., L. The output of the l-th layer is denoted by z l , i.e. z l = φ l (z l−1 , θ l ), z l ∈ R Ml ; the input layer corresponds to z 0 = x; and the output of the last layer is denoted by z = f (x).Such a DNN is visualized in Fig. 1.Next, we define various layers φ l (•, θ l ) that are used in the modern state-of-the-art DNNs.
1) Linear and Softmax Layers: We start by describing the last layer of a DNN that maps the output of previous layer into R NY , where N Y corresponds to the number of classes. 3This layer can be linear: where W L ∈ R NY ×ML−1 is the weight matrix associated with the last layer and b ∈ R NY is the bias vector associated with the last layer.Note that according to ( 14), the i-th row of W L can be interpreted as a normal to the hyperplane that separates class i from the others.If the last layer is linear the usual choice of learning objective is the hinge loss.
A more common choice for the last layer is the softmax layer: where ζ(•) is the softmax function and W L and b L are the same as in (16).Note that the exponential is applied element-wise.The elements of z are in range (0, 1) and are often interpreted as "probabilites" associated with the corresponding class labels.The decision boundary between class y 1 and class y 2 corresponds to the hyperplane {z : (z) y1 = (z) y2 }.The softmax layer is usually coupled with categorical cross-entropy training objective.
For the remainder of this work we will take the softmax layer as the last layer of DNN, but note that all results still apply if the linear layer is used.
2) Non-linear layers: A non-linear layer is defined as where [ẑ l ] σ represents the element-wise non-linearity applied to each element of ẑl ∈ R Ml , and ẑl represents the linear transformation of the layer input: is the weight matrix and b l ∈ R Ml is the bias vector.The typical non-linearities are the ReLU, the sigmoid and the hyperbolic tangent.They are listed in Table I.The choice of non-linearity σ is usually the same for all the layers in the network.
Note that the non-linear layer in (18) includes the convolutional layers which are used in the convolutional neural networks.In that case the weight matrix is block-cyclic.3) Pooling layers: A pooling layer reduces the dimension of intermediate representation and is defined as where P l (z l−1 ) is the pooling matrix.The usual choices of pooling are down-sampling, max-pooling and average pooling.We denote by p l i (z l−1 ) the i-th row of P l (z l−1 ) and assume that there are M l pooling regions P i , i = 1, . . ., M l .In the case of down-sampling p l i (z l−1 ) = e Pi(1) , where P i (1) is the first element of the pooling region P i ; in the case of max-pooling p l i (z l−1 ) = e j , where j = arg max j ∈Pi |(z l−1 ) j |; and in the case of average pooling p l i (z l−1 ) = 1 |Pi| j∈Pi e j .

III. THE GEOMETRICAL PROPERTIES OF DEEP NEURAL NETWORKS
The classification margin introduced in Section II-A is a function of the decision boundary in the input space.This is visualized in Fig. 2 (a).However, a training algorithm usually optimizes the decision boundary at the network output (Fig. 2 (b)), which does not necessarily imply a large classification margin.
In this section we introduce a general approach that allows us to bound the expansion of distances between the network input and its output.In Section IV we use this to establish bounds of the classification margin and the GE bounds that are independent of the network depth or width.
We start by defining the Jacobian matrix (JM) of the DNN f (x): Note that by the properties of the chain rule, the JM is computed as the product of the JMs of the individual network layers, evaluated at the appropriate values of the layer inputs x, z 1 , . . ., z L−1 .We use the JM to establish a relation between a pair of vectors in the input space and the output space.
Theorem 3.For any x, x ∈ X and a DNN f (•), we have where is the average Jacobian on the line segment between x and x .
Proof: The proof appears in Appendix A.
As a direct consequence of Theorem 3 we can bound the distance expansion between x and x at the output of the network f (•): Corollary 2. For any x, x ∈ X and a DNN f (•), we have Proof: The proof appears in Appendix B.
Note that we have established that J x,x corresponds to a linear operator that maps the vector x − x to the vector f (x ) − f (x).This implies that the maximum distance expansion of the network f (x) is bounded by the maximum spectral norm of the network's JM.Moreover, the JM of f (x) corresponds to the product of JMs of all the layers of f (x) as shown in (20).It is possible to calculate the JMs of all the layers defined in Section II-C: 1) Jacobian Matrix of Linear and Softmax Layers: The JM of the linear layer defined in ( 16) is equal to the weight matrix Similarly, in the case of softmax layer defined in (17) the JM is 2) Jacobian Matrix of Non-Linear Layers: The JM of the non-linear layer ( 18) can be derived in the same way as the JM of the softmax layer.We first define the JM of the point-wise non-linearity, which is The derivatives associated with various non-linearities are provided in Table I.The JM of the non-linear layer can be expressed as 3) Jacobian Matrix of Pooling Layers: The pooling operator defined in ( 19) is linear or a piece-wise linear operator.The corresponding JM is therefore also linear or piece-wise linear and is equal to: The following Lemma collects the bounds on the spectral norm of the JMs for all the layers defined in Section II-C.
Lemma 1.The following statements hold: 1) The spectral norm of JMs of the linear layer in (16), the softmax layer in (17) and non-linear layer in (18) with the ReLU, Sigmoid or Hyperbolic tangent non-linearities is upper bounded by 2) Assume that the pooling regions of the down-sampling, max-pooling and average pooling operators are non-overlapping.Then the spectral norm of their JMs can be upper bounded by Proof: The proof appears in Appendix C.
Lemma 1 shows that the spectral norms of all layers can be bounded in terms of their weight matrices.
As a consequence, the spectral norm of the JM is bounded by the product of the spectral norms of the weight matrices.We leverage this facts to provide GE bounds in the next section.
subgradients) to define the JM.We avoid this technical complication and simply take the derivative of max(x, 0) to be 0 when x = 0. Note that this does not change the results in any way because the subset of X for which the derivatives are not defined has zero measure.
We also briefly explore a relationship between the Jacobian matrix and the Fisher information matrix.
To simplify the derivations we assume M = 1, N = 1, x = x + θn and n ∼ N (0, 1), where θ is the model parameter and x is deterministic.The Fisher information F (θ) measures how much information about the parameter θ is contained in the random variable y = f (x ), where f represents a DNN.In this particular case the Fisher information is given as In our setup the parameter θ can be interpreted as a magnitude of the input perturbation.It is clear from (32) that a small norm of the Jacobian matrix leads to a small Fisher information, which indicates that the distribution of y is not very informative about the parameters θ.By ensuring that the norm of the Jacobian is small we then naturally endow the network with robustness against perturbations of the input.

IV. GENERALIZATION ERROR OF A DEEP NEURAL NETWORK CLASSIFIER
In this section we provide the classification margin bounds for DNN classifiers that allow us to bound the GE.We follow the common practice and assume that the networks are trained by a loss that promotes separation of different classes at the network output, e.g.categorical cross entropy loss or the hinge loss.
In other words, the training aims at maximizing the score of each training sample, where the score is defined as follows.
Definition 3 (Score).Take score of a training sample where δ i ∈ R NY is the Kronecker delta vector with Recall the definition of the classifier g(x) in ( 14) and note that the decision boundary between class i and class j in the feature space Z is given by the hyperplane {z : (z) i = (z j )}.A positive score indicates that at the network output, classes are separated by a margin that corresponds to the score.However, a large score o(s i ) does not necessarily imply a large classification margin γ d (s i ).Theorem 4 provides classification margin bounds expressed as a function of the score and the properties of the network.
Theorem 4. Assume that a DNN classifier g(x), as defined in (14), classifies a training sample x i with the score o(s i ) > 0. Then the classification margin can be bounded as where W is the set of all weight matrices of f (x).
Proof: The proof appears in Appendix D.
Given the bounds of the classification margin we can specialize Corollary 1 to DNN classifiers.
. Assume also that DNN classifier g(x) achieves a lower bound to the classification margin , ∀s i ∈ S m and take (g(x i ), y i ) to be the 0-1 loss.Then for any δ > 0, with probability at least 1 − δ, Proof: The proof follows from Theorems 1, 2 and 4.
Corollary 3 suggests that the GE will be bounded by C 1 , provided that the classification margin bounds satisfy γ d b (s i ) > γ for some b ∈ {1, 2, 3, 4}, ∀s i ∈ S m .We now leverage the classification margin bounds in Theorem 4 to construct constraint sets . Using ( 34)-( 37) we obtain Note that while we want to maximize the score o(s i ), we also need to constrain the network's Jacobian ).We can not compute the margin γ d (s i ), but can still obtain a rationale for regularization: as long as the spectral norm of the Jacobian matrix is bounded in the neighbourhood of a training sample x i given by N i we will have the GE guarantees.
• The constraint on the Jacobian matrix 40) is more restrictive as it requires bounded spectral norm for all samples x in the convex hull of the input space X .
• The constraints in ( 41) and ( 42) are of similar form, Wl∈W W l 2 < γ•o(s i ) and Wl∈W W l F < γ • o(s i ), respectively.Note that the weight decay, which aims at bounding the Frobenious norms of the weight matrices might be used to satisfy the constrains in (42).However, note also that the bound based on the spectral norm in ( 41) is tighter than one based on the Frobenious norm in (42).
For example, take W l ∈ W to have orthonormal rows and be of dimension M × M .Then the constraint in (41), which is based on the spectral norm, is of the form 1 < γo(s i ) and the constraint in (42), which is based on the Frobenious norm, is M L/2 < γo(s i ).In the former case we have a constraint on the score, which is independent of the network width or depth.In the latter the constraint on the output score is exponential in network depth and polynomial in network width.The difference is that the Frobenious norm does not take into account the correlation (angles) between the rows of the weight matrix W l , while the spectral norm does.Therefore, the bound based on the Frobenious norm corresponds to the worst case when all the rows of W l are aligned.In that case Remark 1.To put results into perspective we compare our GE bounds to the GE bounds based on the Rademacher complexity in [33], which hold for DNNs with ReLUs.The work in [33] shows that if and the energy of training samples is bounded then: Although the bounds (38) and (44) are not directly comparable, since the bounds based on the robustness framework rely on an underlying assumption on the data (covering number), there is still a remarkable difference between them.The behaviour in (44) suggests that the GE grows exponentially with the network depth even if the product of the Frobenious norms of all the weight matrices is fixed, which is due to the term 2 L .The bound in (34) and the constraint sets in (39)- (42), on the other hand, imply that the GE does not increase with the number of layers provided that the spectral/Frobenious norms of the weight matrices are bounded.Moreover, if we take the DNN to have weight matrices with orthonormal rows then the GE behaves as , and therefore relies only on the complexity of the underlying data manifold and not on the network depth.This provides a possible answer to the open question of [33] that depth independent capacity control is possible in DNNs with ReLUs.
Remark 2. An important value of our bounds is that they provide an additional explanation to the success of state-of-the-art DNN training techniques such as batch normalization [23] and eight normalization [24].
Weight normalized DNNs have weight matrices with normalized rows, i.e.
where diag(•) denotes the diagonal part of the matrix.While the main motivation for this method is a faster training, the authors also show empirically that such networks achieve good generalization.
Note that for row-normalized weight matrices W l F = √ M l and therefore the bounds based on the Frobenious norm can not explain the good generalization of such networks as adding layers or making W l larger will lead to a larger GE bound.However, our bound in (34) and the constraint sets in (39)- (41) show that a small Frobenious norm of the weight matrices is not crucial for a small GE.A supporting experiment is presented in Section VI-A2.
We also note that batch normalization also leads to row-normalized weight matrices in DNNs with ReLUs: 5 Theorem 5. Assume that the non-linear layers of a DNN with ReLUs are batch normalized as: where σ denotes the ReLU non-linearity and is the normalization matrix.Then all the weight matrices are row normalized.The exception is the weight matrix of the last layer, which is of the form N({z The proof appears in Appendix E.

A. Jacobian Regularizer
The constraint set (39) suggests that we can regularize the DNN by bounding the norm of the network's JM for the inputs close to x i .Therefore, we propose to penalize the norm of the network's JM evaluated at each training sample x i , The implementation of such regularizer requires computation of its gradients or subgradients.In this case the computation of the subgradient of the spectral norm requires the calculation of a SVD decomposition [44], which makes the proposed regularizer inefficient.To circumvent this, we propose a surrogate regularizer based on the Frobenious norm of the Jacobian matrix: 5 To simplify the derivation we omit the bias vectors and therefore also the centering applied by the batch normalization.This does not affect the generality of the result.We also follow [43] and omit the batch normalization scaling, as it can be included into the weight matrix of the layer following the batch normalization.We also omit the regularization term and assume that the matrices are invertible.
Note that the Frobenious norm and the spectral norm are related as follows: F , which justifies using the surrogate regularizer.We will refer to R F (W) as the Jacobian regularizer.

1) Computation of Gradients and Efficient Implementation:
Note that the k-th row of J(x i ) corresponds to the gradient of (f (x)) k with respect to the input x evaluated at x i .It is denoted by As the regularizer will be minimized by a gradient descent algorithm we need to compute its gradient with respect to the DNN parameters.First, we express g k (x i ) as where is the gradient of (f (x)) k with respect to ẑl evaluated at the input x i and J l−1 (x i ) = dz l−1 dx | x=xi is the JM of l − 1-th layer output z l−1 evaluated at the input x i .The gradient of g k (x i )g k (x i ) T with respcet to W l is then given as [45] The computation of the gradient of the regularizer at layer l requires the computation of gradients g l k (x i ), k = 1, . . ., M , i = 1, . . ., m and the computation of the Jacobian matrices J l−1 (x i ), i = 1, . . ., m.The computation of the gradient of a typical loss used for training DNN usually involves a computation of m gradients with computational complexity similar to the computational complexity of g l k (x i ).Therefore, the computation of gradients required for an implementation of the Jacobian regularizer can be very expensive.
To avoid excessive computational complexity we propose a simplified version of the regularizer (49), which we name per-layer Jacobian regularizer.The per-layer Jacobian regularizer at layer l is defined as where gl−1 and π(i) ∈ {1, . . ., M } is a random index.Compared to (49) we have made two simplifications.First, we assumed that input of layer l is fixed.This way we do not need to compute the JM J l−1 (x i ) between the output of the layer l − 1 and the input.Second, by choosing only one index π(i) per training sample we have to compute only one additional gradient per training sample.This significantly reduces the computational complexity.The gradient of gl−1 We demonstrate the effectiveness of this regularizers in Section VI.

V. DISCUSSION
In the preceding sections we analysed the standard feed-forward DNNs and their classification margin measured in the Euclidean norm.We now briefly discuss how our results extend to other DNN architectures and different margin metrics.

A. Beyond Feed Forward DNN
There are various DNN architectures such as Residual Networks (ResNets) [4], [46], Recurrent Neural Networks (RNNs) and Long Short-Term Memory (LSTM) networks [47], and Auto-encoders [48] that are used frequently in practice.It turns out that our analysis -which is based on the network's JM -can also be easily extended to such DNN architectures.In fact, the proposed framework encompasses all DNN architectures for which the JM can be computed.Below we compute the JM of a ResNet.
The ResNets introduce shortcut connection between layers.In particular, let φ(•, θ l ) denote a concatenation of several non-linear layers (see (18)).The l-th block of a Residual Network is then given as We denote by J l (z l−1 ) the JM of φ(z l−1 , θ l ).Then the JM of the l-th block is and the JM of a ResNet is of the form where J SM (z L−1 ) denotes the JM of the soft-max layer.In particular, the right element of the product in (55) can be expanded as This is a sum of JMs of all the possible sub-networks of a ResNet.In particular, there are L elements of the sum consiting only of one 1-layer sub-networks and there is only one element of the sum consisting of L-layer sub-network.This observation is consistent with the claims in [49], which states that ResNets resemble an ensemble of relatively shallow networks.

B. Beyond the Euclidean Metric
Moreover, we can also consider the geodesic distance on a manifold as a measure for margin instead of the Euclidean distance.The geodesic distance can be more appropriate than the Euclidean distance since it is a natural metric on the manifold.Moreover, the covering number of the manifold X may be smaller if we use the covering based on the geodesic metric balls, which will lead to tighter GE bounds.
We outline the approach below.
Assume that X is a Riemannian manifold and x, x ∈ X .Take a continuous, piecewise continuously The set of all such curves c(•) is denoted by C. Then the geodesic distance between x and x is defined as Similarly as in Section III, we can show that the JM of DNN is central to bounding the distance expansion between the signals at the DNN input and the signals at the DNN output.
Theorem 6.Take x, x ∈ X , where X is the Riemmanian manifold and take c(t), t = [0, 1] to be a continuous, piecewise continuously differentiable curve connecting x and x such that Proof: The proof appears in Appendix F.
Note that we have established a relationship between the Euclidean distance of two points in the output space and the corresponding geodesic distance in the input space.This is important because it implies that promoting a large Euclidean distance between points can lead to a large geodesic distance between the points in the input space.Moreover, the ratio between f (x ) − f (x) 2 and d G (x, x ) is upper bounded by the maximum value of the spectral norm of the network's JM evaluated on the line c(t).This result is analogous to the results of Theorem 3 and Corollary 2. It also implies that regularizing the network's JM as proposed in Section IV is beneficial also in the case when the classification margin is not measured in the Euclidean metric.
Finally, note that in practice the training data may not be balanced.The provided GE bounds are still valid in such cases.However, the classification error may not the best measure of performance in such cases as it is dominated by the classification error of the class with the highest prior probability.Therefore, alternative performance measures need to be considered.We leave a detailed study of training DNN with unbalanced training sets for possible future work.

VI. EXPERIMENTS
We now validate the theory with a series of experiments on the MNIST [50], CIFAR-10 [51], LaRED [52] and ImageNet (ILSVRC2012) [53] datasets.The Jacobian regularizer is applied to various DNN architectures such as DNN with fully connected layers, convolutional DNN and ResNet [4].We use the ReLUs in all considered DNNs as this is currently the most popular non-linearity.

A. Fully Connected DNN
In this section we compare the performance of fully connected DNNs regularized with Jacobian Regularization or with the weight decay.Then we analyse the behaviour of the JM of a fully connected DNNs of various depth and width.on the margin bound in (37) and the bound in (44), which leverage the Frobenious norms of the weight matrices, predict that the GE will increase with the network depth and weight matrix size in this scenario.
Therefore, the experiment indicates that these bounds are too pessimistic.
We have also inspected the spectral norms of the weight matrices of the trained networks.In all cases the spectral norms were greater than one.We can argue that the bound in (38) based on the margin bound in (36) predicts that the GE will increase with network depth, as the product of the spectral norms grows with the network depth in a similar way than in previous paragraph.We note however, that the spectral norms of the weight matrices are much smaller than the Frobenious norms of the weight matrices.
Finally, we look for a possible explanation for the success of the weight normalization in the bounds in (38) based on the margin bounds in ( 34) and (35), which are a function on the JM.The largest value of the spectral norm of the network's JM evaluated on the training set is shown in Fig. 4 (c) and the largest value of the spectral norm of the network's JM evaluated on the testing set is shown in Fig. 4 (d).
We can observe an interesting phenomena.The maximum value of the JM's spectral norm on the training set decreases with the network depth and width.On the other hand, the maximum value of the JM's spectral norm on the testing set increases with network depth (and slightly with network width).
From the perspective of the constraint sets in ( 39) and ( 40) we note that in the case of the latter we have to take into account the worst case spectral norm of the JM for inputs in conv(X ).The maximum value of the spectral norm on the testing set indicates that this value increases with the network depth and implies that the bound based on ( 35) is still loose.On the other hand, the bound in (34) implies that we have to consider the JM in the neighbourhood of the training samples.As an approximation, we can take the spectral norms of the JMs evaluated at the training set.As it is shown in Fig. 4 (c) this values decrease with the network depth and width.We argue that this provides a reasonable explanation for the good generalization of deeper and wider weight normalized DNNs.

B. Convolutional DNN
In this section we compare the performance of convolutional DNNs regularized with the Jacobian regularizer or with the weight decay.We also show that Jacobian Regularization can be applied to batch normalized DNNs.We will use the standard MNIST and CIFAR-10 dataset and the LaRED dateset which is briefly described below.
The LaRED dataset contains depth images of 81 distinct hand gestures performed by 10 subjects with approximately 300 images of each gesture per subject.We extracted the depth images of the hands using the masks provided in [52] and resized the images to 32 × 32.The images of the first 6 subjects were used to create non-overlapping training and testing sets.In addition we also constructed a testing set composed from the images of the last 4 subjects in the dataset in order to test generalization across different subjects.The goal is classification of gestures based on the depth image.II.We observe that training with the Jacobian regularization outperforms the weight decay in all cases.This is most obvious at smaller training set sizes.For example, on the MNIST dataset, the DNN trained using 1000 training samples and regularized with the weight decay achieves classification accuracy of 94% and the DNN trained with the Jacobian regularization achieves classification accuracy of 96.3%.
Similarly, on the LaRED dataset the Jacobian regularization outperforms the weight decay with the difference most obvious at the smallest number of training samples.Note also that the generalization of the network to the subjects outside the training set is not very good; i.e., using 50000 training samples the classification accuracy on the testing set containing the same subjects is higher than 97% whereas the classification accuracy on the testing set containing different subjects is only 46%.Nevertheless, the Jacobian regularization outperforms the weight decay also on this testing set by a small margin.
2) Batch Normalization and Jacobian Regularization: Now we show that the Jacobian regularization (49) can also be applied to a batch normalized DNN.Note that we have shown in Section IV that the batch normalization has an effect of normalizing the rows of the weight matrices.
We us the CIFAR-10 dataset and use the All-convolutional-DNN proposed in [54] (All-CNN-C) with 9 convolutional layers, an average pooling layer and a softmax layer.All the convolutional layers are batch normalized and the softmax layer is weight normalized.The networks were trained using the stochastic gradient descent (SGD) with momentum, which was set to 0.9.Batch size was set to 64 and the learning rate was set to 0.1 and reduced by a factor 10 after every 25 epochs.The networks were trained for 75 epochs in total.The classification accuracy results are presented in Table III for different sizes of training sets (2500, 10000, 50000).
We can observe that the Jacobian regularization also leads to a smaller GE in this case.

C. Residual Networks
Now we demonstrate that the Jacobian regularizer is also effective when applied to ResNets.We use the CIFAR-10 and ImageNet datasets.We use the per-layer Jacobian regularization (52) for experiments in this section.
1) CIFAR-10: The Wide ResNet architecture proposed in [35], which follows [46], but proposes wider and shallower networks which leads to the same or better performance than deeper and thinner networks is used here.In particular, we use the ResNet with 22 layers of width 5.
We follow the data normalization process of [35].We also follow the training procedure of [35] except for the learning rate and use the learning rate sequence: (0.01, 5), (0.05, 20), (0.005, 40), (0.0005, 40), (0.00005, 20), where the first number in parenthesis corresponds to the learning rate and the second training samples) without augmentation and on the full training set with the data augmentation as in [35].
The regularization factor were set to 1 and 0.1 for the smaller training sets (2500 and 10000) and the full augmented training set, respectively.
The results are presented in Table IV.In all cases the ResNet with Jacobian regularization outperforms the standard ResNet.The effect of regularization is the strongest with the smaller number of training samples, as expected.
The images in the dataset are resized to 128 × 128.We run an experiment without data augmentation and with data augmentation following [1], which includes random cropping of images of size 112 × 112 from the original image and color augmentation.The classification accuracies during training are shown in Fig. 5 and the final results are reported in Table V.
We first focus on training without data augmentation.The ResNet trained using the Jacobian regularization has a much smaller GE (23.83%) compared to the baseline ResNet (61.53%).This again demonstrates that the Jacobian regularization decreases the GE, as our theory predicts.Note that the smaller GE of Jacobian regularized ResNet partially transfers to a higher classification accuracy on the testing set.However, in practice DNNs are often trained with data augmentation.In this case the GE of a baseline ResNet is much lower (13.14%) and is very close to the GE of the ResNet with the Jacobian regularization (12.03%).
It is clear that data augmentation reduces the need for strong regularization.Nevertheless, note that the ResNet trained with the Jacobian regularization achieves a slightly higher testing set accuracy (47.51%) compared to the baseline ResNet (46.75%).We can observe that using the Jacobian regularizer in (49) introduces additional computational time.
This may not be critical if the number of training samples is small and training computational time is not too critical.On the other hand, the per-layer Jacobian regularizer in (52) has a much smaller cost.As shown in the experiments this regularizer is still effective and leads to only 58% increase in computation time on the ImageNet dataset.Due to its efficiency the per-layer Jacobian regularizer might be more appropriate for large scale experiments where computational time is important.

VII. CONCLUSION
This paper studies the GE of DNNs based on their classification margin.In particular, our bounds express the generalization error as a function of the classification margin, which is bounded in terms of the achieved separation between the training samples at the network output and the network's JM.
One of the hallmarks of our bounds relates to the fact that the characterization of the behaviour of the generalization error is tighter than that associated with other bounds in the literature.Our bounds predict that the generalization error of deep neural networks can be independent of their depth and size whereas other bounds say that the generalization error is exponential in the network width or size.
Our bounds also suggest new regularization strategies such as the regularization of the network's Jacobian matrix, which can be applied on top of other modern DNN training strategies such as the weight normalization and the batch normalization, where the standard weight decay can not be applied.These regularization strategies are especially effective in the limited training data regime in comparison to other approaches, with moderate increase in computational complexity.

A. Proof of Theorem 3
We first note that the line between x and x is given by x + t(x − x), t ∈ [0, 1] .We define the function F (t) = f (x + t(x − x)), and observe that dF This concludes the proof.

B. Proof of Corollary 2
First note that J x,x (x − x) 2 ≤ J x,x 2 x − x 2 and that J x,x is an integral of J(x + t(x − x)).

C. Proof of Lemma 1
In all proofs we leverage the fact that for any two matrices A, B of appropriate dimensions it holds We also leverage the bound A 2 ≤ A F .
We start with the proof of statement 1).For the non-linear layer (18), we note that the JM is a product of a diagonal matrix (27) and the weight matrix W l .Note that for all the considered non-linearities the diagonal elements of ( 27) are bounded by 1 (see derivatives in Table I), which implies that the spectral norm of this matrix is bounded by 1. Therefore the spectral norm of the JM is upper bounded by W l 2 .
The proof for the linear layer is trivial.In the case of the softmax layer (17)  The proof of statement 2) is straightforward.Because the pooling regions are non-overlapping it is straightforward to verify that the rows of all the defined pooling operators P l (z l−1 ) are orthonormal.
Therefore, the spectral norm of the JM is equal to 1.

D. Proof of Theorem 4
Throughout the proof we will use the notation o(s i ) = o(x i , y i ) and v ij = √ 2(δ i − δ j ).We start by proving the inequality in (34).Assume that the classification margin γ d (s i ) of training sample (x i , y i ) is given and take j = arg min j =yi min v T yij f (x i ).We then take a point x that lies on the decision boundary between y i and j such that o(x , y i ) = 0. Then Note that by the choice of x , x i −x 2 = γ d (s i ) and similarly J xi,x 2 ≤ sup x: x−xi 2≤γ d (si) J(x) 2 .
Next, we prove (35).Recall the definition of the classification margin in (10): where we leverage the definition in (33).We observe o(x, y i ) > 0 ⇐⇒ min j =yi v T yij f (x) > 0 and Note that ≥ min = o(x i , y i ) + min Therefore, o(x i , y i ) + min This leads to the bound of the classification margin γ d (s i ) ≥ sup{a :

Note now that
o(x i , y i ) + min Moreover, where we have leveraged the fact that v ij 2 = 1 and the inequality (24) in Corollary 2. We may write γ d (s i ) ≥ sup{a : a that attains the supremum can be obtain easily and we get: which proves (35).The bounds in (36) and (37) follow from the bounds provided in Lemma 1 and the fact that the spectral norm of a matrix product is upper bounded by the product of the spectral norms.
This concludes the proof.

E. Proof of Theorem 5
We denote by W N l the row normalized matrix obtained from W l (in the same way as (45)).By noting that the ReLU and diagonal non-negative matrices commute, it is straight forward to verify that Note now that we can consider N({z l i } m i=1 , W N l ) as the part of the weight matrix W l+1 .Therefore, we can conclude that layer l has row normalized weight matrix.When the batch normalization is applied to layers, all the weight matrices will be row normalized.The exception is the weight matrix of the last layer, which will be of the form N({z L−1 i } m i=1 , W L )W L .

F. Proof of Theorem 6
We begin by noting that f where the first equality follows from the generalized fundamental theorem of calculus, following the idea presented in the proof of Theorem 3. The second equality follows from the chain rule of differentiation.
Finally, we note that df (c(t)) c(t) = J(c(t)) and that the norm of the integral is always smaller or equal to the integral of the norm and obtain where we have noted that

Fig. 2 .
Fig. 2. Decision boundaries in the input space and in the output space.Plot (a) shows samples of class 1 and 2 and the decision regions produced by a two-layer network projected into the input space.Plot (b) shows the samples transformed by the network and the corresponding decision boundary at the network output.
matrix J(x) (following W 1 and W 2 ) or the weight matrices W l ∈ W (following W 3 and W 4 ).This stands in line with the common training rationale of DNN in which we do not only aim at maximizing the score of the training samples to ensure a correct classification of the training set, but also have a regularization that constrains the network parameters, where this combination eventually leads to a lower GE.The constraint sets in (39)-(42) impose different regularization techniques: • The term sup x: x−xi 2≤γ d (si) J(x) 2 < γ • o(s i ) in (39) considers only the supremum of the spectral norm of the Jacobian matrix evaluated at the points within N i = {x : x − x i 2 ≤ γ d (s i )}, where γ d (s i ) is the classification margin of training sample s i (see Definition 2

1 ) 2 )
Comparison of Jacobian Regularization and Weight Decay: First, we compare standard DNN with fully connected layers trained with the weight decay and the Jacobian regularization(49) on the MNIST and CIFAR-10 datasets.Different number of training samples are used(5000, 20000, 50000).We consider DNNs with 2, 3 and 4 fully connected layers where all layers, except the last one, have dimension equal to the input signal dimension, which is 784 in case of MNIST and 3072 in case of CIFAR-10.The last layer is always the softmax layer and the objective is the CEE loss.The networks were trained using the stochastic gradient descent (SGD) with momentum, which was set to 0.9.Batch size was set to 128 and learning rate was set to 0.01 and reduced by factor 10 after every 40 epochs.The networks were trained for 120 epochs in total.The weight decay and the Jacobian regularization factors were chosen on a separate validation set.The experiments were repeated with the same regularization parameters on 5 random draws of training sets and weight matrix initializations.Classification accuracies averaged over different experimental runs are shown in Fig.3.We observe that the proposed Jacobian regularization always outperforms the weight decay.This validates our theoretical results in Section IV, which predict that the Jacobian matrix is crucial for the control of (the bound to) the GE.Interestingly, in the case of MNIST, a 4 layer DNN trained with 20000 training samples and Jacobian regularization (solid blue line if Fig. 3 (a)) performs on par with DNN trained with 50000 training samples and weight decay (dashed black line Fig. 3 (a)), which means that the Jacobian regularization can lead to the same performance with significantly less training samples.Analysis of Weight Normalized Deep Neural Networks: Next, we explore weight normalized DNNs, which are described in Section IV.We use the MNIST dataset and train DNNs with a different number of fully connected layers (L = 2, 3, 4, 5) and different sizes of weight matrices (M l = 784, 2 • 784, 3 • 784, 4 • 784, 5 • 784, 6 • 784, l = 1, . . ., L − 1).The last layer is always the softmax layer and the objective is the CCE loss.The networks were trained using the stochastic gradient descent (SGD) with momentum, which was set to 0.9.Batch size was set to 128 and learning rate was set to 0.1 and reduced by factor 10 after every 40 epochs.The networks were trained for 120 epochs in total.All experiments are repeated 5 times with different random draws of a training set and different random weight initializations.We did not employ any additional regularization as our goal here is to explore the effects of the weight normalization on the DNN behaviour.We always use 5000 training samples.The classification accuracies are shown in Fig. 4 (a) and the smallest classification score obtained on the training set is shown in Fig. 4 (b).We have observed for all configurations that the training accuracies were 100% (only exception is the case L = 2, M l = 784 where the training accuracy was 99.6%).Therefore, the (testing set) classification accuracies increasing with the network depth and the weight matrix size directly imply that the GE is smaller for deeper and wider DNNs.Note also that the score increases with the network depth and width.This is most obvious for the 2 and 3 layer DNNs, whereas for the 3 and 4 layer DNNs the score is close to √ 2 for all network widths.Since the DNNs are weight normalized, the Frobenious norms of the weight matrices are equal to the square root of the weight matrix dimension, and the product of Frobenious norms of the weight matrices grows with the network depth and the weight matrix size.The increase of score with the network depth and network width does not offset the product of Frobenious norms, and clearly, the bound in (38) based

1 )
Comparison of Jacobian Regularization and Weight Decay: We use a 4 layer convolutional DNN with the following architecture: (32, 5, 5)-conv, (2, 2)-max-pool, (32, 5, 5)-conv, (2, 2)-max-pool followed by a softmax layer, where (k, u, v)-conv denotes the convolutional layer with k filters of size u × v and (p, p)-max-pool denotes max-pooling with pooling regions of size p × p.The training procedure follows the one described in the previous paragraphs.The results are reported in Table Smallest o(si) (training set).

Fig. 4 .
Fig. 4. Weight normalized DNN with L = 2, 3, 4, 5 layers and different sizes of weight matrices (layer width).Plot (a) shows classification accuracy, plot (b) shows the smallest score of training samples, plot (c) shows the largest spectral norm of the network's JM evaluated on the training set and plot (d) shows the largest spectral norm of the network's JM evaluated on the testing set.

Fig. 5 .
Fig. 5. Training set (dashed) and testing set (solid) classification accuracies during training.Blue curves correspond to the ResNet with Jacobian regularization and red curves correspond to the baseline ResNet.Top-1 and top-5 classification accuracies are reported for training without data augmentation (a,b) and for training with data augmentation (c,d).

TABLE II CLASSIFICATION
ACC. [%] OF CONVOLUTIONAL DNN ON MINST AND LARED.

Table VI .
Note that in the case of MNIST the regularizer in (49)is used and in the case of ImageNet the per-layer regularizer in (52) is used.These results are also representative of the other datasets and network architectures.