Gradient Descent Learns One-hidden-layer CNN: Don't be Afraid of Spurious Local Minima
Simon S. Du, Jason D. Lee, Yuandong Tian, Barnabas Poczos, Aarti Singh
Introduction
Deep convolutional neural networks (DCNN) have achieved the state-of-the-art performance in many applications such as computer vision (Krizhevsky et al., 2012), natural language processing (Dauphin et al., 2016) and reinforcement learning applied in classic games like Go (Silver et al., 2016). Despite the highly non-convex nature of the objective function, simple first-order algorithms like stochastic gradient descent and its variants often train such networks successfully. Why such simple methods in learning DCNN is successful remains elusive from the optimization perspective.
Recently, a line of research (Tian, 2017; Brutzkus & Globerson, 2017; Li & Yuan, 2017; Soltanolkotabi, 2017; Shalev-Shwartz et al., 2017b) assumed the input distribution is Gaussian and showed that stochastic gradient descent with random or initialization is able to train a neural network with ReLU activation in polynomial time. However, these results all assume there is only one unknown layer , while is a fixed vector. A natural question thus arises:
Does randomly initialized (stochastic) gradient descent learn neural networks with multiple layers?
In this paper, we take an important step by showing that randomly initialized gradient descent learns a non-linear convolutional neural network with two unknown layers and . To our knowledge, our work is the first of its kind.
We assume is sampled from a Gaussian distribution and there is no overlap between patches. This assumption is equivalent to that each entry of is sampled from a Gaussian distribution (Brutzkus & Globerson, 2017; Zhong et al., 2017b). Following (Zhong et al., 2017a, b; Li & Yuan, 2017; Tian, 2017; Brutzkus & Globerson, 2017; Shalev-Shwartz et al., 2017b), in this paper, we mainly focus on the population loss:
A crucial difference between our two-layer network and previous one-layer models is there is a positive-homogeneity issue. That is, for any , . This interesting property allows the network to be rescaled without changing the function computed by the network. As reported by (Neyshabur et al., 2015), it is desirable to have scaling-invariant learning algorithm to stabilize the training process.
One commonly used technique to achieve stability is weight-normalization introduced by Salimans & Kingma (2016). As reported in (Salimans & Kingma, 2016), this re-parametrization improves the conditioning of the gradient because it couples the magnitude of the weight vector from the direction of the weight vector and empirically accelerates stochastic gradient descent optimization.
In our setting, we re-parametrize the first layer as and the prediction function becomes
In this paper we focus on using randomly initialized gradient descent for learning this convolutional neural network. The pseudo-code is listed in Algorithm 1.With some simple calculations, we can see the optimal solution for is unique, which we denote as whereas the optimal for is not because for every optimal solution , for is also an optimal solution. In this paper, with a little abuse of the notation, we use to denote the equivalent class of optimal solutions.
Main Contributions. Our paper have three contributions. First, we show if is initialized by a specific random initialization, then with high probability, gradient descent from converges to teacher’s parameters . We can further boost the success rate with more trials.
Randomly initialized local search can find a global minimum in the presence of spurious local minima.
Finally, we conduct a quantitative study of the dynamics of gradient descent. We show that the dynamics of Algorithm 1 has two phases. At the beginning (around first 50 iterations in Figure 1(b)), because the magnitude of initial signal (angle between and ) is small, the prediction error drops slowly. After that, when the signal becomes stronger, gradient descent converges at a much faster rate and the prediction error drops quickly.
Technical Insights. The main difficulty of analyzing the convergence is the presence of local minima. Note that local minimum and the global minimum are disjoint (c.f. Figure 1(b)). The key technique we adopt is to characterize the attraction basin for each minimum. We consider the sequence generated by Algorithm 1 with step size using initialization point . The attraction basin for a minimum is defined as the
The goal is to find a distribution for weight initialization so that the probability that the initial weights are in of the global minimum is bounded below:
This analysis emphasizes that for non-convex optimization problems, we need to carefully characterize both the trajectory of the algorithm and the initialization. We believe that this idea is applicable to other non-convex problems.
To obtain the convergence rate, we propose a potential function (also called Lyapunov function in the literature). For this problem we consider the quantity where and we show it shrinks at a geometric rate (c.f. Lemma 5.5).
Organization This paper is organized as follows. In Section 3 we introduce the necessary notations and analytical formulas of gradient updates in Algorithm 1. In Section 4, we provide our main theorems on the performance of the algorithm and their implications. In Section 6, we use simulations to verify our theories. In Section 5, we give a proof sketch of our main theorem. We conclude and list future directions in Section 7. We place most of our detailed proofs in the appendix.
Related Works
From the point of view of learning theory, it is well known that training a neural network is hard in the worst cases (Blum & Rivest, 1989; Livni et al., 2014; Šíma, 2002; Shalev-Shwartz et al., 2017a, b) and recently, Shamir (2016) showed that assumptions on both the target function and the input distribution are needed for optimization algorithms used in practice to succeed.
Solve NN without gradient descent. With some additional assumptions, many works tried to design algorithms that provably learn a neural network with polynomial time and sample complexity (Goel et al., 2016; Zhang et al., 2015; Sedghi & Anandkumar, 2014; Janzamin et al., 2015; Goel & Klivans, 2017a, b). However these algorithms are specially designed for certain architectures and cannot explain why (stochastic) gradient based optimization algorithms work well in practice.
Gradient-based optimization with Gaussian Input. Focusing on gradient-based algorithms, a line of research analyzed the behavior of (stochastic) gradient descent for Gaussian input distribution. Tian (2017) showed that population gradient descent is able to find the true weight vector with random initialization for one-layer one-neuron model. Soltanolkotabi (2017) later improved this result by showing the true weights can be exactly recovered by empirical projected gradient descent with enough samples in linear time. Brutzkus & Globerson (2017) showed population gradient descent recovers the true weights of a convolution filter with non-overlapping input in polynomial time. Zhong et al. (2017b, a) proved that with sufficiently good initialization, which can be implemented by tensor method, gradient descent can find the true weights of a one-hidden-layer fully connected and convolutional neural network. Li & Yuan (2017) showed SGD can recover the true weights of a one-layer ResNet model with ReLU activation under the assumption that the spectral norm of the true weights is within a small constant of the identity mapping. (Panigrahy et al., 2018) also analyzed gradient descent for learning a two-layer neural network but with different activation functions. This paper also follows this line of approach that studies the behavior of gradient descent algorithm with Gaussian inputs.
Local minimum and Global minimum. Finding the optimal weights of a neural network is non-convex problem. Recently, researchers found that if the objective functions satisfy the following two key properties, (1) all saddle points and local maxima are strict (i.e., there exists a direction with negative curvature), and (2) all local minima are global (no spurious local minmum), then perturbed (stochastic) gradient descent (Ge et al., 2015) or methods with second order information (Carmon et al., 2016; Agarwal et al., 2017) can find a global minimum in polynomial time. Lee et al. (2016) showed vanilla gradient descent only converges to minimizers with no convergence rates guarantees. Recently, Du et al. (2017a) gave an exponential time lower bound for the vanilla gradient descent. In this paper, we give polynomial convergence guarantee on vanilla gradient descent. Combined with geometric analyses, these algorithmic results have shown a large number problems, including tensor decomposition (Ge et al., 2015), dictionary learning (Sun et al., 2017), matrix sensing (Bhojanapalli et al., 2016; Park et al., 2017), matrix completion (Ge et al., 2017a, 2016) and matrix factorization (Li et al., 2016) can be solved in polynomial time with local search algorithms.
Preliminaries
We use bold-faced letters for vectors and matrices. We use to denote the Euclidean norm of a finite-dimensional vector. We let and be the parameters at the -th iteration and and be the optimal weights. For two vector and , we use to denote the angle between them. is the -th coordinate of and is the transpose of the -th row of (thus a column vector). We denote the -dimensional unit sphere and the ball centered at with radius .
In this paper we assume every patch is vector of i.i.d Gaussian random variables. The following theorem gives an explicit formula for the population loss. The proof uses basic rotational invariant property and polar decomposition of Gaussian random variables. See Section A for details.
If every entry of is i.i.d. sampled from a Gaussian distribution with mean and variance , then population loss is
where and
Using similar techniques, we can show the gradient also has an analytical form.
Suppose every entry of is i.i.d. sampled from a Gaussian distribution with mean and variance . Denote . Then the expected gradient of and can be written as
As a remark, if the second layer is fixed, upon proper scaling, the formulas for the population loss and gradient of are equivalent to the corresponding formulas derived in (Brutzkus & Globerson, 2017; Cho & Saul, 2009). However, when the second layer is not fixed, the gradient of depends on , which plays an important role in deciding whether converging to the global or the local minimum.
Main Result
We begin with our main theorem about the convergence of gradient descent.
Suppose the initialization satisfies , , and step size satisfies
Theorem 4.1 shows under certain conditions of the initialization, gradient descent converges to the global minimum. The convergence has two phases, at the beginning because the initial signal () is small, the convergence is quite slow. After iterations, the signal becomes stronger and we enter a regime with a faster convergence rate. See Lemma 5.5 for technical details.
Initialization plays an important role in the convergence. First, Theorem 4.1 needs the initialization satisfy , and . Second, the step size and the convergence rate in the first phase also depends on the initialization. If the initial signal is very small, for example, which makes close to , we can only choose a very small step size and because depends on the inverse of , we need a large number of iterations to enter phase II. We provide the following initialization scheme which ensures the conditions required by Theorem 4.1 and a large enough initial signal.
that , and . Further, with high probability, the initialization satisfies , and .
Remark 1: For the second layer we use type initialization, verifying common initialization techniques (Glorot & Bengio, 2010; He et al., 2015; LeCun et al., 1998).
Remark 2: The Gaussian input assumption is not necessarily true in practice, although this is a common assumption appeared in the previous papers (Brutzkus & Globerson, 2017; Li & Yuan, 2017; Zhong et al., 2017a, b; Tian, 2017; Xie et al., 2017; Shalev-Shwartz et al., 2017b) and also considered plausible in (Choromanska et al., 2015). Our result can be easily generalized to rotation invariant distributions. However, extending to more general distributional assumption, e.g., structural conditions used in (Du et al., 2017b) remains a challenging open problem.
Remark 3: Since we only require initialization to be smaller than some quantities of and . In practice, if the optimization fails, i.e., the initialization is too large, one can halve the initialization size, and eventually these conditions will be met.
Theorem 4.2 shows that among , there is a pair that enables gradient descent to converge to the global minimum. Perhaps surprisingly, the next theorem shows that under some conditions of the underlying truth, there is also a pair that makes gradient descent converge to the spurious local minimum.
A natural question is whether the ratio becomes larger, the probability randomly gradient descent converging to the global minimum, becomes larger as well. We verify this phenomenon empirically in Section 6.
Proof Sketch
In Section 5.1, we give qualitative high level intuition on why the initial conditions are sufficient for gradient descent to converge to the global minimum. In Section 5.2, we explain why the gradient descent has two phases.
The convergence to global optimum relies on a geometric characterization of saddle points and a series of invariants throughout the gradient descent dynamics. The next lemma gives the analysis of stationary points. The main step is to check the first order condition of stationary points using Theorem 3.2.
When the gradient descent converges, and , we have either
If , then .
This lemma shows that when for all , gradient descent converges to the global minimum. Thus, we need to study the dynamics of . For the ease of presentation, without loss of generality, we assume . By the gradient formula of , we have
We can use induction to prove the invariance. If and the first term of Equation (4) is non-negative. For the second term, notice that if , we have , so the second term is non-negative. Therefore, as long as is also non-negative, we have the desired invariance. The next lemma summarizes the above analysis.
If , , and , then .
It remains to prove . Again, we study the dynamics of this quantity. Using the gradient formula and some algebra, we have
where have used the fact that for all . Therefore we have
If and then .
To sum up, if the initialization satisfies (1) , (2) and (3) , with Lemma 5.2, 5.3, 5.4, by induction we can show the convergence to the global minimum. Further, Theorem 4.2 shows these three conditions are true with constant probability using random initialization.
2 Quantitative Analysis of Two Phase Phenomenon
In this section we demonstrate why there is a two-phase phenomenon. Throughout this section, we assume the conditions in Section 5.1 hold. We first consider the convergence of the first layer. Because we are using weight-normalization, only the angle between and will affect the prediction. Therefore, in this paper, we study the dynamics . The following lemma quantitatively characterize the shrinkage of this quantity of one iteration.
Under the same assumptions as in Theorem 4.1. Let . If the step size satisfies , we have
where .
This lemma shows the convergence rate depends on two crucial quantities, and . At the beginning, both and are small. Nevertheless, Lemma C.3 shows is universally lower bounded by . Therefore, after we have . Once , Lemma C.2 shows, after iterations, . Combining the facts (Lemma C.3) and , we have . Now we enter phase II.
for some positive absolute constant . Therefore, we have much faster convergence rate than that in the Phase I. After only iterations, we obtain .
Experiments
In this section, we illustrate our theoretical results with numerical experiments. Again without loss of generality, we assume in this section.
In Figure 2, we set , and we consider 4 key quantities in proving Theorem 4.1, namely, angle between and (c.f. Lemma 5.5), (c.f. Lemma C.5), (c.f. Lemma C.4) and prediction error (c.f. Lemma C.6).
When we achieve the global minimum, all these quantities are . At the beginning (first iterations), and the prediction error drop quickly. This is because for the gradient of , is the dominating term which will make closer to quickly.
After that, for the next iterations, all quantities decrease at a slow rate. This phenomenon is explained to the Phase I stage in Theorem 4.1. The rate is slow because the initial signal is small.
After iterations, all quantities drop at a much faster rate. This is because the signal is very strong and since the convergence rate is proportional to this signal, we have a much faster convergence rate (c.f. Phase II of Theorem 4.1).
2 Probability of Converging to the Global Minimum
In this section we test the probability of converging to the global minimum using the random initialization scheme described in Theorem 4.2. We set and vary and . We run 5000 random initializations for each and compute the probability of converging to the global minimum.
In Theorem 4.3, we showed if is sufficiently small, randomly initialized gradient descent converges to the spurious local minimum with constant probability. Table 1 empirically verifies the importance of this assumption. For every fixed if becomes larger, the probability of converging to the global minimum becomes larger.
An interesting phenomenon is for every fixed ratio when becomes lager, the probability of converging to the global minimum becomes smaller. How to quantitatively characterize the relationship between the success probability and the dimension of the second layer is an open problem.
Conclusion and Future Works
In this paper we proved the first polynomial convergence guarantee of randomly initialized gradient descent algorithm for learning a one-hidden-layer convolutional neural network. Our result reveals an interesting phenomenon that randomly initialized local search algorithm can converge to a global minimum or a spurious local minimum. We give a quantitative characterization of gradient descent dynamics to explain the two-phase convergence phenomenon. Experimental results also verify our theoretical findings. Here we list some future directions.
Our analysis focused on the population loss with Gaussian input. In practice one uses (stochastic) gradient descent on the empirical loss. Concentration results in (Mei et al., 2016; Soltanolkotabi, 2017) are useful to generalize our results to the empirical version. A more challenging question is how to extend the analysis of gradient dynamics beyond rotationally invariant input distributions. Du et al. (2017b) proved the convergence of gradient descent under some structural input distribution assumptions in the one-layer convolutional neural network. It would be interesting to bring their insights to our setting.
Another interesting direction is to generalize our result to deeper and wider architectures. Specifically, an open problem is under what conditions randomly initialized gradient descent algorithms can learn one-hidden-layer fully connected neural network or a convolutional neural network with multiple kernels. Existing results often require sufficiently good initialization (Zhong et al., 2017a, b). We believe the insights from this paper, especially the invariance principles in Section 5.1 are helpful to understand the behaviors of gradient-based algorithms in these settings.
Acknowledgment
This research was partly funded by NSF grant IIS1563887, AFRL grant FA8750-17-2-0212 DARPA D17AP00001. J.D.L. acknowledges support of the ARO under MURI Award W911NF-11-1-0303. This is part of the collaboration between US DOD, UK MOD and UK Engineering and Physical Research Council (EPSRC) under the Multidisciplinary University Research Initiative. The authors thank Xiaolong Wang and Kai Zhong for useful discussions.
References
Appendix A Proofs of Section 3
We first expand the loss function directly.
For , using the second identity of Lemma A.1, we can compute
For , using the second moment formula of half-Gaussian distribution we can compute
Now let us compute . For , similar to , using the independence property of Gaussian, we have
Next, using the fourth identity of Lemma A.1, we have
Therefore, we can also write in a compact form
Plugging in the formulas of and and , we obtain the desired result. ∎
We first compute the expect gradient for . From(Salimans & Kingma, 2016), we know
Now we calculate expectation of Equation (7) and (8) separately. For (7), by first two formulas of Lemma A.1, we have
For (8), we use the second and third formula in Lemma A.1 to obtain
In summary, aggregating them together we have
As a sanity check, this formula matches Equation (16) of (Brutzkus & Globerson, 2017) when .
Next, we calculate the expected gradient of . Recall the gradient formula of
where and are defined in Equation (5) and (6). Plugging in the formulas for and derived in the proof of Theorem 3.1 we obtained the desired result.
Given , with angle and is a Gaussian random vector, then
by the independence properties of Gaussian random vector. For ,
Also note that . Therefore
For the fourth identity, focusing on the plane spanned by and , using the polar decomposition, we have
Appendix B Proofs of Qualitative Convergence Results
When Algorithm 1 converges, since and , using the gradient formula in Theorem 3.2, we know that either or For the second case, since is a projection matrix on the complement space of , is equivalent to . Once the angle between and is fixed, using the gradient formula for we have the desired formulas for saddle points. ∎
By the gradient formula of , if , the gradient is of the form where . Thus because is the projection matrix onto the complement space of , the gradient update always makes the angle smaller. ∎
Appendix C Proofs of Quantitative Convergence Results
We first prove the lemma about the convergence of .
We consider the dynamics of .
where in the first inequality we dropped term proportional to because it is negative, in the last equality, we divided numerator and denominator by and the last inequality we dropped the denominator because it is bigger than . Therefore, recall and we have
To this end, we need to make sure . Note that since is monotonically increasing, it is lower bounded by . Next notice . Finally, from Lemma C.2, we know . Combining these, we have an upper bound
Plugging this back to Equation (9) and use our assumption on , we have
Recall the dynamics of .
where the inequality is due to Lemma 5.4. If ,
If , simple algebra shows increases by at least
A simple corollary is is uniformly lower bounded.
For all , .
This lemma also gives an upper bound of number of iterations to make .
If , then after iterations, .
Note if and , each iteration increases by . ∎
We also need an upper bound of .
For , .
Without loss of generality, assume . Again, recall the dynamics of .
Now we prove by induction, suppose the conclusion holds at iteration , . Plugging in we have the desired result. ∎
C.2 Convergence of Phase I
In this section we prove the convergence of Phase I.
Lemma C.3 implies after iterations, , which implies . Using Corollary C.2, we know after iterations we have . ∎
The main ingredient of the proof of phase I is the follow lemma where we use a joint induction argument to show the convergence of and a uniform upper bound of .
Let . If the step size satisfies , we have for
We prove by induction. The initialization ensure when , the conclusion is correct. Now we consider the dynamics of . Note because the gradient of is orthogonal to (Salimans & Kingma, 2016), we have a simple dynamic of .
where the first inequality is by Lemma C.2 and the second inequality we use our induction hypothesis. Recall . The uniform upper bound of and the fact that imply a lower bound . Plugging in Lemma 5.5, we have
C.3 Analysis of Phase II
In this section we prove the convergence of phase II and necessary auxiliary lemmas.
At the beginning of Phase II, and . Therefore, Lemma C.1 implies for all , . Combining with the fact that (c.f. Lemma C.3), we obtain a lower bound We also know that and is monotinically increasing (c.f. Lemma 5.2), so for all , . Plugging in these two lower bounds into Theorem 5.5, we have
In this section we provide some technical lemmas for analyzing Phase II. Because of the positive homogeneity property, without loss of generality, we assume .
If , after iterations, .
Recall the dynamics of .
Assume (the other case is similar). By Lemma 5.4 we know for all . Consider
After iterations, we have , which implies ∎
If and , then after iterations, for some absolute constant .
Next we consider the squared norm of gradient
Suppose , then
Thus after iterations, we must have for some large absolute constant . Rescaling , we obtain the desired result. ∎
The result follows by plugging in the assumptions in Theorem 3.1. ∎
Appendix D Proofs of Initialization Scheme
The proof of the first part of Theorem 4.2 just uses the symmetry of unit sphere and ball and the second part is a direct application of Lemma 2.5 of (Hardt & Price, 2014). Lastly, since , we have where the second inequality is due to Hölder’s inequality. ∎
Appendix E Proofs of Converging to Spurious Local Minimum
The main idea is similar to Theorem 4.1 but here we show (without loss of generality, we assume ). Different from Theorem 4.1, here we need to prove the invariance , which implies our desired result. We prove by induction, suppose , , and . Note are satisfied by Lemma 5.4 and by our initialization condition and induction hypothesis that implies is increasing. Recall the dynamics of .