Title: EFFICIENTLY TESTING LOCAL OPTIMALITY AND ESCAPING SADDLES FOR RELU NETWORKS

Abstract: We provide a theoretical algorithm for checking local optimality and escaping saddles at nondifferentiable points of empirical risks of two-layer ReLU networks. Our algorithm receives any parameter value and returns: local minimum, secondorder stationary point, or a strict descent direction. The presence of M data points on the nondifferentiability of the ReLU divides the parameter space into at most 2 M regions, which makes analysis difficult. By exploiting polyhedral geometry, we reduce the total computation down to one convex quadratic program (QP) for each hidden node, O(M ) (in)equality tests, and one (or a few) nonconvex QP. For the last QP, we show that our specific problem can be solved efficiently, in spite of nonconvexity. In the benign case, we solve one equality constrained QP, and we prove that projected gradient descent solves it exponentially fast. In the bad case, we have to solve a few more inequality constrained QPs, but we prove that the time complexity is exponential only in the number of inequality constraints. Our experiments show that either benign case or bad case with very few inequality constraints occurs, implying that our algorithm is efficient in most cases.

1. INTRODUCTION:

Empirical success of deep neural networks has sparked great interest in the theory of deep models. From an optimization viewpoint, the biggest mystery is that deep neural networks are successfully trained by gradient-based algorithms despite their nonconvexity. On the other hand, it has been known that training neural networks to global optimality is NP-hard (Blum & Rivest, 1988) . It is also known that even checking local optimality of nonconvex problems can be NP-hard (Murty & Kabadi, 1987) . Bridging this gap between theory and practice is a very active area of research, and there have been many attempts to understand why optimization works well for neural networks, by studying the loss surface (Baldi & Hornik, 1989; Yu & Chen, 1995; Kawaguchi, 2016; Soudry & Carmon, 2016; Nguyen & Hein, 2017; 2018; Safran & Shamir, 2018; Laurent & Brecht, 2018; Yun et al., 2019; 2018; Zhou & Liang, 2018; Wu et al., 2018; Shamir, 2018) and the role of (stochastic) gradientbased methods (Tian, 2017; Brutzkus & Globerson, 2017; Zhong et al., 2017; Soltanolkotabi, 2017; Li & Yuan, 2017; Zhang et al., 2018; Brutzkus et al., 2018; Wang et al., 2018; Li & Liang, 2018; Du et al., 2018a; b; c; Allen-Zhu et al., 2018; Zou et al., 2018; Zhou et al., 2019) .

One of the most important beneficial features of convex optimization is the existence of an optimality test (e.g., norm of the gradient is smaller than a certain threshold) for termination, which gives us a certificate of (approximate) optimality. In contrast, many practitioners in deep learning rely on running first-order methods for a fixed number of epochs, without good termination criteria for the optimization problem. This means that the solutions that we obtain at the end of training are not necessarily global or even local minima. Yun et al. (2018; 2019) showed efficient and simple global optimality tests for deep linear neural networks, but such optimality tests cannot be extended to general nonlinear neural networks, mainly due to nonlinearity in activation functions.

Besides nonlinearity, in case of ReLU networks significant additional challenges in the analysis arise due to nondifferentiability, and obtaining a precise understanding of the nondifferentiable points is still elusive. ReLU activation function h(t) = max{t, 0} is nondifferentiable at t = 0. This means that, for example, the function f (w, b) := (h(w T x + b) -1) 2 is nondifferentiable for any (w, b) satisfying w T x+b = 0. See Figure 1 for an illustration of how the empirical risk of a ReLU network Figure 1 : An illustration of the empirical risk of a ReLU network. The plotted function is f (w, v) := (h(w -v + 1) -2) 2 + (h(2w + v + 1) -1) 2 + (h(w + 2v + 1) -0.5) 2 , where h is the ReLU function. (a) A 3-d surface plot of the function. One can see that there are sharp ridges in the function. (b) A plot of nondifferentiable points on the (w, v) plane. The blue line correspond to the line w -v + 1 = 0, the red to 2w + v + 1 = 0, and the yellow to w + 2v + 1 = 0.

looks like. Although the plotted function does not exactly match the definition of empirical risk we study in this paper, the figures help us understand that the empirical risk is continuous but piecewise differentiable, with affine hyperplanes on which the function is nondifferentiable.

Such nondifferentiable points lie in a set of measure zero, so one may be tempted to overlook them as "non-generic." However, when studying critical points we cannot do so, as they are precisely such "non-generic" points. For example, Laurent & Brecht (2018) study one-hidden-layer ReLU networks with hinge loss and note that except for piecewise constant regions, local minima always occur on nonsmooth boundaries. Probably due to difficulty in analysis, there have not been other works that handle such nonsmooth points of losses and prove results that work for all points. Some theorems (Soudry & Carmon, 2016; Nguyen & Hein, 2018) hold "almost surely"; some assume differentiability or make statements only for differentiable points (Nguyen & Hein, 2017; Yun et al., 2019) ; others analyze population risk, in which case the nondifferentiability disappears after taking expectation (Tian, 2017; Brutzkus & Globerson, 2017; Du et al., 2018b; Safran & Shamir, 2018; Wu et al., 2018) .

1.1. SUMMARY OF OUR RESULTS:

In this paper, we take a step towards understanding nondifferentiable points of the empirical risk of one-hidden-layer ReLU(-like) networks. Specifically, we provide a theoretical algorithm that tests second-order stationarity for any point of the loss surface. It takes an input point and returns:

(a) The point is a local minimum; or (b) The point is a second-order stationary point (SOSP); or (c) A descent direction in which the function value strictly decreases.

Therefore, we can test whether a given point is a SOSP. If not, the test extracts a guaranteed direction of descent that helps continue minimization. With a proper numerical implementation of our algorithm (although we leave it for future work), one can run a first-order method until it gets stuck near a point, and run our algorithm to test for optimality/second-order stationarity. If the point is an SOSP, we can terminate without further computation over many epochs; if the point has a descent direction, our algorithm will return a descent direction and we can continue on optimizing. Note that the descent direction may come from the second-order information; our algorithm even allows us to escape nonsmooth second-order saddle points. This idea of mixing first and second-order methods has been explored in differentiable problems (see, for example, Carmon et al. (2016) ; Reddi et al.

(2017) and references therein), but not for nondifferentiable ReLU networks.

The key computational challenge in constructing our algorithm for nondifferentiable points is posed by data points that causes input 0 to the ReLU hidden node(s). Such data point bisects the parameter space into two halfspaces with different "slopes" of the loss surface, so one runs into nondifferen-tiability. We define these data points to be boundary data points. For example, in Figure 1b , if the input to our algorithm is (w, v) = (-2/3, 1/3), then there are two boundary data points: "blue" and "red." If there are M such boundary data points, then in the worst case the parameter space divides into 2 M regions, or equivalently, there are 2 M "pieces" of the function that surround the input point. Of course, naively testing each region will be very inefficient; in our algorithm, we overcome this issue by a clever use of polyhedral geometry. Another challenge comes from the second-order test, which involves solving nonconvex QPs. Although QP is NP-hard in general (Pardalos & Vavasis, 1991) , we prove that the QPs in our algorithm are still solved efficiently in most cases. We further describe the challenges and key ideas in Section 2.1.

Notation. For a vector v, [v] i denotes its i-th component, and v H := √ v T Hv denotes a seminorm where H is a positive semidefinite matrix. Given a matrix A, we let [A] i,j , [A] i,• , and [A] •,j be A's (i, j)-th entry, the i-th row, and the j-th column, respectively.

2. PROBLEM SETTING AND KEY IDEAS:

We consider a one-hidden-layer neural network with input dimension d x , hidden layer width d h , and output dimension d y . We are given m pairs of data points and labels (x i , y i ) m i=1 , where x i ∈ R dx and y i ∈ R dy . Given an input vector x, the output of the network is defined as

Y (x) := W 2 h(W 1 x+ b 1 ) + b 2 , where W 2 ∈ R dy×d h , b 2 ∈ R dy , W 1 ∈ R d h ×dx , and b 1 ∈ R d h are the network parameters.

The activation function h is "ReLU-like," meaning h(t) := max{s + t, 0} + min{s -t, 0}, where s + > 0, s -≥ 0 and s + = s -. Note that ReLU and Leaky-ReLU are members of this class. In training neural networks, we are interested in minimizing the empirical risk

R((W j , b j ) 2 j=1 ) = m i=1 (Y (x i ), y i ) = m i=1 (W 2 h(W 1 x i + b 1 ) + b 2 , y i ),

over the parameters (W j , b j ) 2 j=1 , where (w, y) : R dy × R dy → R is the loss function. We make the following assumptions on the loss function and the training dataset: Assumption 1. The loss function (w, y) is twice differentiable and convex in w. Assumption 2. No d x + 1 data points lie on the same affine hyperplane.

Assumption 1 is satisfied by many standard loss functions such as squared error loss and crossentropy loss. Assumption 2 means, if d x = 2 for example, no three data points are on the same line. Since real-world datasets contain noise, this assumption is also quite mild.

2.1. CHALLENGES AND KEY IDEAS:

In this section, we explain the difficulties at nondifferentiable points and ideas on overcoming them. Our algorithm is built from first principles, rather than advanced tools from nonsmooth analysis.

Bisection by boundary data points. Since the activation function h is nondifferentiable at 0, the behavior of data points at the "boundary" is decisive. Consider a simple example d h = 1, so W 1 is a row vector. If W 1 x i +b 1 = 0, then the sign of (W 1 +∆ 1 )x i +(b 1 +δ 1 ) for any small perturbations ∆ 1 and δ 1 stays invariant. In contrast, when there is a point x i on the "boundary," i.e., W 1 x i + b 1 = 0, then the slope depends on the direction of perturbation, leading to nondifferentiability. As mentioned earlier, we refer to such data points as boundary data points.

When ∆ 1 x i + δ 1 ≥ 0, h((W 1 + ∆ 1 )x i + (b 1 + δ 1 )) = h(∆ 1 x i + δ 1 ) = s + (∆ 1 x i + δ 1 ) = h(W 1 x i + b 1 ) + s + (∆ 1 x i + δ 1 ),

and similarly, the slope is s -for ∆ 1 x i + δ 1 ≤ 0. This means that the "gradient" (as well as higher order derivatives) of R depends on direction of (∆ 1 , δ 1 ).

Thus, every boundary data point x i bisects the space of perturbations (∆ j , δ j ) 2 j=1 into two halfspaces by introducing a hyperplane through the origin. The situation is even worse if we have M boundary data points: they lead to a worst case of 2 M regions. Does it mean that we need to test all 2 M regions separately? We show that there is a way to get around this issue, but before that, we first describe how to test local minimality or stationarity for each region.

Second-order local optimality conditions. We can expand R((W j + ∆ j , b j + δ j ) 2 j=1 ) and obtain the following Taylor-like expansion for small enough perturbations (see Lemma 2 for details)

EQUATION

where z is a vectorized version of all parameters (W j , b j ) 2 j=1 and η is the corresponding vector of perturbations (∆ j , δ j ) 2 j=1 . Notice now that in (1), at nondifferentiable points the usual Taylor expansion does not exist, but the corresponding "gradient" g(•) and "Hessian" H(•) now depend on the direction of perturbation η. Also, the space of η is divided into at most 2 M regions, and g(z, η) and H(z, η) are piecewise-constant functions of η whose "pieces" correspond to the regions. One could view this problem as 2 M constrained optimization problems and try to solve for KKT conditions at z; however, we provide an approach that is developed from first principles and solves all 2 M problems efficiently.

Given this expansion (1) and the observation that derivatives stay invariant with respect to scaling of η, one can note that (a) g(z, η) T η ≥ 0 for all η, and (b) η T H(z, η)η ≥ 0 for all η such that g(z, η) T η = 0 are necessary conditions for local optimality of z, thus z is a "SOSP" (see Definition 2.2). The conditions become sufficient if (b) is replaced with η T H(z, η)η > 0 for all η = 0 such that g(z, η) T η = 0. In fact, this is a generalized version of second-order necessary (or sufficient) conditions, i.e., ∇f = 0 and ∇ 2 f 0 (or ∇ 2 f 0), for twice differentiable f .

Efficiently testing SOSP for exponentially many regions. Motivated from the second-order expansion (1) and necessary/sufficient conditions, our algorithm consists of three steps:

(a) Testing first-order stationarity (in the Clarke sense, see Definition 2.1), (b) Testing g(z, η) T η ≥ 0 for all η, (c) Testing η T H(z, η)η ≥ 0 for {η | g(z, η) T η = 0}.

The tests are executed from Step (a) to (c). Whenever a test fails, we get a strict descent direction η, and the algorithm returns η and terminates. Below, we briefly outline each step and discuss how we can efficiently perform the tests. We first check first-order stationarity because it makes Step (b) easier.

Step (a) is done by solving one convex QP per each hidden node. For Step (b), we formulate linear programs (LPs) per each 2 M region, so that checking whether all LPs have minimum cost of zero is equivalent to checking g(z, η) T η ≥ 0 for all η. Here, the feasible sets of LPs are pointed polyhedral cones, whereby it suffices to check only the extreme rays of the cones. It turns out that there are only 2M extreme rays, each shared by 2 M -1 cones, so testing g(z, η) T η ≥ 0 can be done with only O(M ) inequality/equality tests instead of solving exponentially many LPs. In Step (b), we also record the flat extreme rays, which are defined to be the extreme rays with g(z, η) T η = 0, for later use in Step (c).

In Step (c), we test if the second-order perturbation η T H(•)η can be negative, for directions where g(z, η) T η = 0. Due to the constraint g(z, η) T η = 0, the second-order test requires solving constrained nonconvex QPs. In case where there is no flat extreme ray, we need to solve only one equality constrained QP (ECQP). If there exist flat extreme rays, a few more inequality constrained QPs (ICQPs) are solved. Despite NP-hardness of general QPs (Pardalos & Vavasis, 1991) , we prove that the specific form of QPs in our algorithm are still tractable in most cases. More specifically, we prove that projected gradient descent on ECQPs converges/diverges exponentially fast, and each step takes O(p 2 ) time (p is the number of parameters). In case of ICQPs, it takes O(p 3 + L 3 2 L ) time to solve the QP, where L is the number of boundary data points that have flat extreme rays (L ≤ M ). Here, we can see that if L is small enough, the ICQP can still be solved in polynomial time in p. At the end of the paper, we provide empirical evidences that the number of flat extreme rays is zero or very few, meaning that in most cases we can solve the QP efficiently.

2.2. PROBLEM-SPECIFIC NOTATION AND DEFINITION:

In this section, we define a more precise notion of generalized stationary points and introduce some additional symbols that will be helpful in streamlining the description of our algorithm in Section 3. Since we are dealing with nondifferentiable points of nonconvex R, usual notions of (sub)gradients do not work anymore. Here, Clarke subdifferential is a useful generalization (Clarke et al., 2008) : Definition 2.1 (FOSP, Theorem 6.2.5 of Borwein & Lewis (2010) ). Suppose that a function f (z) : Ω → R is locally Lipschitz around the point z * ∈ Ω, and differentiable in Ω \ W where W has Lebesgue measure zero. Then the Clarke differential of f at z * is

∂ z f (z * ) := cvxhull{lim k ∇f (z k ) | z k → z * , z k / ∈ W}. If 0 ∈ ∂ z f (z * ),

we say z * is a first-order stationary point (FOSP).

From the definition, we can note that Clarke subdifferential ∂ z R(z * ) is the convex hull of all the possible values of g(z * , η) in (1). For parameters (W j , b j ) 2 j=1 , let ∂ Wj f (z * ) and ∂ bj f (z * ) be the Clarke differential w.r.t. to W j and b j , respectively. They are the projection of ∂ z f (z * ) onto the space of individual parameters. Whenever the point z * is clear (e.g. our algorithm), we will omit (z * ) from f (z * ). Next, we define second-order stationary points for the empirical risk R. Notice that this generalizes the definition of SOSP for differentiable functions f : ∇f = 0 and ∇ 2 f 0. Definition 2.2 (SOSP). We call z * is a second-order stationary point (SOSP) of R if (1) z * is a FOSP, (2) g(z * , η) T η ≥ 0 for all η, and (3) η T H(z * , η)η ≥ 0 for all η such that g(z * , η) T η = 0.

Given an input data point x ∈ R dx , we define O(x) := h(W 1 x + b 1 ) to be the output of hidden layer. We note that the notation O(•) is overloaded with the big O notation, but their meaning will be clear from the context. Consider perturbing parameters (W j , b j ) 2 j=1 with (∆ j , δ j ) 2 j=1 , then the perturbed output Ỹ (x) of the network and the amount of perturbation dY (x) can be expressed as

dY (x) := Ỹ (x) -Y (x) = ∆ 2 O(x) + δ 2 + (W 2 + ∆ 2 )J(x)(∆ 1 x + δ 1 ),

where J(x) can be thought informally as the "Jacobian" matrix of the hidden layer. The matrix J(x) ∈ R d h ×d h is diagonal, and its k-th diagonal entry is given by

[J(x)] k,k := h ([W 1 x + b 1 ] k ) if [W 1 x + b 1 ] k = 0 h ([∆ 1 x + δ 1 ] k ) if [W 1 x + b 1 ] k = 0,

where h is the derivative of h. We define h (0) := s + , which is okay because it is always multiplied with zero in our algorithm. For boundary data points,

[J(x)] k,k depends on the direction of pertur- bations [∆ 1 δ 1 ] k,

• , as noted in Section 2.1. We additionally define dY 1 (x) and dY 2 (x) to separate the terms in dY (x) that are linear in perturbations versus quadratic in perturbations.

dY 1 (x) := ∆ 2 O(x) + δ 2 + W 2 J(x)(∆ 1 x + δ 1 ), dY 2 (x) := ∆ 2 J(x)(∆ 1 x + δ 1 ).

For simplicity of notation for the rest of the paper, we define for all i ∈ [m] := {1, . . . , m},

xi := x T i 1 T ∈ R dx+1 , ∇ i := ∇ w (Y (x i ), y i ), ∇ 2 i := ∇ 2 w (Y (x i ), y i ).

In our algorithm and its analysis, we need to give a special treatment to the boundary data points. To this end, for each node k ∈ [d h ] in the hidden layer, define boundary index set B k as

B k := {i ∈ [m] | [W 1 x i + b 1 ] k = 0} .

The subspace spanned by vectors xi for in i ∈ B k plays an important role in our tests; so let us define a symbol for it, as well as the cardinality of B k and their sum:

V k := span{x i | i ∈ B k }, M k := |B k |, M := d h k=1 M k . For k ∈ [d h ], let v T k ∈ R 1×(dx+1) be the k-th row of [∆ 1 δ 1 ],

and u k ∈ R dy be the k-th column of ∆ 2 . Next, we define the total number of parameters p, and vectorized perturbations η ∈ R p :

p := d y + d y d h + d h (d x + 1), η T := δ T 2 u T 1 • • • u T d h v T 1 • • • v T d h . Also let z ∈ R p be vectorized parameters (W j , b j ) 2

j=1 , packed in the same order as η.

Define a matrix dx+1) . This quantity appears multiplie times and does not depend on the perturbation, so it is helpful to have a symbol for it.

C k := i / ∈B k h ([W 1 x i + b 1 ] k )∇ i xT i ∈ R dy×(

We conclude this section by presenting one of the implications of Assumption 2 in the following lemma, which we will use later. The proof is simple, and is presented in Appendix B.1. Lemma 1. If Assumption 2 holds, then M k ≤ d x and the vectors {x i } i∈B k are linearly independent.

3. TEST ALGORITHM FOR SECOND-ORDER STATIONARITY:

In this section, we present SOSP-CHECK in Algorithm 1, which takes an arbitrary tuple (W j , b j ) 2 j=1 of parameters as input and checks whether it is a SOSP. We first present a lemma that shows the explicit form of the perturbed empirical risk R(z +η) and identify first and second-order perturbations. The proof is deferred to Appendix B.2.

Algorithm 1 SOSP-CHECK (Rough pseudocode)

Input: A tuple (Wj, bj) 2 j=1 of R(•). 1: Test if ∂W 2 R = {0 dy ×d h } and ∂ b 2 R = {0 dy }. 2: for k ∈ [d h ] do 3: if M k > 0 then 4: Test if 0 T dx+1 ∈ ∂ [W 1 b 1 ] k,• R. 5: Test if g k (z, v k ) T v k ≥ 0 for all v k via

testing extreme rays ṽk of polyhedral cones. 6:

Store extreme rays ṽk s.t. g k (z, ṽk ) T ṽk = 0 for second-order test. 7:

else 8: Test if ∂ [W 1 b 1 ] k,• R = {0 T dx+1 }. 9: end if 10: end for 11: For all η's s.t. g(z, η) T η = 0, test if η T H(z, η)η ≥ 0. 12: if ∃η = 0 s.t. g(z, η) T η = 0 and η T H(z, η)η = 0 then 13:

return SOSP. 14: else 15:

return Local Minimum. 16: end if Lemma 2. For small enough perturbation η,

R(z + η) = R(z) + g(z, η) T η + 1 2 η T H(z, η)η + o( η 2 ),

where g(z, η) and H(z, η) satisfy

g(z, η) T η = i ∇ T i dY 1 (x i ) = i ∇ i O(x i ) T , ∆ 2 + i ∇ i , δ 2 + d h k=1 g k (z, v k ) T v k , η T H(z, η)η = i ∇ T i dY 2 (x i ) + 1 2 i dY 1 (x i ) 2 ∇ 2 i , and g k (z, v k ) T := [W 2 ] T •,k C k + i∈B k h (x T i v k )∇ i xT i . Also, g(z, η

) and H(z, η) are piecewise constant functions of η, which are constant inside each polyhedral cone in space of η.

Rough pseudocode of SOSP-CHECK is presented in Algorithm 1. As described in Section 2.1, the algorithm consists of three steps: (a) testing first-order stationarity (b) testing g(z, η) T η ≥ 0 for all η, and (c) testing η T H(z, η)η ≥ 0 for {η | g(z, η) T η = 0}. If the input point satisfies the secondorder sufficient conditions for local minimality, the algorithm decides it is a local minimum. If the point only satisfies second-order necessary conditions, it returns SOSP. If a strict descent direction η is found, the algorithm terminates immediately and returns η. A brief description will follow, but the full algorithm (Algorithm 2) and a full proof of correctness are deferred to Appendix A.

3.1 TESTING FIRST-ORDER STATIONARITY (LINES 1, 4, AND 8) Line 1 of Algorithm 1 corresponds to testing if ∂ W2 R and ∂ b2 R are singletons with zero. If not, the opposite direction is a descent direction. More details are in Appendix A.1.1.

Test for W 1 and b 1 is more difficult because g(z, η) depends on ∆ 1 and δ 1 when there are boundary data points.

For each k ∈ [d h ], Line 4 (if M k > 0), and Line 8 (if M k = 0) test if 0 T dx+1 is in ∂ [W1 b1] k,• R. Note from Definition 2.1 and Lemma 2 that ∂ [W1 b1] k,• R is the convex hull of all possible values of g k (z, v k ) T . If M k > 0, 0 ∈ ∂ [W1 b1] k,•

R can be tested by solving a convex QP:

EQUATION

If the solution {s * i } i∈B k does not achieve zero objective value, then we can directly return a descent direction. For details please refer to FO-SUBDIFF-ZERO-TEST (Algorithm 3) and Appendix A.1.2.

3.2. TESTING:

g(z, η) T η ≥ 0 FOR ALL η (LINES 5-6) Linear program formulation. Lines 5-6 are about testing if g k (z, v k ) T v k ≥ 0 for all directions of v k . If 0 T dx+1 ∈ ∂ [W1 b1] k,• R, with the solution {s * i } from QP (2) we can write g k (z, v k ) T as g k (z, v k ) T = [W 2 ] T •,k C k + i∈B k h (x T i v k )∇ i xT i = [W 2 ] T •,k i∈B k h (x T i v k ) -s * i ∇ i xT i . Every i ∈ B k bisects R dx+1 into two halfspaces, xT i v k ≥ 0 and xT i v k ≤ 0, in each of which h (x T i v k ) stays constant.

Note that by Lemma 1, xi 's for i ∈ B k are linearly independent. So, given M k boundary data points, they divide the space R dx+1 of v k into 2 M k polyhedral cones.

Since g k (z, v k ) T is constant in each polyhedral cones, we can let σ i ∈ {-1, +1} for all i ∈ B k , and define an LP for each

{σ i } i∈B k ∈ {-1, +1} M k : minimize v k [W 2 ] T •,k i∈B k (s σi -s * i )∇ i xT i v k subject to v k ∈ V k , σ i xT i v k ≥ 0, ∀i ∈ B k .

(3)

Solving these LPs and checking if the minimum value is 0 suffices to prove

g k (z, v k ) T v k ≥ 0 for all small enough perturbations. The constraint v k ∈ V k is there because any v k / ∈ V k is also orthogonal to g k (z, v k ). It is equivalent to d x + 1 -M k

linearly independent equality constraints. So, the feasible set of LP (3) has d x + 1 linearly independent constraints, which implies that the feasible set is a pointed polyhedral cone with vertex at origin. Since any point in a pointed polyhedral cone is a conical combination (linear combination with nonnegative coefficients) of extreme rays of the cone, checking nonnegativity of the objective function for all extreme rays suffices. We emphasize that we do not solve the LPs (3) in our algorithm; we just check the extreme rays.

Computational efficiency. Extreme rays of a pointed polyhedral cone in R dx+1 are computed from d x linearly independent active constraints. For each i ∈ B k , the extreme ray vi,k ∈ V k ∩ span{x j | j ∈ B k \ {i}} ⊥ must be tested whether g k (z, vi,k ) T vi,k ≥ 0, in both directions. Note that there are 2M k extreme rays, and one extreme ray vi,k is shared by

2 M k -1 polyhedral cones. Moreover, xT j vi,k = 0 for j ∈ B k \ {i}, which indicates that g k (z, vi,k ) T vi,k = (s σ i,k -s * i )[W 2 ] T •,k ∇ i xT i vi,k , where σ i,k = sign(x T i vi,k ),

regardless of {σ j } j∈B k \{i} . Testing an extreme ray can be done with a single inequality test instead of 2 M k -1 separate tests for all cones! Thus, this extreme ray approach instead of solving individual LPs greatly reduces computation, from

O(2 M k ) to O(M k ).

Testing extreme rays. For the details of testing all possible extreme rays, please refer to FO-INCREASING-TEST (Algorithm 4) and Appendix A.2. FO-INCREASING-TEST computes all possible extreme rays ṽk and tests if they satisfy g k (z, ṽk ) T ṽk ≥ 0. If the inequality is not satisfied by an extreme ray ṽk , then this is a descent direction, so we return ṽk . If the inequality holds with equality, it means this is a flat extreme ray, and it needs to be checked in second-order test, so we save this extreme ray for future use.

How many flat extreme rays (g k (z, ṽk ) T ṽk = 0) are there? Presence of flat extreme rays introduce inequality constraints in the QP that we solve in the second-order test. It is ideal not to have them, because in this case there are only equality constraints, so the QP is easier to solve. Lemma A.1 in Appendix A.2 shows the conditions for having flat extreme rays; in short, there is a flat extreme ray if

[W 2 ] T •,k ∇ i = 0 or s * i = s + or s -.

For more details, please refer to Appendix A.2.

3.3 TESTING η T H(z, η)η ≥ 0 FOR {η | g(z, η) T η = 0} (LINES 11-16)

The second-order test checks η T H(z, η)η ≥ 0 for "flat" η's satisfying g(z, η) T η = 0. This is done with help of the function SO-TEST (Algorithm 5). Given its input {σ i,k } k∈[d h ],i∈B k , it defines fixed "Jacobian" matrices J i for all data points and equality/inequality constraints for boundary data points, and solves the QP of the following form:

EQUATION

Constraints and number of QPs. There are d h equality constraints of the form

[W 2 ] T •,k u k = [[W 1 ] k,• [b 1 ] k ] v k .

These equality constraints are due to the nonnegative homogeneous property of activation h; i.e., scaling [W 1 ] k,• and [b 1 ] k by α > 0 and scaling [W 2 ] •,k by 1/α yields exactly the same network. So, these equality constraints force η to be orthogonal to the loss-invariant directions. This observation is stated more formally in Lemma A.2, which as a corollary shows that any differentiable FOSP of R always has rank-deficient Hessian. The other constraints make sure that the union of feasible sets of QPs is exactly {η | g(z, η) T η = 0} (please see Lemma A.3 in Appendix A.3 for details). It is also easy to check that these constraints are all linearly independent.

If there is no flat extreme ray, the algorithm solves just one QP with d h + M equality constraints. If there are flat extreme rays, the algorithm solves one QP with d h + M equality constraints, and 2 K more QPs with d h + M -L equality constraints and L inequality constraints, where

K := d h k=1 {i ∈ B k | [W 2 ] T •,k ∇ i = 0} , L := d h k=1 |{i ∈ B k | vi,k or -v i,k is a flat ext. ray}| . (5) Recall from Section 3.2 that i ∈ B k has a flat extreme ray if [W 2 ] T •,k ∇ i = 0 or s * i = s + or s -; thus, K ≤ L ≤ M . Please refer to Appendix A.3 for more details.

Efficiency of solving the QPs (4). Despite NP-hardness of general QPs, our specific form of QPs (4) can be solved quite efficiently, avoiding exponential complexity in p. After solving QP (4), there are three (disjoint) termination conditions:

(T1) η T Qη > 0 whenever η ∈ S, η = 0, or (T2) η T Qη ≥ 0 whenever η ∈ S, but ∃η = 0, η ∈ S such that η T Qη = 0, or (T3) ∃η such that η ∈ S and η T Qη < 0, where S is the feasible set of QP. With the following two lemmas, we show that the termination conditions can be efficiently tested for ECQPs and ICQPs. First, the ECQPs can be iteratively solved with projected gradient descent, as stated in the next lemma. Lemma 3. Consider the QP, where Q ∈ R p×p is symmetric and A ∈ R q×p has full row rank: minimize η 1 2 η T Qη subject to Aη = 0 q Then, projected gradient descent (PGD) updates

η (t+1) = (I -A T (AA T ) -1 A)(I -αQ)η (t)

with learning rate α < 1/λ max (Q) converges to a solution or diverges to infinity exponentially fast. Moreover, with random initialization, PGD correctly checks conditions (T1)-(T3) with probability 1.

The proof is an extension of unconstrained case (Lee et al., 2016) , and is deferred to Appendix B.3. Note that it takes O(p 2 q) time to compute (I -A T (AA T ) -1 A)(I -αQ) in the beginning, and each update takes O(p 2 ) time. It is also surprising that the convergence rate does not depend on q.

In the presence of flat extreme rays, we have to solve QPs involving L inequality constraints. We prove that our ICQP can be solved in O(p 3 + L 3 2 L ) time, which implies that as long as the number of flat extreme rays is small, the problem can still be solved in polynomial time in p. Lemma 4. Consider the QP, where Q ∈ R p×p is symmetric, A ∈ R q×p and B ∈ R r×p have full row rank, and A T B T has rank q + r:

minimize η η T Qη subject to Aη = 0 q , Bη ≥ 0 r .

Then, there exists a method that checks whether (T1)-(T3) in O(p 3 + r 3 2 r ) time.

In short, we transform η to define an equivalent problem, and use classical results in copositive matrices (Martin & Jacobson, 1981; Seeger, 1999; Hiriart-Urruty & Seeger, 2010) ; the problem can be solved by computing the eigensystem of a (p-q -r)×(p-q -r) matrix, and testing copositivity of an r × r matrix. The proof is presented in Appendix B.4.

Concluding the test. During all calls to SO-TEST, whenever any QP terminated with (T3), then SOSP-CHECK immediately returns the direction and terminates. After solving all QPs, if any of SO-TEST calls finished with (T2), then we conclude SOSP-CHECK with "SOSP." If all QPs terminated with (T1), then we can return "Local Minimum." 

x i + b 1 ] k | < 10 -5

, which gives an estimate of M k . Moreover, for these points, we solved the QP (2) using L-BFGS-B (Byrd et al., 1995) , to check if the terminated points are indeed (approximate) FOSPs. We could see that the optimal values of (2) are close to zero (≤ 10 -6 typically, ≤ 10 -3 for largest problems). After solving (2), we counted the number of s * i 's that ended up with 0 or 1. The number of such s * i 's is an estimate of L -K. We also counted the number of approximate boundary data points satisfying

|[W 2 ] T •,k ∇ i | < 10 -4

, for an estimate of K. We ran the above-mentioned experiments for different settings of (d x , d h , m), 40 times each. We fixed d y = 1 for simplicity. For large d h , the optimizer converged to near-zero minima, making ∇ i uniformly small, so it was difficult to obtain accurate estimates of K and L. Thus, we had to perform experiments in settings where the optimizer converged to minima that are far from zero.

Table 1 summarizes the results. Through 280 runs, we observed that there are surprisingly many boundary data points (M ) in general, but usually there are zero or very few (maximum was 3) flat extreme rays (L). This observation suggests two important messages: (1) many local minima are on nondifferentiable points, which is the reason why our analysis is meaningful; (2) luckily, L is usually very small, so we only need to solve ECQPs (L = 0) or ICQPs with very small number of inequality constraints, which are solved efficiently (Lemmas 3 and 4). We can observe that M , L, and K indeed increase as model dimensions and training set get larger, but the rate of increase is not as fast as d x , d h , and m.

5. DISCUSSION AND FUTURE WORK:

We provided a theoretical algorithm that tests second-order stationarity and escapes saddle points, for any points (including nondifferentiable ones) of empirical risk of shallow ReLU-like networks. Despite difficulty raised by boundary data points dividing the parameter space into 2 M regions, we reduced the computation to d h convex QPs, O(M ) equality/inequality tests, and one (or a few more) nonconvex QP. In benign cases, the last QP is equality constrained, which can be efficiently solved with projected gradient descent. In worse cases, the QP has a few (say L) inequality constraints, but it can be solved efficiently when L is small. We also provided empirical evidences that L is usually either zero or very small, suggesting that the test can be done efficiently in most cases. A limitation of this work is that in practice, exact nondifferentiable points are impossible to reach, so the algorithm must be extended to apply the nonsmooth analysis for points that are "close" to nondifferentiable ones. Also, current algorithm only tests for exact SOSP, while it is desirable to check approximate second-order stationarity. These extensions must be done in order to implement a robust numerial version of the algorithm, but they require significant amount of additional work; thus, we leave practical/robust implementation as future work. Also, extending the test to deeper neural networks is an interesting future direction. Algorithm 2 SOSP-CHECK

Input: A tuple (W j , b j ) 2 j=1 of R(•). 1: if m i=1 ∇ i O(x i ) T 1 = 0 dy×(d h +1) then 2: return [∆ 2 δ 2 ] ← - m i=1 ∇ i O(x i ) T 1 , ∆ 1 ← 0 d h ×dx , δ 1 ← 0 d h . 3: end if 4: for k ∈ [d h ] do 5: if M k > 0 then 6: {s * i } i∈B k ← FO-SUBDIFF-ZERO-TEST(k) 7: ṽT k ← [W 2 ] T •,k (C k + i∈B k s * i ∇ i xT i ).

8:

if ṽk = 0 dx+1 then 9:

return v k ← -ṽ k , ∀k ∈ [d h ] \ {k}, v k ← 0 dx+1 , ∆ 2 ← 0 dy×d h , δ 2 ← 0 dy . 10: end if 11: (decr, ṽk , {S i,k } i∈B k ) ← FO-INCREASING-TEST(k, {s * i } i∈B k ).

12:

if decr = True then 13:

return v k ← ṽk , ∀k ∈ [d h ] \ {k}, v k ← 0 dx+1 , ∆ 2 ← 0 dy×d h , δ 2 ← 0 dy . 14: end if 15: else if [W 2 ] T •,k C k = 0 T dx+1 then 16: return v k ← -C T k [W 2 ] •,k , ∀k ∈ [d h ] \ {k}, v k ← 0 dx+1 , ∆ 2 ← 0 dy×d h , δ 2 ← 0 dy . 17: end if 18: end for 19: (decr, sosp, (∆ j , δ j ) 2 j=1 ) ← SO-TEST({0} k∈[d h ],i∈B k ). 20: if decr = True then return (∆ j , δ j ) 2 j=1 . 21: end if 22: if M = 0 and {S i,k } k∈[d h ],i∈B k = {{0}} k∈[d h ],i∈B k then 23: for each element {σ i,k } k∈[d h ],i∈B k ∈ k∈[d h ] i∈B k S i,k do 24: (decr, sospTemp, (∆ j , δ j ) 2 j=1 ) ← SO-TEST({σ i,k } k∈[d h ],i∈B k ).

25::

if decr = True then return (∆ j , δ j ) 2 j=1 .

26::

end if 

EQUATION

) 2: return {s * i } i∈B k .

A FULL ALGORITHMS AND PROOF OF CORRECTNESS:

In this section, we present the detailed operation of SOSP-CHECK (Algorithm 2), and its helper functions FO-SUBDIFF-ZERO-TEST, FO-INCREASING-TEST, and SO-TEST (Algorithm 3-5).

In the subsequent subsections, we provide a more detailed proof of the correctness of Algorithm 2. Recall that, by Lemmas 1 and 2, M k := |B k | ≤ d x and vectors {x i } i∈B k are linearly independent. Also, we can expand R(z + η) so that

R(z + η) = R(z) + g(z, η) T η + 1 2 η T H(z, η)η + o( η 2 ), Algorithm 4 FO-INCREASING-TEST Input: k ∈ [d h ], {s * i } i∈B k 1: for all i ∈ B k do 2: Define S i,k ← ∅. 3: Get a vector vi,k ∈ V k ∩ span{x j | j ∈ B k \ {i}} ⊥ . 4: for ṽk ∈ {v i,k , -v i,k } do 5: Define σ i,k ← sign(x T i ṽk ). 6: if (s σ i,k -s * i )[W 2 ] T •,k ∇ i xT i ṽk < 0 then 7: return (True, ṽk , {∅} i∈B k ) 8: else if (s σ i,k -s * i )[W 2 ] T •,k ∇ i xT i ṽk = 0 then 9: S i,k ← S i,k ∪ {σ i,k }. 10: end if 11:

end for 12:

If S i,k = ∅, S i,k ← {0}. 13: end for 14: return (False, 0 dx+1 , {S i,k } i∈B k ). Algorithm 5 SO-TEST Input: {σ i,k } k∈[d h ],i∈B k 1: For all i ∈ [m], define diagonal matrices J i ∈ R d h ×d h such that for k ∈ [d h ], [J i ] k,k ←    h ([N (x i )] k ) if i ∈ [m] \ B k s σ i,k if i ∈ B k and σ i,k ∈ {-1, +1} 0 if i ∈ B k and σ i,k = 0.

2: Solve the following QP. If there is no solution, get a descent direction

EQUATION

):

3: if There is no solution then return (True, False, (∆ * j , δ * j ) 2 j=1 ). 4: else if QP has nonzero minimizers then return (False, True, 0) 5: else return (False, False, 0) 6: end if where g(z, η) and H(z, η) satisfy

g(z, η) T η = i ∇ T i dY 1 (x i ) = i ∇ i O(x i ) T , ∆ 2 + i ∇ i , δ 2 + d h k=1 g k (z, v k ) T v k , η T H(z, η)η = i ∇ T i dY 2 (x i ) + 1 2 i dY 1 (x i ) 2 ∇ 2 i ,

and

g k (z, v k ) T := [W 2 ] T •,k C k + i∈B k h (x T i v k )∇ i xT i .

A.1 TESTING FIRST-ORDER STATIONARITY (LINES 1-3, 6-10 AND 15-17)

A.1.1 TEST OF FIRST-ORDER STATIONARITY FOR W 2 AND b 2 (LINES 1-3) Lines 1-3 of Algorithm 2 correspond to testing if ∂ W2 R = {0 dy×d h } and ∂ b2 R = {0 dy }.

If they are not all zero, the opposite direction is a descent direction, as Line 2 returns. To see why, suppose

m i=1 ∇ i O(x i ) T 1 = 0 dy×(d h +1) . Then choose perturbations [∆ 2 δ 2 ] = - m i=1 ∇ i O(x i ) T 1 , ∆ 1 = 0 d h ×dx , δ 1 = 0 d h .

If we apply perturbation (γ∆ j , γδ j ) 2 j=1 where γ > 0, we can immediately check that dY 1 (

x i ) = ∆ 2 O(x i ) + δ 2 and dY 2 (x i ) = 0. So, g(z, η) T η = m i=1 ∇ T i (∆ 2 O(x i ) + δ 2 ) = m i=1 ∇ i O(x i ) T 1 , [∆ 2 δ 2 ] = -O(γ), η T H(z, η)η = 1 2 i dY 1 (x i ) T ∇ 2 i dY 1 (x i ) = O(γ 2 ) ≥ 0.

and also that

m i=1 dY (x i ) 2 2 = O(γ 2 ).

Then, by scaling γ sufficiently small we can achieve R(z + η) < R(z), which disproves that (W j , b j ) 2 j=1 is a local minimum.

A.1.2 TEST OF FIRST-ORDER STATIONARITY FOR W 1 AND b 1 (LINES 6-10 AND 15-17)

Test for W 1 and b 1 is more difficult because g(z, η) depends on ∆ 1 and δ 1 when there are boundary data points.

Recall that v T k (k ∈ [d h ]) is the k-th row of [∆ 1 δ 1 ]. Then note from Lemma 2 that m i=1 ∇ T i (W 2 J(x i )(∆ 1 x i + δ 1 )) = d h k=1 g k (z, v k ) T v k , where g k (z, v k ) T := [W 2 ] T •,k C k + i∈B k h (x T i v k )∇ i xT i .

Thus we can separate k's and treat them individually.

Test for zero gradient. Recall the definition M:

k := |B k |. If M k = 0,

there is no boundary data point for k-th hidden node, so the Clarke subdifferential with respect to

[W 1 b 1 ] k,• , is {C T k [W 2 ] •,k }.

Lines 15-17 handle this case; if the singleton element in the subdifferential is not zero, its opposite direction is a descent direction, so return that direction, as in Line 16.

Test for zero in subdifferential. For the case M k > 0, we saw that for boundary data points

i ∈ B k , h ([∆ 1 x i + δ 1 ] k ) = h (x T i v k ) ∈ {s -, s + } depends on v k . Lines 6-10 test if 0 T dx+1 is in the Clarke subdifferential of R with respect to [W 1 ] k,• and [b 1 ] k .

Since the subdifferential is used many times, we give it a specific name

D k := ∂ [W1 b1] k,• R. By observing that D k is the convex hull of all possible values of g k (z, v k ) T , D k := [W 2 ] T •,k C k + i∈B k s i ∇ i xT i | min{s -, s + } ≤ s i ≤ max{s -, s + }, ∀i ∈ B k .

Testing 0 T dx+1 ∈ D k is done by FO-SUBDIFF-ZERO-TEST in Algorithm 3. It solves a convex QP (2), and returns

{s * i } i∈B k . If 0 T dx+1 ∈ D k , {s * i } i∈B k will satisfy ṽT k := [W 2 ] T •,k (C k + i∈B k s * i ∇ i xT i ) = 0 T dx+1 . Suppose 0 T dx+1 / ∈ D k . Then, ṽk is the closest vector in D k from the origin, so ṽk , v > 0 for all v T ∈ D k . Choose perturbations v k = -ṽ k , v k = 0 dx+1 for all k ∈ [d h ] \ {k}, ∆ 2 = 0 dy×d h , δ 2 = 0 dy ,

and apply perturbation (γ∆ j , γδ j ) 2 j=1 where γ > 0. With this perturbation, we can check that

g(z, η) T η = m i=1 ∇ T i dY 1 (x i ) = -γ[W 2 ] T •,k C k + i∈B k h (-x T i ṽk )∇ i xT i ṽk ,

and since h (-x T i ṽk ) ∈ {s -, s + } for i ∈ B k , we have

[W 2 ] T •,k C k + i∈B k h (-x T i ṽk )∇ i xT i ∈ D k ,

and ṽk , v > 0 for all v T ∈ D k shows that g(z, η) T η is strictly negative with magnitude O(γ). It is easy to see that η T H(z, η)η = O(γ 2 ), so by scaling γ sufficiently small we can disprove local minimality of (W j , b j ) 2 j=1 .

A.2 TESTING g(z, η) T η ≥ 0 FOR ALL η (LINES 11-14)

Linear program formulation. Lines 11-14 are essentially about testing if

EQUATION

Solving these LPs and checking if the minimum value is 0 suffices to prove g k (z, v k ) T v k ≥ 0 for all small enough perturbations. Recall that

V k := span{x i | i ∈ B k } and dim(V k ) = M k . Note that any component of v k that is orthogonal to V k is also orthogonal to g k (z, v k )

, so it does not affect the objective function of any LP (3). Thus, the constraint v k ∈ V k is added to the LP (3), which is equivalent to adding d x +1-M k linearly independent equality constraints. The feasible set of LP (3) has d x + 1 linearly independent equality/inequality constraints, which implies that the feasible set is a pointed polyhedral cone with vertex at origin. Since any point in a pointed polyhedral cone is a conical combination (linear combination with nonnegative coefficients) of extreme rays of the cone, checking nonnegativity of the objective function for all extreme rays suffices. We emphasize that we do not solve the LPs (3) in our algorithm; we just check the extreme rays.

Computational efficiency. Extreme rays of a pointed polyhedral cone in R dx+1 are computed from d x linearly independent active constraints. Line 3 of Algorithm 4 is exactly computing such extreme rays:

vi,k ∈ V k ∩ span{x j | j ∈ B k \ {i}} ⊥ for each i ∈ B k , tested in both directions.

Note that there are 2M k extreme rays, and one extreme ray vi,k is shared by 2 M k -1 polyhedral cones. Moreover, xT j vi,k = 0 for j ∈ B k \ {i}, which indicates that

g k (z, vi,k ) T vi,k = (s σ i,k -s * i )[W 2 ] T •,k ∇ i xT i vi,k

, where σ i,k = sign(x T i vi,k ), regardless of {σ j } j∈B k \{i} . This observation is used in Lines 6 and 8 of Algorithm 4. Testing g k (z, ṽk ) T ṽk ≥ 0 for an extreme ray ṽk can be done with a single inequality test instead of 2 M k -1 separate tests for all cones! Thus, this extreme ray approach instead of solving individual LPs greatly reduces computation, from

O(2 M k ) to O(M k ).

Algorithm operation in detail. Testing all possible extreme rays is exactly what FO-INCREASING-TEST in Algorithm 4 is doing. Output of FO-INCREASING-TEST is a tuple of three items: a boolean, a (d x + 1)-dimensional vector, and a tuple of M k sets. Whenever we have a descent direction, it returns True and the descent direction ṽk . If there is no descent direction, it returns False and the sets {S i,k } i∈B k .

For both direction of extreme rays ṽk = vi,k and ṽk = -v i,k (Line 4), we check if g k (z, ṽk ) T ṽk ≥ 0. Whenever it does not hold (Lines 6-7), ṽk is a descent direction, so FO-INCREASING-TEST returns it with True. Line 13 of Algorithm 2 uses that ṽk to return perturbations, so that scaling by small enough γ > 0 will give us a point with R(z + γη) < R(z). If equality holds (Lines 8-9), this means ṽk is a direction of perturbation satisfying g(z, η) T η = 0, so this direction needs to be checked if η T H(z, η)η ≥ 0 too. In this case, we add the sign of boundary data point xi to S i,k for future use in the second-order test. The operation with S i,k will be explained in detail in Appendix A.3. After checking if g k (z, ṽk ) T ṽk ≥ 0 holds for all extreme rays, FO-INCREASING-TEST returns False with {S i,k } i∈B k .

Counting flat extreme rays. How many of these extreme rays satisfy g k (z, ṽk ) T ṽk = 0? Presence of such flat extreme rays introduce inequality constraints in the QP that we will solve in SO-TEST (Algorithm 5). It is ideal not to have flat extreme rays, because in this case there are only equality constraints, so the QP is easier to solve. The following lemma shows conditions for existence of flat extreme rays as well as output of Algorithm 4. Lemma A.1. Suppose 0 T dx+1 ∈ D k and all extreme rays ṽk satisfy g k (z, ṽk ) T ṽk ≥ 0. Consider all i ∈ B k , and its corresponding vi,k

∈ V k ∩ span{x j | j ∈ B k \ {i}} ⊥ . 1. If [W 2 ] T

•,k ∇ i = 0, then both extreme rays vi,k and -v i,k are flat extreme rays, and S i,k = {-1, +1} at the end of Algorithm 4.

2.. If [W 2 ] T:

•,k ∇ i = 0 and s * i = s + (or s -), one (and only) of ṽk ∈ {v i,k , -v i,k } that satisfies sign(x T i ṽk ) = +1 (or -1) is a flat extreme ray, and S i,k = {+1} (or {-1}) at the end of Algorithm 4.

•,k ∇ i = 0 and s * i = s ± , both vi,k and -v i,k are not flat extreme rays, and S i,k = {0} at the end of Algorithm 4.

Proof First note that we already assumed that all extreme rays ṽk satisfy g k (z, ṽk ) T ṽk ≥ 0, so SOSP-CHECK will reach Line 14 at the end. Also note that xi 's in i ∈ B k are linearly independent (by Lemma 1), so xT i vi,k = 0.

If [W 2 ] T •,k ∇ i = 0, then (s σ i,k -s * i )[W 2 ] T •,k ∇ i xT i ṽk = 0 regardless of ṽk , so both vi,k and -v i,k are flat extreme rays. If [W 2 ] T •,k ∇ i = 0 and s * i = s + , ṽk ∈ {v i,k , -v i,k } that satisfies sign(x T i ṽk ) = +1 gives σ i,k = +1, so s σ i,k = s * i .

Thus, ṽk is a flat extreme ray. The case with . Also, it follows from the definition of K and L (5) that

s * i = s -is proved similarly. If [W 2 ] T •,k ∇ i = 0 and s * i = s + , none of (s ± -s * i ), [W 2 ] T •,k ∇ i ,

K = d h k=1 |B (1) k |, L = d h k=1 |B (1) k | + |B (2) k |.

Connection to KKT conditions. As a side remark, we provide connections of our tests to the wellknown KKT conditions. Note that the equality

g k (z, v k ) T = [W 2 ] T •,k i∈B k (s σi -s * i )∇ i xT i for σ i xT i v k ≥ 0, ∀i ∈ B k corresponds to the KKT stationarity condition, where (s σi -s * i )[W 2 ] T

•,k ∇ i 's correspond to the Lagrange multipliers for inequality constraints. Then, testing extreme rays is equivalent to testing dual feasibility of Lagrange multipliers, and having zero dual variables ([W 2 ] T

•,k ∇ i = 0 or s * i = s + or s -, resulting in flat extreme rays) corresponds to having degeneracy in the complementary slackness condition.

As mentioned in Section 2.1, given that g(z, η) and H(z, η) are constant functions of η in each polyhedral cone, one can define inequality constrained optimization problems and try to solve for KKT conditions for z directly. However, this also requires solving 2 M problems. The strength of our approach is that by solving the QPs (2), we can automatically compute the exact Lagrange multipliers for all 2 M subproblems, and dual feasibility is also tested in O(M ) time.

A.3 TESTING η T H(z, η)η ≥ 0 FOR {η | g(z, η) T η = 0} (LINES 19-32)

The second-order test checks η T H(z, η)η ≥ 0 for "flat" η's satisfying g(z, η) T η = 0. This is done with help of the function SO-TEST in Algorithm 5. Given its input {σ i,k } k∈[d h ],i∈B k , it defines fixed "Jacobian" matrices J i for all data points and equality/inequality constraints for boundary data points, and solves the QP (4).

, σ i,k xT i v k ≥ 0 = v k | ∀i ∈ B (3) k , xT i v k = 0, and ∀i ∈ B (2) k , σ i,k xT i v k ≥ 0 = v k | g k (z, v k ) T v k = 0 .

The proof of Lemma A.3 is in Appendix B.6.

In total, there are d h + M -L equality constraints and L inequality constraints in each nonconvex QP. It is also easy to check that these constraints are all linearly independent.

How many QPs do we solve? Note that in Line 19, we call SO-TEST with {σ i,k } k∈[d h ],i∈B k = 0, which results in a QP (4) with d h + M equality constraints. This is done even when we have flat extreme rays, just to take a quick look if a descent direction can be obtained without having to deal with inequality constraints.

If there exist flat extreme rays (Line 22), the algorithm calls SO-TEST for each element of

k∈[d h ] i∈B k S i,k . Recall that |S i,k | = 2 for i ∈ B (1) k , so k∈[d h ] i∈B k S i,k = 2 K .

In summary, if there is no flat extreme ray, the algorithm solves just one QP with d h + M equality constraints. If there are flat extreme rays, the algorithm solves one QP with d h + M equality constraints, and 2 K QPs with d h + M -L equality constraints and L inequality constraints. This is also an improvement from the naive approach of solving 2 M QPs.

Concluding the test. After solving the QP, SO-TEST returns result to SOSP-CHECK. The algorithm returns two booleans and one perturbation tuple. The first is to indicate that there is no solution, i.e., there is a descent direction that leads to -∞. Whenever there was any descent direction then we immediately return the direction and terminate. The second boolean is to indicate that there are nonzero η that satisfies η T H(z, η)η = 0. After solving all QPs, if any of SO-TEST calls found out η = 0 such that g(z, η) T η = 0 and η T H(z, η)η = 0, then we conclude SOSP-CHECK with "SOSP. 

[W 1 ] k,• x + [b 1 ] k = 0.

By the assumption, we cannot have more than d x points on the hyperplane.

Next, assume for the sake of contradiction that the M k := |B k | data points xi 's are linearly dependent, i.e., there exists a 1 , . . . , a M k ∈ R, not all zero, such that

M k i=1 a i x i 1 = 0 =⇒ a 1 = - M k i=2 a i =⇒ M k i=2 a i (x i -x 1 ) = 0,

where a 2 , . . . , a M k are not all zero. This implies that these M k points x i 's are on the same (M k -2)dimensional affine space. To see why, consider for example the case M k = 3: a 2 (x 2 -x 1 ) = -a 3 (x 3 -x 1 ), meaning that they have to be on the same line. By adding any d x + 1 -M k additional x i 's, we can see that d x + 1 points are on the same (d x -1)-dimensional affine space, i.e., a hyperplane in R dx . This contradicts Assumption 2.

B.2 PROOF OF LEMMA 2:

From Assumption 1, (w, y) is twice differentiable and convex in w. By Taylor expansion of (

•) at (Y (x i ), y i ), R(z + η) = m i=1 (Y (x i ) + dY (x i ), y i ) = m i=1 (Y (x i ), y i ) + ∇ T i dY (x i ) + 1 2 dY (x i ) T ∇ 2 i dY (x i ) + o( η 2 ) = R(z) + m i=1 ∇ T i dY 1 (x i ) + m i=1 ∇ T i dY 2 (x i ) + 1 2 m i=1 dY 1 (x i ) 2 ∇ 2 i + o( η 2 ),

where the first-order term

m i=1 ∇ T i dY 1 (x i ) = m i=1 ∇ T i (∆ 2 O(x i )+δ 2 +W 2 J(x i )(∆ 1 x i +δ 1 )) can be further expanded to show m i=1 ∇ T i (∆ 2 O(x i ) + δ 2 ) = ∆ 2 , i ∇ i O(x i ) T + δ 2 , i ∇ i , m i=1 ∇ T i (W 2 J(x i )(∆ 1 x i + δ 1 )) = tr m i=1 J(x i )W T 2 ∇ i xT i ∆ T 1 δ T 1 = d h k=1 [W 2 ] T •,k m i=1 [J(x i )] k,k ∇ i xT i v k = d h k=1 [W 2 ] T •,k C k + i∈B k h (x T i v k )∇ i xT i v k .

Also, note that in each of the 2 M divided region (which is a polyhedral cone) of η, J(x i ) stays constant for all i ∈ [m]; thus, g(z, η) and H(z, η) are piece-wise constant functions of η. Specifically, since the parameter space is partitioned into polyhedral cones, we have g(z, η) = g(z, γη) and H(z, η) = H(z, γη) for any γ > 0.

B.3 PROOF OF LEMMA 3:

Suppose that w 1 , w 2 , . . . , w q are orthonormal basis of row(A). Choose w q+1 , . . . , w p so that w 1 , w 2 , . . . , w p form an orthonormal basis of R p . Let W be an orthogonal matrix whose columns are w 1 , w 2 , . . . , w p , and Ŵ be an submatrix of W whose columns are w q+1 , . . . , w p . With this definition, note that I -A T (AA T ) -1 A = Ŵ Ŵ T .

Suppose that we are given η (t) satisfying Aη (t) = 0. Then we can write η (t) = Ŵ µ (t) , where µ (t) ∈ R p-q and [µ (t) ] i = w T i+q η (t) . Define µ (t+1) likewise. Then, noting η -q) , and then write its eigen-decomposition C = V SV T and denote its eigenvectors as ν 1 , . . . , ν p-q and its corresponding eigenvalues λ 1 , . . . , λ p-q . Then note

(t) = Ŵ Ŵ T η (t) gives Ŵ µ (t+1) = η (t+1) = η (t) -α Ŵ Ŵ T Q Ŵ µ (t) = Ŵ (I -α Ŵ T Q Ŵ )µ (t) . Define C := Ŵ T Q Ŵ ∈ R (p-q)×(p

µ (t+1) = (I -αC)µ (t) = (I -αV SV T ) p-q i=1 (ν T i µ (t) )ν i = p-q i=1 (1 -αλ i )(ν T i µ (t) )ν i = p-q i=1 (1 -αλ i ) 2 (ν T i µ (t-1) )ν i = • • • = p-q i=1 (1 -αλ i ) t+1 (ν T i µ (0) )ν i .

This proves that this iteration converges or diverges exponentially fast. Starting from the initial point η (0) = Ŵ µ (0) , the component of µ (0) that corresponds to negative eigenvalue blows up exponentially fast, those corresponding to positive eigenvalue shrinks to zero exponentially fast (if α < 1/λ max (C)), and those with zero eigenvalue will stay invariant. Therefore, if there exists λ i < 0, then η (t) blows up to infinity quickly and finds an η such that η T Qη < 0 (T3). If all λ i ≥ 0, it converges exponentially fast to Ŵ i:λi=0 (ν T i µ (0) )ν i (T2). If all λ i > 0, η (t) → 0 (T1). It is left to prove that α < 1/λ max (Q) guarantees convergence, as stated. To this end, it suffices to show that λ max (Q) ≥ λ max (C). Note that

C = Ŵ T Q Ŵ = Ŵ T W W T QW W T Ŵ = [0 I] W T QW 0 I .

Using the facts that λ max (Q) = λ max (W T QW ) and C is a principal submatrix of W T QW ,

λ max (Q) = max x

x T W T QW x x T x ≥ max

x:[x]1:q=0

x T W T QW x x T x = λ max (C).

Also, if we start at a random initial point (e.g., sample from a Gaussian in R p and project to row(A) ⊥ ), then with probability 1 we have ν T i µ (0) = 0 for all i ∈ [p -q], so we will get the correct convergence/divergence result almost surely.

B.4 PROOF OF LEMMA 4 B.4.1 PRELIMINARIES Before we prove the complexity lemma, we introduce the definitions of copositivity and Pareto spectrum, which are closely related concepts to our specific form of QP. Definition B.1. Let Q ∈ R r×r be a symmetric matrix. We say that Q is copositive if η T Qη ≥ 0 for all η ≥ 0. Moreover, strict copositivity means that η T Qη > 0 for all η ≥ 0, η = 0.

Testing whether Q is not copositive known to be NP-complete (Murty & Kabadi, 1987) ; it is certainly a difficult problem. There is a method testing cositivity of Q in O(r 3 2 r ) time which uses its Pareto spectrum Π(Q). The following is the definition of Pareto spectrum, taken from Seeger Lemma B.3 (Theorem 2.2 of Martin & Jacobson (1981) ). If B = B1 B2 , with B1 r × r invertible, then with Rij 's given as above, w T Rw > 0 whenever Bw ≥ 0, w = 0 if and only if

• R22 is positive definite, and

• R11 -R12 R-1 22 RT

12 is strictly copositive. Lemma B.4 (Theorem 2.1 of Martin & Jacobson (1981) ). If B = B1 B2 , with B1 r × r invertible, then with Rij 's given as above, w T Rw ≥ 0 whenever Bw ≥ 0 if and only if

• R22 is positive semidefinite, null( R22 ) ⊆ null( R12 ), and

• R11 -R12 R † 22 RT 12 is copositive,

where R † 22 is a pseudoinverse of R22 . Using Lemmas B.3 and B.4, we now describe how to test our given QP and declare one of (T1), (T2), or (T3). First, we compute the eigensystem of R22 and see which of the following disjoint categories it belongs to: (PD1) All eigenvalues λ 1 , . . . , λ p-q-r of R22 satisfy λ i > 0.

(PD2) ∀i, λ i ≥ 0, but ∃i such that λ i = 0, and ∀ν 2 s.t. R22 ν 2 = 0, we have R12 ν 2 = 0. (PD3) ∀i, λ i ≥ 0, but ∃i such that λ i = 0, and ∃ν 2 s.t. R22 ν 2 = 0 but R12 ν 2 = 0. (PD4) ∃i such that λ i < 0, i.e., ∃ν 2 such that ν T 2 R22 ν 2 < 0.

If the test comes out (PD3) or (PD4), then we can immediately declare (T3) without having to look at copositivity. This is because if we get (PD4), we can choose ν 1 = 0 so that ν T Rν = ν T 2 R22 ν 2 < 0. In case of (PD3), one can fix any ν 1 satisfying ν T 1 R12 ν 2 = 0, and by scaling ν 2 to positive or negative we can get ν T Rν → -∞. Notice that once we have these ν satisfying ν T Rν < 0, we can recover η from ν by backtracking the transformations.

Next, compute the Pareto spectrum of S := R11 -R12 R †

22:

RT 12 and check which case S belongs to:

(CP1) S = R11 -R12 R †

RT 12 is strictly copositive. (CP2) S is copositive, but ∃ν 1 ≥ 0, ν 1 = 0 such that ν T 1 Sν 1 = 0. (CP3) ∃ν 1 ≥ 0 such that ν T 1 Sν 1 < 0.

Here, ν 1 's are Pareto eigenvectors of S defined in Lemma B.2. If we have (CP3), we can declare (T3) because one can fix ν 2 = -R † 22 R T 12 ν 1 and get ν T Rν = ν T 1 Sν 1 < 0. If the tests come out (PD1) and (CP1), by Lemma B.3 we have (T1). For the remaining cases, we conclude (T2).

B.5 PROOF OF LEMMA A.2:

With the given η,

∆ 1 =   0 (k-1)×dx [W 1 ] k,• 0 (d h -k)×dx   , δ 1 = 0 k-1 [b 1 ] k 0 d h -k , ∆ 2 = 0 dy×(k-1) -[W 2 ] •,k 0 dy×(d h -k) .

It is straightforward to check that for all i ∈ [m],

dY 1 (x i ) = ∆ 2 O(x i ) + W 2 J(x i )(∆ 1 x i + δ 1 ) = -[O(x i )] k [W 2 ] •,k + W 2 0 k-1 [O(x i )] k 0 d h -k = 0.

From this, g(z, η) T η = i ∇ T i dY 1 (x i ) = 0. For the second order terms,

η T H(z, η)η = m i=1 ∇ T i dY 2 (x i ) + 1 2 m i=1 dY 1 (x i ) 2 ∇ 2 i = m i=1 ∇ T i ∆ 2 J(x i )(∆ 1 x i + δ 1 ) = m i=1 ∇ T i (-[O(x i )] k [W 2 ] •,k ) = - m i=1 [O(x i )] k ∇ T i [W 2 ] •,k .

From the fact that z is a FOSP of R, it follows that i ∇ i O(x i ) T = 0, so η T H(z, η)η = 0.

:



Figures and Tables:

A 3-d surface plot of f (w, v).

Nondifferentiable points on (w, v) plane.

and xT i vi,k are zero, so vi,k and -v i,k cannot be flat. Let B (j) k ⊆ B k denote the set of indices i ∈ B k satisfying conditions in Lemma A.1.j (j = 1, 2, 3). Note that B (j) k 's partition the set B k . We denote the union of B can see from the lemma that |S i,k | = 2 for i ∈ B (1) k , and |S i,k | = 1 for i ∈ B (2,3) k

(1999); Hiriart-Urruty & Seeger (2010). Definition B.2. Consider the problem minimize η≥0, η 2 =1 η T Qη.KKT conditions for the above problem gives us a complementarity systemη ≥ 0, Qη -λη ≥ 0, η T (Qη -λη) = 0, η 2 = 1,(6)where λ ∈ R is viewed as a Lagrange multiplier associated withη 2 = 1. The number λ ∈ R is called a Pareto eigenvalue of Q if (6)admits a solution η. The set of all Pareto eigenvalues of Q, denoted as Π(Q), is called the Pareto spectrum of Q. The next lemma reveals the relation of copositivity and Pareto spectrum: Lemma B.1 (Theorem 4.3 of Hiriart-Urruty & Seeger (2010)). A symmetric matrix Q is copositive (or strictly copositive) if and only if all the Pareto eigenvalues of Q are nonnegative (or strictly positive).

Summary of experimental results ReLU networks with squared error loss. In practice, it is impossible to get to the exact nondifferentiable point, because they lie in a set of measure zero. To get close to those points, we ran Adam (Kingma & Ba, 2014) using full-batch (exact) gradient for 200,000 iterations and decaying step size (start with 10 -3 , 0.2× decay every 20,000 iterations). We observed that decaying step size had the effect of "descending deeper into the valley.

Table content: <table><tr><td>(dx, d h , m)</td><td colspan="2"># Runs Sum M (Avg.)</td><td colspan="3">Sum L (Avg.) Sum K (Avg.) P{L &gt; 0}</td></tr><tr><td>(10, 1, 1000)</td><td>40</td><td>290 (7.25)</td><td>0 (0)</td><td>0 (0)</td><td>0</td></tr><tr><td>(10, 1, 10000)</td><td>40</td><td>371 (9.275)</td><td>1 (0.025)</td><td>0 (0)</td><td>0.025</td></tr><tr><td>(100, 1, 1000)</td><td>40</td><td>1,452 (36.3)</td><td>0 (0)</td><td>0 (0)</td><td>0</td></tr><tr><td>(100, 1, 10000)</td><td>40</td><td>2,976 (74.4)</td><td>2 (0.05)</td><td>0 (0)</td><td>0.05</td></tr><tr><td>(100, 10, 10000)</td><td>40</td><td>24,805 (620.125)</td><td>4 (0.1)</td><td>0 (0)</td><td>0.1</td></tr><tr><td>(1000, 1, 10000)</td><td>40</td><td>14,194 (354.85)</td><td>0 (0)</td><td>0 (0)</td><td>0</td></tr><tr><td>(1000, 10, 10000)</td><td>40</td><td colspan="2">42,334 (1,058.35) 37 (0.925)</td><td>1 (0.025)</td><td>0.625</td></tr><tr><td>4 EXPERIMENTS</td><td/><td/><td/><td/><td/></tr><tr><td colspan="6">For experiments, we used artificial datasets sampled iid from standard normal distribution, and</td></tr><tr><td>trained 1-hidden-layer</td><td/><td/><td/><td/><td/></tr></table>

Yi Zhou and Yingbin Liang. Critical points of neural networks: Analytical forms and landscape properties. In International Conference on Learning Representations, 2018. Yi Zhou, Junjie Yang, Huishuai Zhang, Yingbin Liang, and Vahid Tarokh. SGD converges to global minimum in deep learning via star-convex path. In International Conference on Learning Representations, 2019.

Table content: <table><tr><td>Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Stochastic gradient descent optimizes</td></tr><tr><td>over-parameterized deep ReLU networks. arXiv preprint arXiv:1811.08888, 2018.</td></tr></table>

Solve the following optimization problem and get optimal solution {s

Table content: <table><tr><td>27:</td><td>sosp ← sosp ∨ sospTemp</td></tr><tr><td>28:</td><td>end for</td></tr><tr><td colspan="2">29: end if</td></tr><tr><td colspan="2">30: if sosp = True then return SOSP.</td></tr><tr><td colspan="2">31: else return Local Minimum.</td></tr><tr><td colspan="2">32: end if</td></tr><tr><td colspan="2">Algorithm 3 FO-SUBDIFF-ZERO-TEST</td></tr><tr><td/><td>Input: k ∈ [d h ]</td></tr><tr><td>1:</td><td/></tr></table>

By definition, we have[W 1 ] k,• x i + [b 1 ] k = 0 for all i ∈ B k ,meaning that they are all on the same hyperplane

Table content: <table><tr><td>B PROOF OF LEMMAS</td></tr><tr><td>B.1 PROOF OF LEMMA 1</td></tr><tr><td>Minimum."</td></tr></table>

Peer review (iclr2019):
 This paper proposes an efficient method to test whether a point is a local minimum in a 1-hidden-layer ReLU network. If the point is not a local minimum, the algorithm also returns a direction for descending the value of the loss function. The tests include a first-order stationary point test (FOSP), and a second-order stationary point test (SOSP). As these test can be written as QPs, the core challenge is that if there are M boundary points in the dataset, i.e., data points on a non-differentiable region of the ReLU function, then the FOSP test requires 2^M tests of extreme rays -- each boundary partition the whole space into at least two parts. This paper observes that since the feasible sets are pointed polyhedral cones. Therefore checking only these extreme rays suffices. This results in an efficient test with only 2M tests. Lastly, the paper performs experiments on synthetic data. It turns out there are surprisingly many boundary points. Comments: This paper proposes an interesting method of testing whether a given point is a local minimum or not in a ReLU network. The technique is non-trivial and requires some key observation to make it computationally efficient. However, I have the following concerns: 1) such a test may need very high numeric precision. For instance, you cannot make sure whether a floating point number is strictly greater than 0 or not. The small error may critically affect the property of a point. 2) boundary points of a ReLU network should have measure 0 (correct me if not). The finding in the experiment shows surprisingly many boundary points. This is counter-intuitive. Is it because of numeric issues? You might misclassify non-boundary points. 3) Usefulness. a. The paper claims that such a test would be very useful in practice. However, they cannot even perform an experiment on real datasets. b. Such a method only works for one-hidden layer network. It is not clear deeper network admit similar structure. c. Practical training of neural-network usually trains the network using SGD, which always obtain a solution with a non-zero gradient. In this sense, there is no need for such a testing. d. It seems like it is much easier to perform a test with different activation function, e.g., sigmoid. If the authors can address these concerns convincingly, I would be happy to change the rating.