Diverse Neural Network Learns True Target Functions
Bo Xie, Yingyu Liang, Le Song
Introduction
Neural networks are a powerful class of nonlinear functions which have been successfully deployed in a variety of machine learning tasks. In the simplest form, neural networks with one hidden layer are linear combinations of nonlinear basis functions (units),
where is a basis function with weights , and is the corresponding combination coefficient. Learning with neural networks involves adapting both the combination coefficients and the basis functions at the same time, usually by minimizing the empirical loss
with first-order methods such as (stochastic) gradient descent. It is believed that basis function adaptation is a crucial ingredient for neural networks to achieve more compact models and better performance [Barron, 1993, Yang et al., 2014].
However, the empirical loss minimization problem involved in neural network training is non-convex with potentially numerous local minima and saddle points. This makes formal analysis of training neural networks very challenging. Given the empirical success of neural networks, a sequence of important and urgent scientific questions need to be investigated: Can neural networks corresponding to stationary points of the empirical loss learn the true target function? If the answer is yes, then what are the key factors contributing to their nice optimization properties? Based on these understandings, can we design better regularization schemes and learning algorithms to improve the training of neural networks?
In this paper, we provide partial answers to these questions by analyzing one-hidden-layer neural networks with rectified linear units (ReLU) in a least-squares regression setting. We show that neural networks with diverse units have no spurious local minima. More specifically, we show that the training loss of neural networks decreases in proportion to where is the gradient and is the minimum singular value of the extended feature matrix (defined in Section 3.1). The minimum singular value is lower bounded by two terms, where the first term is related to the spectrum property of the kernel function associate with the activation , and the second term quantifies the diversity of the units, measured by the classical notion of geometric discrepancy of a set of vectors. Essentially, the slower the decay of the spectrum, the better the optimization landscape; the more diverse the unit weights, the more likely stationary points will result in small training loss and generalization error.
We bypass the hurdle of non-convexity by directly analyzing the first order optimality condition of the learning problem, which implies that there are no spurious local minima if the minimum singular value of the extended feature matrix is large enough. Bounding the singular value is challenging because it entangles the nonlinear activation function, the weights and data in a complicated way. Unlike most previous attempts, we directly analyze the effect of nonlinearity without assuming independence of the activation patterns from actual data; in fact, the dependence of the patterns on the data and the unit weights underlies the key connection to activation kernel spectrum and the diversity of the units.
We have constructed a novel proof, which makes use of techniques from geometric discrepancy and kernel methods, and have identified a new relation linking the smallest singular value to the diversity of the units and the spectrum of a kernel function associated with the unit. More specifically,
We identify and separate two factors in the minimum singular value: 1) an ideal spectrum that is related to the kernel of the activation function and an ideal configuration of diverse unit weights; 2) deviation from the ideal spectrum measured by how far away actual unit weights are from the diverse configuration. This new perspective reveals benign conditions in learning neural networks.
We characterize the deviation from the ideal diverse weight configuration using the concept of discrepancy, which has been extensively studied in the geometric discrepancy theory. This reveals an interesting connection between the discrepancy of the weights and the training loss of neural networks. Therefore, it serves as a clean tool to analyze and verify the learning and the generalization ability of the networks.
Our results also suggest a novel regularization scheme to promote unit diversity for potentially better generalization. In [MarSra15], it is shown that diversity of the neurons leads to smaller network size and better performance.
Whenever possible, we corroborate our theoretical analysis with numerical simulations. These numerical results include computing and verifying the relationship between the discrepancy of a learned neural network and the minimum singular value. Additionally, we measure the effects on the discrepancy with and without regularization. In all these examples, the experiments match with the theory nicely and they accord with the practice of using gradient descent to learn neural networks.
Related work
Kernel methods have many commonalities with one-hidden-layer neural networks. The random feature perspective [Rahimi and Recht, 2009, Cho and Saul, 2009] views kernels as linear combinations of nonlinear basis functions, similar to neural networks. The difference between the two is that the weights are random in kernels while in neural networks they are learned. Using learned weights leads to considerable smaller models as shown in [Barron, 1993]. However it is a non-convex problem and it is difficult to find the global optima. e.g., one-hidden-layer networks are NP-complete to learn in the worst case [Blum and Rivest, 1993]. We will make novel use of techniques from kernel methods to analyze learning in neural networks.
The empirical success of training neural networks with simple algorithms such as gradient descent has motivated researchers to explain their surprising effectiveness. In [Choromanska et al., 2015], the authors analyze the loss surface of a special random neural network through spin-glass theory and show that for many large-size networks, there is a band of exponentially many local optima, whose loss is small and close to that of a global optimum. The analyzed polynomial network is different from the actual neural network being used which typically contains ReLU nowadays. Moreover, the analysis does not lead to a generalization guarantee for the learned neural network.
A similar work shows that all local optima are also global optima in linear neural networks [Kawaguchi, 2016]. However their analysis for nonlinear neural networks hinges on independence of the activation patterns from the actual data, which is unrealistic. Some other works try to argue that gradient descent is not trapped in saddle points [Lee et al., 2016, Ge et al., 2015], as was suggested to be the major obstacle in optimization [Dauphin et al., 2014]. There is also a seminal work using tensor method to avoid the non-convex optimization problem in neural network [Janzamin et al., 2015]. However, the resulting algorithm is very different from typically used algorithms where only gradient information of the empirical loss is used.
[Soudry and Carmon, 2016] is the closest to our work, which shows that zero gradient implies zero loss for all weights except an exception set of measure zero. However, this is insufficient to guarantee low training loss since small gradient can still lead to large loss. Furthermore, their analysis does not characterize the exception set and it is unclear a priori whether the set of local minima fall into the exception set.
Problem setting and preliminaries
where is the rectified linear unit (ReLU) activation function, and are the unit weights and combination coefficients respectively, is the number of units, and is some constant. We restrict due to the positive homogeneity of ReLU,
That is, the magnitude of can always be scaled into the corresponding . For convenience, let
be the column concatenation of the unit parameters; also let denote the set . Let
denote the feasible set of ’s. A function will depend on and , and it can be written as . But when clear from the context, it is shorten as .
Our primary goal is to identify conditions under which there are no spurious local minima. We need to identify a set such that when gradient descent outputs a solution with the gradient norm smaller than , then the training and test errors can be bounded by . Ideally, should have clear characterization that can be easily verified, and should contain most in the parameter space (especially those solutions obtained in practice).
On notation, we will use , or , to denote constants and its value may change from line to line.
In this section, we will rewrite the set of first order conditions for minimizing the empirical loss . This rewriting motivates the direction of our later analysis. More specifically, the gradient of the empirical loss w.r.t. is
for all . We will express this collection of gradient equations using matrix notation. Define the “extended feature matrix” as
However, in practice, we will not have the gradient being exactly zero because, e.g., we stop the algorithm in finite steps or because we use stochastic gradient descent (SGD). In other words, typically we only have , and being full rank is insufficient since small gradient can still lead to large loss. More specifically, let be the minimum singular value of , we have
We can see that needs to be large enough for the residual to be small. Thus it is important to identify conditions to lower bound away from zero, which will be the focus of the paper.
2 Spectrum decay of activation kernel
We will later show that is related to the decay rate of the kernel spectrum associated with the activation function. More specifically, for an activation function , we can define the following kernel function
In particular, for ReLU, the kernel has a closed form
In fact, it is a dot-product kernel and its spectrum can be obtained through spherical harmonic decomposition:
where the eigenvalues are ordered and the bases are spherical harmonics. The -th eigenvalue will be related to .
For each spherical harmonic of order , there are N(d,t)=\frac{2t+d-2}{t}\left(\begin{array}[]{c}t+d-3\\ t-1\end{array}\right) basis functions sharing the same eigenvalue. Therefore, the spectrum has a step like shape where each step is of length . Especially, for high dimensional input , the number of such basis functions with large eigenvalues can be very large. Figure 2 illustrates the spectrum of the kernel for , and it is about for a large range of . For more details about the decomposition, please refer to Appendix A.
Such step like shape also appears in the Gram matrix associated with the kernel. Figure 2 compares the spectra of the kernel of and the corresponding Gram matrix with . We can see the spectrum of the Gram matrix closely resembles that of the kernel. Such concentration phenomenon underlies the reason why the spectrum of is closely related to the corresponding kernel.
3 Weight discrepancy
Essentially, each defines a slice-shaped area on the sphere which is carved out by the two half spaces and .
Based on the collection , we can define two discrepancy measures relevant to ReLU units. discrepancy of w.r.t. is defined as
where the expectation is taken over uniformly on the sphere. We use and as their shorthands. Both discrepancies measure how diverse the points are. The more diverse the points, the smaller the discrepancy.
For our analysis, we slightly generalize the discrepancy for ’s not on unit sphere, by setting
Main results
Our main result is a bound on the training loss and the generalization error, assuming sufficiently large . To state the theorem, first recall that is the decay exponent of the spectrum of the activation kernel in (15), that is, is the -th eigenvalue of the kernel and satisfies . Also recall that denote the set of feasible values of .
then there exists a set which takes up fraction of measure of , such that with probability at least the following holds. For any and any , we have
Note that an immediate corollary is that any critical point in is global optimum.
Furthermore, a randomly sampled set of weights are likely to fall into this set. This suggests a reason for the practical success of training with random initialization: after initialization, the parameters w.h.p. fall into the set, then would stay inside during training, and finally get to a point with small gradient, which by our analysis, has small error.
Remark 2.
An important feature about our result is that the set has a simple explicit form:
where is a universal constant. Furthermore, has a simple closed form (See Theorem 7). Therefore, it is possible to directly check if a solution is in , or design regularization that make sure stays in the set .
Remark 3.
The above theorem is a special case of the following more general result.
and any , we have
Analysis roadmap
Our key technical result is a lower bound on the smallest singular value of based on the spectrum of the activation kernel defined in (15) and the discrepancy of the weights defined in (20). Once the lower bound is obtained, we can use (13) to bound the training loss, and use Rademachar complexity to bound the generalization error.
It is interesting to compare the theorem to the results in [Soudry and Carmon, 2016], which shows that is full rank with probability one under small perturbations. However, full-rankness alone is not sufficient since its smallest singular value could be extremely small leading to possibly huge training loss. Instead, we directly bound the smallest singular value and relate it to the activation and the diversity of the weights.
Here we describe the high level intuition for bounding the minimum singular value. It is necessarily connected to the activation function and the diversity of the weights. For example, if is very small for all , then the smallest singular value is expected to be very small. For the weights, if (the interesting case) and all ’s are the same, then cannot have rank . If ’s are very similar to each other, then one would expect the smallest singular value to be very small or even zero. Therefore, some notion of diversity of the weights is needed.
where is the spectral norm of the difference.
For the first term in the lower bound, we observe that has a particular nice form: , the kernel defined in (15). This allows us to apply the eigendecomposition of the kernel and positive definite matrix concentration inequality to bound , which turns out to be around .
For the second term, when ’s are indeed from the uniform distribution over the sphere, this can be bounded by concentration bounds. It turns out that when ’s are not too far away from that, it is still possible to do so. Therefore, we use the geometric discrepancy to measure the diversity of the weights, and show that when they are sufficiently diverse, is small. In particular, the entries in can be viewed as the kernel of some U-statistics, hence concentration bounds can be applied. The expected U-statistics turns out to be the , which has a closed form and can be shown to be small.
Outline.
Theorem 3 is proved in Section 6, and are characterized in Section 6.2, and the proof sketch of Theorem 1 and Theorem 2 is provided in Section 7. We describe the proof sketch for the lemmas and provide the remaining proofs in the appendix.
Bounding the smallest singular value
Theorem 3 can be obtained from the following technical lemma.
With probability , we have
Lemma 4 is meaningful only when is small compared to . This requires to be sufficiently small. In the following we will first provide the proof sketch of Lemma 4, and then bound that in Section 6.2.
To prove Lemma 4, it is sufficient to bound the smallest eigenvalue of . Note that , so , and thus the -th entry of is
For ReLU, does not depend on the norm of so without loss of generality, we assume . Consider a related matrix whose -th entry is defined as
Note that where is the kernel defined in (15). This allows us to reason about the eigenspectrum of , denoted as .
Therefore, our strategy is to first bound in Lemma 5 and then bound in Lemma 6. Combining the two immediately leads to Lemma 4.
First, consider . We consider a truncated version of spherical harmonic decomposition:
and the corresponding matrix . On one hand, it is clear that . On the other hand, where is a random matrix whose rows are
Next, we bound by matrix Chernoff bound [Tropp, 2012], and it is better than previous work [Braun, 2006]. This leads to the following lemma.
With probability at least ,
Next, bound . By Weyl’s theorem, this is bounded by . To simplify the notation, denote
Then , and thus
where the last inequality holds with high probability since ’s are uniform over the unit sphere and thus we can apply sub-gaussian concentration bounds.
Note that is a U-statistics where the summands are dependent and typical concentration inequality for i.i.d. entries does not apply. Instead we use a Bernstein inequality for U-statistics [Peel et al., 2010] to show that with probability at least , it is bounded by
The key observation is that the quantities in the above lemma are related to discrepancy:
Plugging (31)-(33) into (30) and (29), we have
The following inequality holds with probability at least ,
where is as defined in Lemma 4.
2 Characterizing the discrepancy
In this subsection, we present a bound for and show that the defined in the following covers most ’s. Recall that
for and a proper constant . The constant is the constant in Lemma 8. will be clear from the context where is used.
First we provide a closed form for discrepancy of slices defined in (18). The proof is provided in the appendix.
The closed form is simple and intuitive. The kernel measures how similar two units are. The discrepancy is the difference between the average pairwise similarity and the expected one over uniform distribution.
There exists a constant , such that for any , with probability at least over that are sampled from the unit sphere uniformly at random,
Final bound on generalization error
Here we provide the proof sketch of Theorem 2 and Theorem 1. More details of the proof are in Appendix F.
First, we prove Theorem 2. Suppose a solution satisfies the assumption and has small gradient . Using (13), we have By Theorem 3 and the assumption in Theorem 2, with high probability . This implies the training loss is
The generalization error can then be derived using McDiamid’s inequality and Rademacher complexity. First, we need an upper bound on the difference of the loss for two data points for the McDiamid’s inequality. Since and , we have . Thus
where in the last inequality we use the fact that the true function . Next, we use the composition rules to compute the Rademacher complexity. Since the complexity of linear functions is and is 1-Lipschitz, and , the complexity Composing it with the loss function, and applying the bound in [Bartlett and Mendelson, 2002], we get the final generalization bound.
Discussions
In this section, we discuss and remark on further considerations and possible extensions of our current analysis.
2 Other activation functions
We can consider a family of activation functions of the form , i.e., rectified polynomials [Cho and Saul, 2009, Krotov and Hopfield, 2016]. This requires two modifications to the analysis.
Examples for the first few are listed as follows.
Larger corresponds to more nonlinear activation functions and leads to slower decaying spectrum since there are more high frequency components.
We also need to change the definition of the discrepancy to accommodate the new kernels. Let
Therefore, the discrepancy is affected by how the kernels change due to change in activation functions.
The other modification is on the Rademacher complexity. Since the derivative , there is an additional factor of in front of the complexity. That is, larger leads to higher Rademacher complexity.
In summary, the best parameter depends on the balance between the two conflicting effects. On one hand, larger corresponds to slower decaying spectrum and makes the minimum singular value more likely to be larger. On the other hand, smaller leads to better generalization since the Rademacher complexity is smaller.
3 (Sub)gradient of the activation function
In summary, though for some the loss is not differentiable, one can define by using subgradients of ReLU as follows:
for any . Then under the conditions in our theorems, with high probability, for any and any definition of in (41), the guarantees hold.
Other activation functions such as rectified polynomials are differentiable and thus they do not have such issue.
4 Other input distribution
When the input distribution is not uniform, the spectrum of the kernel function defined in (14) will be different because the spherical harmonic bases are defined with respect to the input distribution. To ensure the spectrum decays slowly, we need to find a corresponding distribution of that “matches” the input distribution.
In Table 1, we compare the minimum eigenvalues with the two distributions. The uniform distribution on always leads to larger or the same minimum eigenvalues. However, as dimension increases, the difference becomes negligible. Note that the difference between the uniform distribution on the whole sphere and uniform on becomes exponentially small when the dimension increases, because the proportion of and shrinks exponentially. This suggests that in high dimensions, uniform on the whole unit sphere is a reasonable distribution for .
For a general input distribution , we can decompose it into small sets and on every set, the distribution is uniform with measure . Then every small sets corresponds to a distribution of . The final distribution of is the superposition of all such distributions, weighted by .
Numerical evaluation
In this section, we further investigate numerically the effects of gradient descent on the discrepancy and the effects of regularizing the weights using discrepancy measure.
One limitation of the analysis is that we have not analyzed how to obtain a solution with small gradient. The theoretical analysis of gradient descent is left for future work. Meanwhile we provide some numerical results supporting our claims.
Although the set contains most ’s, it is still unclear whether the solutions given by gradient descent lie in the set. We design experiments to investigate this issue. The ground truth input data are of dimension and true function consists of units. We use networks of different to learn the true function and perform SGD with batch size 100 and learning rate 0.1 for 5000 iterations. Figure 4 shows how changes as a function of . It is slightly worse than but scales better than , suggesting (stochastic) gradient descent outputs solutions with reasonable discrepancy.
2 Regularization
To reinforce solutions with small discrepancy, we propose a novel regularization term to minimize discrepancy:
It is essentially discrepancy without the constants.
To verify the effectiveness of the regularization term, we explore the relationship between the regularization and the minimum singular value. We first generate 20 random ’s, all with and , and compute their discrepancy and singular values using . Then we optimize and compare the quantities after optimization. The result is presented in Figure 4. We can see smaller regularization value corresponds to larger singular value.
We also conducts experiments to compare training and test errors with and without regularization. The ground truth data are of and . We learn the true function by SGD with learning rate 0.1, momentum 0.9 and a total of 300,000 iterations. The regularization coefficients are chosen from and the best results are reported. We use neural networks of size and for each we repeat five times with different random seeds. The result is summarized in Table 2. Regularization leads to lower training and test errors for most settings. Even in the case where the un-regularized one performs better, the errors are all small enough (within the same range as standard deviation), suggesting the noise begins to dominate.
We also compare the regularization effects on the MNIST dataset. The dataset contains 60,000 training and 10,000 test handwritten digits. To demonstrate the regularization effect, we train one hidden layer fully connected neural networks with units. The results are summarized in Table 3. Note that state-of-the-arts performance on MNIST are mostly obtained by convolutional neural networks. This experiment is not intended to achieve the state-of-the-arts but it tries to showcase the advantage of regularization on a real-world dataset.
From Table 3, we see regularization consistently leads to slightly better test error for all cases.
Conclusion
We have analyzed one-hidden-layer neural networks and identified novel conditions when local optima become global optima despite the non-convexity of the loss function. The key factors are the spectrum of the kernel associated with the activation function and the diversity of the units measured by discrepancy.
Although we focus on a least-square loss function and uniform input distribution, the analysis technique can be readily extended to other loss function and input distributions. At the moment, our analysis is still limited in the sense that it is independent of the actual algorithm. In the future work, we will explore the interplay between the discrepancy and gradient descent. In addition, we will further investigate the issue of designing an algorithm that guarantees good discrepancy thus small errors, possibly in a way similar to [Ge et al., 2016] in low-rank recovery problems.
Acknowledge
We thank Santosh Vempala, Lorenzo Rosasco and Jason Lee for valuable discussions. The research is supported in part by NSF/NIH BIGDATA 1R01GM108341, ONRN00014-15-1-2340, NSF IIS-1639792, NSF IIS-1218749, NSF CAREER IIS-1350983, Intel and NVIDIA, and by NSF grants CCF-0832797, CCF-1117309, CCF-1302518, DMS-1317308, Simons Investigator Award, and Simons Collaboration Grant.
References
Appendix A Spherical harmonic decomposition and kernel spectrum
Any function defined on the unit sphere has a spherical harmonic decomposition
For each order , there are N(d,t)=\frac{2t+d-2}{t}\left(\begin{array}[]{c}t+d-3\\ t-1\end{array}\right) bases with the same coefficient. As a result, the spectrum sorted by magnitude has the step like shape where each step is of length .
To compute the coefficients, we use the Legendre harmonics [Müller, 2012] with the following property
The spherical harmonics also form an orthonormal basis on the unit sphere:
Combining these properties, we can calculate the spectrum using
Appendix B Bounding λm(G)\lambda_{m}(G) using matrix concentration bound: Proof of Lemma 5
For an integer , define the truncated version of and the corresponding residue as
Let then with probability at least ,
Therefore, matrix Chernoff bound (e.g., [Tropp, 2012]) gives
Choose and use the facts that , and , we finish the proof. ∎
By Weyl’s theorem and the fact that is PSD,
Appendix C Bounding the difference between λm(G)\lambda_{m}(G) and λm(Gn)\lambda_{m}(G_{n}): Proof of Lemma 6
We are going to give an upper bound on :
Our bound heavily relies on the inner products for all being small enough. In the next lemma, we provide such a result for uniformly distributed data.
Note that both and are sub-gaussian random variables with sub-gaussian norm where is some constant [Vershynin, 2010].
The last inequality uses the independence of and and for a fixed . ∎
Decomposing the sum into diagonal and off-diagonal terms gives us
Let denote the event that for all , , then by Lemma 10 and the union bound
Therefore, with probability at least , we have
Suppose , according to the concentration inequality (Theorem 2 in [Peel et al., 2010]), we have with probability at least
Putting everything together, we have with probability at least
Appendix D Discrepancy of the weights
The discrepancy of with respect to is
where the expectation is taken over uniformly on the sphere. We use and as their shorthands.
using the fact that .
In the following subsections, we will discuss the discrepancies.
Consider the first term, which is equal to
where the third step is by invariance to and the fourth step is by Lemma 11. The theorem then follows. ∎
Theorem 7 lets us compute for a fixed . The next lemma gives a concrete bound for a special case where is uniformly distributed on the unit sphere.
Lemma 8 There exists a constant , such that for any , with probability at least over that are sampled from the unit sphere uniformly at random,
Then let denote the event that for a sufficient large constant , so that by Lemma 10, . Then
Then by Berstein’s inequality, we have with probability at least over the uniformly on the sphere,
A similar argument holds for . Note that
We have that with probability at least over the uniform from the sphere,
Below are some technical lemmas that are used in the analysis.
The first two are straightforward. The third is implicit in the proof of Theorem 1.21 in [Bilyk and Lacey, 2015]. ∎
Appendix E The spectrum of γm\gamma_{m}
The spectrum of the kernel matrix is determined by the spherical decomposition coefficients.
We need to decrease slower than within a reasonable range, such as .
Although the kernel associated with ReLU decreases faster than the desired rate, we can choose from a family of such arccos kernels such that the spectrum decays slower than .
Larger corresponds to more nonlinear activation functions and leads to slower decaying spectrum.
Higher orders of seems to be extremely complicated.
Although there is no analytical solution to the spectrum, we can compute them numerically.
Figure 2 illustrates the spectra of several arccos kernels compared to and .
Appendix F Rademacher complexity and final error bounds: Proof of Theorem 2 and Theorem 1
We apply the argument in [Bartlett and Mendelson, 2002] to our setting to get Lemma 12. Combining it with Theorem 3 leads to Theorem 2. Further combining it with Lemma 8 leads to Theorem 1.
Suppose the data are bounded: and . Let
Then with probability , for any ,
where is the set of loss functions
Let and be two datasets that differ by exactly one data point and . Then we have a bound on the difference of loss functions. Since and , we have . Thus
Similarly, we can get the other side of the inequality and have .
From McDiamids’ inequality, with probability at least we get
The first term on the right-hand side can be bounded by Rademacher complexity as shown in the book Foundations of Machine Learning (3.13). In the end, we have the bound
where is the Rademacher complexity of the function class .
We can find the Rademacher complexity by using composition rules. The Rademacher complexity of linear functions is , where is the number of data points. If a function is -Lipschitz, then for any function class , we have . In addition, we also have and .
So for the function class that describes a neural network, we have
It is derived by using the fact that is 1-Lipschitz and .
Finally composing on the loss function we get
using the fact that the ground truth in the loss should be bounded by and the function bounded by , thus the Lipschitz constant of the loss function is bounded by . ∎