E FFICIENTLY TESTING LOCAL OPTIMALITY AND ESCAPING SADDLES FOR R E LU NETWORKS
Anonymous authors
Paper under double-blind review
A BSTRACT
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 difﬁcult.
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 speciﬁc problem can be solved efﬁciently, 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 efﬁcient in most cases.
I NTRODUCTION
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.
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, 2017a;b; Safran & Shamir, 2017; Laurent & von Brecht, 2017;
Yun et al., 2018a;b; Zhou & Liang, 2018; Wu et al., 2018; Shamir, 2018) and the role of (stochastic) gradient-based methods (Tian, 2017; Brutzkus & Globerson, 2017; Du et al., 2017).
Besides nonconvexity, for ReLU networks signiﬁcant additional challenges in the analysis arise due to nondifferentiability, and obtaining a precise understanding of the nondifferentiable points is still elusive.
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.
Laurent & von Brecht (2017) 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 difﬁculty 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, 2017b) hold “almost surely”; some assume differentiability or make statements only for differentiable points (Nguyen & Hein, 2017a;
Yun et al., 2018a); others analyze population risk, in which case the nondifferentiability disappears after taking expectation (Tian, 2017; Brutzkus & Globerson, 2017; Du et al., 2017; Safran & Shamir, 2017; Wu et al., 2018).
1. S UMMARY 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.
Speciﬁcally, we provide a theoretical algorithm that tests second-order stationarity (SOS) 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; or even escape from saddle points!
What makes it nontrivial is that unlike Hessian based methods for escaping saddles, we do not have differentiability.
The key computational challenge in constructing our algorithm for nondifferentiable points is posed by data points that lie on the “boundary” of a hidden neuron.
Since each such data point bisects the parameter space into two halfspaces with different “slopes” of the loss surface, one runs into nondifferentiability.
If there are M such boundary data points , then in the worst case the parameter space divides into 2 M regions, so naively testing each region will be very inefﬁcient.
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 efﬁciently in most cases.
We further describe the challenges and key ideas in Section 2.1.
Remarks.
Many practitioners of deep learning rely on ﬁrst-order methods, without good termination criteria for the optimization problem.
Our algorithm proposes a tool for improvement: with a proper numerical implementation (although we leave numerical implementation to future work), it can test whether a given point is a SOSP, or extract a descent direction using second-order information.
One can imagine running a ﬁrst-order method until it “gets stuck,” then using our algorithm to test SOS or escape from the saddle.
This idea of mixing ﬁrst and second-order methods has been explored in differentiable problems (Carmon et al., 2016; Reddi et al., 2017; ? ).
Notation.
For a vector v , [ v ] i denotes its i -th component, and (cid:107) v (cid:107) H :=
√ v T Hv denotes a seminorm where H is a positive semideﬁnite 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.
P ROBLEM 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 ) mi =1 , where x i ∈ R
d x and y i ∈ R d y .
Given an input vector x , the output of the network is deﬁned as Y ( x ) :
= W 2 h ( W 1 x + b 1 )+ b 2 , where W 2 ∈ R d y × d h , b 2 ∈
R
d
y , W 1 ∈ R d h × d x , 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 + (cid:54)
=
s − .
Note that ReLU and Leaky-ReLU are members of this class.
In training neural networks, we are interested in minimizing the empirical risk
[Equation]
, over the parameters ( W j , b j ) 2 j =1 , where (cid:96) ( w, y ) :
R d y × R d y (cid:55)→ R is the loss function.
We make the following assumptions on the loss function and the training dataset:
Assumption 1.
The loss function (cid:96) ( w, y ) is twice continuously differentiable and convex in w .
Assumption 2.
No d x + 1 data points lie on the same afﬁne hyperplane.
Assumption 1 is satisﬁed 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. C HALLENGES AND KEY IDEAS
In this section, we explain the difﬁculties at nondifferentiable points and ideas on overcoming them.
Our algorithm is built from ﬁrst 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 (cid:54) = 0 , then the sign of ( W 1 +∆ 1 ) x i +( b 1 + δ 1 ) for any small perturbations ∆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.
We refer to such 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 deﬁnes a hyperplane through the origin, and bisects the parameter space into two halfspaces.
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 remedy this problem, but before that, we ﬁrst 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.
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 O (2 M ) regions, and g ( z, η ) and H ( z, η ) are piecewise-constant functions of η , constant inside each region.
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 ﬁrst principles and solves all 2 M problems efﬁciently.
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 Deﬁnition 2.2).
The conditions become sufﬁcient if (b) is replaced with η T H ( z, η ) η > 0 for all η (cid:54) =
such that g ( z, η ) T η = 0 .
In fact, this is a generalized version of second-order necessary (or sufﬁcient) conditions, i.e., ∇ f = 0 and ∇ 2 f (cid:23) 0 (or ∇ 2 f (cid:31) 0 ), for differentiable f .
Efﬁciently testing SOSP for exponentially many regions.
Motivated from the second-order expansion (1) and necessary/sufﬁcient conditions, our algorithm consists of three steps:
(a) Testing ﬁrst-order stationarity (in
the Clarke sense, see Deﬁnition
.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 brieﬂy outline each step and discuss how we can efﬁciently perform the tests.
We ﬁrst check ﬁrst-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 sufﬁces to check only the extreme rays of the cones.
It turns out that there are only 2 M 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 ﬂat extreme rays , i.e., those 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 ﬂat extreme ray, we need to solve only one equality constrained QP (ECQP).
If there exist ﬂat extreme rays, a few more inequality constrained
QPs (ICQPs) are solved.
Despite NP-hardness of general QPs (Pardalos & Vavasis, 1991), we prove that the speciﬁc form of QPs in our algorithm are still tractable in most cases.
More speciﬁcally, 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 ﬂat 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 ﬂat extreme rays is zero or very few, meaning that in most cases we can solve the efﬁciently.
2. P ROBLEM - SPECIFIC NOTATION AND DEFINITION
In this section, we deﬁne 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):
Deﬁnition 2.1 (FOSP, Theorem 6.2.5 of Borwein & Lewis (2010)) .
Suppose that a function f ( z ) : Ω (cid:55)→ 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
[Equation]
If 0 ∈ ∂
z f ( z ∗ ) , we say z ∗ is a ﬁrst-order stationary point (FOSP).
From the deﬁnition, 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 ∂ W j f ( z ∗ ) and ∂ b j 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 deﬁne second-order stationary points for the empirical risk R .
Notice that this generalizes the deﬁnition of SOSP for differentiable functions f : ∇ f = 0 and ∇ 2 f (cid:23) 0 .
Deﬁnition 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 d x , we deﬁne 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 ˜ Y ( x ) of the network and the amount of perturbation dY ( x ) can be expressed as
[Equation]
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
[Equation]
where h (cid:48) is the derivative of h .
We deﬁne h (cid:48) (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 perturbations [∆ 1 δ 1 ] k, · , as noted in Section 2.1.
We additionally deﬁne dY 1 ( x ) and dY 2 ( x ) to separate the terms in dY ( x ) that are linear in perturbations versus quadratic in perturbations.
dY
[Equation]
For simplicity of notation for the rest of the paper, we deﬁne for all i ∈ [ m ] := { 1 , . . .
, m } ,
[Equation]
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, deﬁne boundary index set B k as
[Equation]
The subspace spanned by vectors ¯ x i for in i ∈
B k plays an important role in our tests; so let us deﬁne a symbol for it, as well as the cardinality of B k and their sum:
[Equation]
For k ∈ [ d h ] , let v Tk ∈ R 1 ×
[Equation]
d x +1) be the k -th row of [∆δ 1 ] , and u
k ∈ R
d
y be the k -th column of ∆ 2 .
Next, we deﬁne the total number of parameters p , and vectorized perturbations η ∈ R p :
[Equation]
Also let z ∈ R p be vectorized parameters ( W j , b j ) 2 j =1 , packed in the same order as η .
Deﬁne a matrix C k :=
(cid:80) i/ ∈ B k h (cid:48)
([ W 1 x i + b 1 ] k ) ∇ (cid:96) i ¯ x Ti ∈ R d y × ( d x +1) .
This quantity appears multiplie times and does not depend on the perturbation, so it is helpful to have a symbol for it.
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.
T EST ALGORITHM FOR SECOND - ORDER STATIONARITY
In this section, we present SOSP-C HECK in Algorithm 1, which takes an arbitrary tuple ( W j , b j ) 2 j = of parameters as input and checks whether it is a SOSP.
We ﬁrst present a lemma that shows the explicit form of the perturbed empirical risk R ( z + η ) and identify ﬁrst and second-order perturbations.
The proof is deferred to Appendix B.2.
Lemma 2.
For small enough perturbation η ,
[Equation]
where g ( z, η ) and H ( z, η ) satisfy g ( z, η ) T η = (cid:88) i ∇ (cid:96) Ti dY 1 ( x i ) =
(cid:68)(cid:88)
i ∇ (cid:96) i O ( x i ) T , ∆ 2 (cid:69) + (cid:68)(cid:88) i ∇ (cid:96) i , δ 2 (cid:69) + d h (cid:88) k
= g k
( z, v k ) T v k , η T H ( z, η ) η = (cid:88)
i ∇ (cid:96) Ti dY 2 ( x i ) + 12 (cid:88)
i (cid:107) dY 1 ( x i ) (cid:107) 2 ∇ 2 (cid:96) i , and g k ( z, v k ) T :=
[ W 2 ] T · ,k (cid:0) C k + (cid:80) i ∈
B k h (cid:48)
(¯ x Ti v k ) ∇ (cid:96) i ¯ x Ti (cid:1) .
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-C HECK is presented in Algorithm 1.
As described in Section 2.1, the algorithm consists of three steps: (a) testing ﬁrst-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 satisﬁes the secondorder sufﬁcient conditions for local minimality, the algorithm decides it is a local minimum.
If the point only satisﬁes 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. T ESTING FIRST - ORDER STATIONARITY ( LINES 1, 4, AND 8)
Line 1 of Algorithm 1 corresponds to testing if ∂ W 2 R and ∂ b 2 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 difﬁcult 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 Td x +1 is in ∂ [ W 1 b 1 ] k, · R .
Note from Deﬁnition 2.1 and Lemma 2 that ∂
[ W 1 b 1 ] k, · R is the convex hull of all possible values of g k ( z, v k ) T .
If M k > 0 , 0 ∈ ∂ [ W 1 b 1 ] k, · R can be tested by solving a convex QP: minimize { s i } i ∈
Bk
[Equation]
subject to
[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-S UBDIFF -Z ERO -T EST (Algorithm 3) and Appendix A.1.2.
3. T ESTING 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 Td x +1 ∈ ∂ [ W 1 b 1 ] k, · R , with the solution { s ∗ i } from QP (2) we can write g k ( z, v k ) T as g k
( z,
[Equation]
k ) T =[
[Equation] [Equation]
· ,k (cid:16) C
[Equation]
+
[Equation]
∇
[Equation]
Every i ∈ B k bisects R d x +1 into two halfspaces, ¯ x Ti v k ≥
and ¯ x Ti v k ≤ 0 , in each of which h (cid:48) (¯ x Ti v k ) stays constant.
Note that by Lemma 1, ¯ x i ’s for
i ∈ B k are linearly independent.
So, given
M k boundary data points, they divide the space R d x +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 deﬁne an LP for each { σ i } i ∈ B k ∈ {− 1 , +1 } M k : minimize v k
[Equation]
subject to v k ∈ V k
[Equation]
¯ x Ti v
[Equation]
≥ 0 , ∀ i ∈ B k .
Solving these LPs and checking if the minimum value is 0 sufﬁces 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 coefﬁcients) of extreme rays of the cone, checking nonnegativity of the objective function for all extreme rays sufﬁces.
We emphasize that we do not solve the LPs (3) in our algorithm; we just check the extreme rays.
Computational efﬁciency.
Extreme rays of a pointed polyhedral cone in R d x +1 are computed from d x linearly independent active constraints.
For each i ∈ B k , the extreme ray ˆ v i,k ∈ V k ∩ span { ¯ x j | j ∈ B k \ { i }} ⊥ must be tested whether g k ( z, ˆ v
i,k ) T
ˆ v
i,k ≥ 0 , in both directions.
Note that there are 2 M k extreme rays, and one extreme ray ˆ v i,k is shared by 2 M k − 1 polyhedral cones.
Moreover, ¯ x
Tj ˆ v i,k = 0 for j ∈ B k \ { i } , which indicates that g k ( z, ˆ v i,k ) T ˆ v i,k = ( s σ i,k − s ∗ i )
[ W 2 ] T · ,k ∇ (cid:96) i ¯ x Ti ˆ v i,k , where σ i,k = sign(¯
x
Ti ˆ v i,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-I NCREASING -T EST (Algorithm 4) and Appendix A.2.
FO-I NCREASING -T EST computes all possible extreme rays ˜ v k and tests if they satisfy g k ( z, ˜ v k ) T ˜ v k ≥ 0 .
If the inequality is not satisﬁed by an extreme ray ˜ v k , then this is a descent direction, so we return ˜ v k .
If the inequality holds with equality, it means this is a ﬂat extreme ray , and it needs to be checked in second-order test, so we save this extreme ray for future use.
How many ﬂat extreme rays ( g k ( z, ˜ v k ) T ˜ v k = 0 ) are there?
Presence of ﬂat 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 ﬂat extreme rays; in short, there is a ﬂat extreme ray if [ W 2 ] T · ,k ∇ (cid:96) i = 0 or s ∗
i = s
+ or s − .
For more details, please refer to Appendix A.2.
3. T ESTING η T H ( z, η ) η ≥ 0 FOR { η | g ( z, η ) T η = 0 } ( LINES 11–16)
The second-order test checks η T H ( z, η ) η ≥ 0 for “ﬂat” η ’s satisfying g ( z, η ) T η = 0 .
This is done with help of the function SO-T EST (Algorithm 5).
Given its input { σ i,k } k ∈ [ d h ] ,i ∈ B k , it deﬁnes ﬁxed “Jacobian” matrices J i for all data points and equality/inequality constraints for boundary data points, and solves the QP of the following form: minimize η
[Equation]
subject to
[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-deﬁcient 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 ﬂat extreme ray, the algorithm solves just one QP with d h + M equality constraints.
If there are ﬂat 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
[Equation]
Recall from Section 3.2 that i ∈ B k has a ﬂat extreme ray if [ W 2 ] T · ,k ∇ (cid:96) i = 0 or s ∗ i
= s
+ or s − ; thus, K ≤ L ≤ M .
Please refer to Appendix A.3 for more details.
Efﬁciency of solving the QPs (4) .
Despite NP-hardness of general QPs, our speciﬁc form of
QPs (4) can be solved quite efﬁciently, avoiding exponential complexity in p .
After solving QP (4), there are three (disjoint) termination conditions:
(T1) η T Qη > 0 whenever η ∈ S , η (cid:54) = 0 , or (T2) η T Qη ≥ 0 whenever η ∈ S , but ∃ η (cid:54) = 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 efﬁciently 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 η
[Equation]
subject to Aη =
q
Then, projected gradient descent (PGD) updates
[Equation]
with learning rate α < 1 /λ max ( Q ) converges to a solution or diverges to inﬁnity 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 ﬂat 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 ﬂat 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 (cid:2)
A T
B T (cid:3) 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 deﬁne 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-T EST , whenever any QP terminated with (T3), then
SOSP-C HECK immediately returns the direction and terminates.
After solving all QPs, if any of
SO-T EST calls ﬁnished with (T2), then we conclude SOSP-C HECK with “SOSP.”
If all QPs terminated with (T1), then we can return “Local Minimum.”
[Table]
E XPERIMENTS
For experiments
[Table]
we used artiﬁcial datasets sampled iid from standard normal distribution
[Table]
and trained 1-hidden-layer 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]
After running Adam
[Table]
for each k ∈ [ d h ]
[Table]
we counted the number of approximate boundary data points satisfying | [ W 1 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 ∇ (cid:96) 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 ﬁxed d y = 1 for simplicity.
For large d h , the optimizer converged to near-zero minima, making ∇ (cid:96) i uniformly small, so it was difﬁcult 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) ﬂat 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 efﬁciently (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 .
For our experiments, we used artiﬁcial regression datasets instead of real ones.
This is because popular real datasets are classiﬁcation datasets, but cross-entropy loss gets arbitrarily small as parameters tend to inﬁnity and hinge loss is not differentiable; the losses are not adequate for our purposes.
D ISCUSSION AND FUTURE WORK
We provided an algorithm to test second-order stationarity and escape saddle points, for nondifferentiable points of empirical risk of shallow ReLU-like networks.
Despite difﬁculty 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) QP.
In benign cases, the last QP is equality constrained, which can be efﬁciently solved with projected gradient descent.
In the worst case, the QP has a few (say L ) inequality constraints, but it can be solved efﬁciently 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 efﬁciently in most cases.
Extending this test to deeper neural networks is a possible future work.
Also, numerical implementation of this algorithm and combining it with practical gradient-based methods will be of great interest.
A F ULL ALGORITHMS AND PROOF OF CORRECTNESS
In this section, we present the detailed operation of SOSP-C HECK (Algorithm 2), and its helper functions FO-S UBDIFF -Z ERO -T EST , FO-I NCREASING -T EST , and SO-T EST (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
[Equation]
Input: k ∈ [ d h ] , { s ∗ i } i ∈
B k 1: for all i ∈ B k do 2:
Deﬁne S i,k ← ∅ .
Get a vector ˆ v i,k ∈
V k ∩ span { ¯ x j | j ∈ B k \ { i }} ⊥ .
4: for ˜ v k ∈ { ˆ v i,k , − ˆ v i,k } do 5:
Deﬁne σ i,k ← sign(¯ x Ti ˜ v k ) .
6: if ( s σ i,k − s ∗ i )
[ W 2 ] T · ,k ∇ (cid:96) i ¯ x Ti ˜ v k < 0 then 7: return ( True , ˜ v k , {∅} i ∈ B k ) 8: else if ( s σ i,k − s ∗ i )
[ W 2 ] T · ,k ∇ (cid:96) i ¯ x Ti ˜ v 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 d x +1 , { S i,k } i ∈ B k ) .
Input: { σ i,k } k ∈ [ d h ] ,i
B k 1:
, [ J i ] k,k ←   h (cid:48) (
[ N ( x i )] k ) if i ∈ [ m ] \ B k s σ i,k
if i ∈ B k and σ i,k ∈ {− 1 , +1 } if i ∈ B k and σ i,k = 0 .
∗ j , δ ∗ j ) 2 j =1 .
minimize η
[Equation]
subject to
[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 η = (cid:88) i ∇ (cid:96) Ti dY 1 ( x i ) =
(cid:68)(cid:88)
i ∇ (cid:96) i O ( x i ) T , ∆ 2 (cid:69) + (cid:68)(cid:88) i ∇ (cid:96) i , δ 2 (cid:69) + d h (cid:88) k
= g k
( z, v k ) T v k , η T H ( z, η ) η = (cid:88)
i ∇ (cid:96) Ti dY 2 ( x i ) + 12 (cid:88)
i (cid:107) dY 1 ( x i ) (cid:107) 2 ∇ 2 (cid:96) i , and g k ( z, v k ) T :=
[ W 2 ] T · ,k (cid:0) C k + (cid:80) i ∈
B k h (cid:48)
(¯ x Ti v k ) ∇ (cid:96) i ¯ x Ti (cid:1) .
A. T ESTING FIRST - ORDER STATIONARITY ( LINES 1–3, 6–10 AND 15–17) A.1. T EST OF FIRST - ORDER STATIONARITY FOR W 2 AND b 2 ( LINES 1–3)
Lines 1–3 of Algorithm 2 correspond to testing if ∂ W 2 R = { 0 d y × d h } and ∂ b 2 R = { 0 d y } .
If they are not all zero, the opposite direction is a descent direction, as Line 2 returns.
To see why, suppose (cid:80) mi =1 ∇ (cid:96) i (cid:2)
O ( x i ) T 1 (cid:3) (cid:54) =
d y × ( d h +1) .
Then choose perturbations
[Equation]
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,
[Equation]
and also that (cid:80) mi =1 (cid:107) dY ( x i ) (cid:107)
= O ( γ 2 ) .
Then, by scaling γ sufﬁciently small we can achieve
R ( z + η ) <
R ( z ) , which disproves that ( W j , b j ) 2 j =1 is a local minimum.
A.1. T EST 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 difﬁcult because g ( z, η ) depends on ∆ 1 and δ 1 when there are boundary data points.
Recall that v Tk ( k ∈ [ d h ] ) is the k -th row of [∆δ 1 ] .
Then note from Lemma 2 that
[Equation]
where g k ( z, v k ) T :
=
[ W 2 ] T · ,k (cid:0) C k + (cid:80) i ∈
B k h (cid:48)
(¯ x Ti v k ) ∇ (cid:96) i ¯ x Ti (cid:1) .
Thus we can separate k ’s and treat them individually.
Test for zero gradient.
Recall the deﬁnition 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 Tk [ 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 (cid:48)
([∆ 1 x i + δ 1 ] k ) =
h (cid:48)
(¯ x Ti v k ) ∈ { s − , s + } depends on v k .
Lines 6–10 test if 0 Td x +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 speciﬁc name D k :=
∂ [ W 1 b 1 ] k, · R .
By observing that D k is the convex hull of all possible values of g k ( z, v k ) T ,
D k
[Equation]
Testing
Td x +1 ∈
D
k is done by FO-S UBDIFF -Z ERO -T EST in Algorithm 3.
It solves a convex
QP (2), and returns { s ∗ i } i ∈ B k .
If 0 T d x +1 ∈ D k , { s ∗ i } i ∈ B k will satisfy ˜ v T k :=
[ W 2 ] T · ,k ( C k +
[Equation]
i ∈ B k s ∗ i ∇ (cid:96)
[Equation]
¯ x Ti ) =
T d x +1 .
Suppose
Td x +1 / ∈ D k .
Then, ˜ v k is the closest vector in D k from the origin, so (cid:104) ˜ v k , v (cid:105) > 0 for all v T ∈ D k .
Choose perturbations
[Equation]
for
[Equation]
and apply perturbation ( γ ∆ j , γδ j ) 2 j =1 where γ > 0 .
With this perturbation, we can check that g ( z,
[Equation]
=
[Equation]
i ¯ x Ti
[Equation]
˜ v k , and since h (cid:48) ( − ¯ x Ti ˜ v k ) ∈ { s − , s + } for i ∈ B k , we have [ W 2 ] T · ,k (cid:16) C k + (cid:88) i ∈
B k h (cid:48)
[Equation]
¯ x
[Equation]
˜
[Equation]
) ∇ (cid:96)
[Equation]
¯ x
[Equation]
(cid:17) ∈ D k , and (cid:104)
˜ v k , v (cid:105) >
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 γ sufﬁciently small we can disprove local minimality of ( W j , b j ) 2 j =1 .
A. T ESTING g ( z, η ) T η ≥ 0 FOR ALL η ( LINES 11–14)
Linear program formulation.
Lines 11–14 are essentially about testing if g k ( z, v k ) T v k ≥ 0 for all directions v k .
If 0 Td x +1 ∈ D k , with the solution { s ∗ i } i ∈
B k from FO-S UBDIFF -Z ERO -T EST we can write g k ( z, v k ) T as
[Equation]
For any i ∈ B k , h (cid:48) (¯ x Ti v k ) ∈ { s − , s + } changes whenever the sign of ¯ x Ti v k changes.
Every i ∈ B k bisects R d x +1 into two halfspaces, ¯ x Ti v k ≥
and ¯ x Ti v k ≤ 0 , in each of which h (cid:48) (¯ x Ti v k ) stays constant.
Note that by Lemma 1, ¯ x i ’s for
i ∈ B k are linearly independent.
So, given M k linearly independent ¯ x i ’s, they divide the space R d x +1 of v k into 2 M k polyhedral cones.
Since g k ( z, v k ) T is constant in each polyhedral cone, we can let σ i ∈ {− 1 , +1 } for all i ∈ B k , and deﬁne an LP for each { σ i } i ∈ B k ∈ {− 1 , +1 } M k : minimize v k
[Equation]
subject
[Equation]
Solving these LPs and checking if the minimum value is 0 sufﬁces 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 coefﬁcients) of extreme rays of the cone, checking nonnegativity of the objective function for all extreme rays sufﬁces.
We emphasize that we do not solve the LPs (3) in our algorithm; we just check the extreme rays.
Computational efﬁciency.
Extreme rays of a pointed polyhedral cone in R d x +1 are computed from d x linearly independent active constraints.
Line 3 of Algorithm 4 is exactly computing such extreme rays: ˆ v i,k ∈ V k ∩ span { ¯ x j | j ∈ B k \ { i }} ⊥ for each i ∈ B k , tested in both directions.
Note that there are 2 M k extreme rays, and one extreme ray ˆ v i,k is shared by 2 M k − 1 polyhedral cones.
Moreover, ¯ x
Tj ˆ v i,k = 0 for j ∈ B k \ { i } , which indicates that
[Equation]
i ¯ x
Ti ˆ v i,k , where σ i,k = sign(¯
x
Ti ˆ v i,k ) , regardless of { σ j } j ∈ B k \{ i } .
This observation is used in Lines 6 and 8 of Algorithm 4.
Testing g k ( z, ˜ v k ) T ˜ v k ≥
for an extreme ray ˜ v k can be done with a single inequality test instead of 2 M k −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-I NCREASING -T EST in Algorithm 4 is doing.
Output of FO-I NCREASING -T EST 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 ˜ v 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 ˜ v k
=
ˆ v i,k and ˜ v k = − ˆ v i,k
(Line 4), we check if g k ( z, ˜ v k ) T ˜ v k ≥ 0 .
Whenever it does not hold (Lines 6–7), ˜ v k is a descent direction, so FO-I NCREASING -T EST returns it with True .
Line 13 of Algorithm 2 uses that ˜ v 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 ˜ v 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 ¯ x i 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, ˜ v k
Counting ﬂat extreme rays.
How many of these extreme rays satisfy g k
( z, ˜ v k ) T ˜ v k = 0 ?
Presence of such ﬂat extreme rays introduce inequality constraints in the QP that we will solve in SO-T EST (Algorithm 5).
It is ideal not to have ﬂat 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 ﬂat extreme rays as well as output of Algorithm 4.
Lemma A.1.
Suppose
Td x +1 ∈ D k and all extreme rays ˜ v k satisfy g k ( z, ˜ v k ) T ˜ v k ≥ 0 .
Consider all i ∈ B k , and its corresponding ˆ v
i,k ∈
V k ∩ span { ¯ x j | j ∈ B k \ { i }} ⊥ .
If [ W 2 ] T · ,k ∇ (cid:96) i = 0 , then both extreme rays ˆ v i,k and − ˆ v i,k are ﬂat extreme rays, and S i,k = {− 1 , +1 } at the end of Algorithm 4.
If [ W 2 ] T · ,k ∇ (cid:96) i (cid:54) = 0 and s ∗ i
= s + (or s − ), one (and only) of ˜ v k ∈ { ˆ v
i,k , − ˆ v i,k } that satisﬁes sign(¯ x Ti ˜ v k ) =
+1 (or − 1 ) is a ﬂat extreme ray, and S i,k = { +1 } (or {− 1 } ) at the end of Algorithm 4.
If [ W 2 ] T · ,k ∇ (cid:96) i (cid:54) = 0 and s ∗ i (cid:54)
=
s ± , both ˆ v
i,k and − ˆ v i,k are not ﬂat extreme rays, and S i,k = { 0 } at the end of Algorithm 4.
Proof
First note that we already assumed that all extreme rays ˜ v k satisfy g k ( z, ˜ v k ) T ˜ v k ≥ 0 , so
SOSP-C HECK will reach Line 14 at the end.
Also note that ¯ x i ’s in i ∈ B k are linearly independent (by Lemma 1), so ¯ x
Ti ˆ v i,k (cid:54) = 0 .
If [ W 2 ] T · ,k ∇ (cid:96) i = 0 , then ( s σ i,k − s ∗ i )
[ W 2 ] T · ,k ∇ (cid:96) i ¯ x Ti ˜ v k = 0 regardless of ˜ v k , so both ˆ v
i,k and − ˆ v i,k are ﬂat extreme rays.
If [ W 2 ] T · ,k ∇ (cid:96) i (cid:54) = 0 and s ∗ i
= s
+ , ˜ v k ∈ { ˆ v i,k , − ˆ v i,k } that satisﬁes sign(¯ x Ti ˜ v k )
=
+1 gives σ i,k
= +1 ,
so s σ i,k
= s ∗ i .
Thus, ˜ v k is a ﬂat extreme ray.
The case with s ∗ i = s − is proved similarly.
If [ W 2 ] T · ,k ∇ (cid:96) i (cid:54) = 0 and s ∗ i (cid:54)
=
s
+ , none of ( s ± − s ∗ i ) , [ W 2 ] T · ,k ∇ (cid:96) i , and
¯ x Ti ˆ v i,k are zero, so
ˆ v i,k and − ˆ v i,k cannot be ﬂat.
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 (1) k and B (2) k by B (1 , 2) k , and similarly,
B (2 , 3) k := B (2) k ∪ B (3) k .
We 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 .
Also, it follows from the deﬁnition of K and L (5) that
K
[Equation]
d h (cid:88) k
= | B (1) k |
[Equation]
L = d h (cid:88) k
=
[Equation] [Equation]
) 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 (cid:0)(cid:80)
i ∈
B k ( s σ
i − s ∗ i ) ∇ (cid:96) i ¯ x Ti (cid:1) for σ
i
¯ x Ti v k ≥ 0 , ∀
i ∈ B k corresponds to the KKT stationarity condition, where ( s σ i − s ∗ i )
[ W 2 ] T · ,k ∇ (cid:96)
i ’s correspond to the Lagrange multipliers for inequality constraints.
Then, testing extreme rays are equivalent to testing dual feasibility of Lagrange multipliers, and having zero dual variables ( [ W 2 ] T · ,k ∇ (cid:96) i = 0 or s ∗
i = s
+ or s − , resulting in ﬂat 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 deﬁne 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. T ESTING η T H ( z, η ) η ≥ 0 FOR { η | g ( z, η ) T η = 0 } ( LINES 19–32)
The second-order test checks η T H ( z, η ) η ≥ 0 for “ﬂat” η ’s satisfying g ( z, η ) T η = 0 .
This is done with help of the function SO-T EST in Algorithm 5.
Given its input { σ i,k } k ∈ [ d h ] ,i ∈ B k , it deﬁnes i for all data points and equality/inequality constraints for boundary data points, and solves the QP (4).
Equality/inequality constraints.
In the QP (4), 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 function h : scaling [ W 1 ] k, · and [ b 1 ] k by α > 0 and scaling [ W 2 ] · ,k by 1 /α yields exactly the same network.
This observation is stated more precisely in the following lemma.
Lemma A.2.
Suppose z is a FOSP (differentiable or not) of R ( · ) .
Fix any k ∈
[ d h ] , and deﬁne perturbation η as
[Equation]
Then, g ( z, η ) T η = η T H ( z, η ) η = 0 .
The proof of Lemma A.2 can be found in Appendix B.5.
A corollary of this lemma is that any differentiable FOSP of R always has rank-deﬁcient Hessian, and the multiplicity of zero eigenvalue is at least d h .
Hence, these d h equality constraints on u k ’s and v k ’s force η to be orthogonal to the loss-invariant directions.
The equality constraints of the form ¯ x Ti v k = 0 are introduced when σ i,k = 0 ; this happens for boundary data points i ∈ B (3) k .
Therefore, there are M − L additional equality constraints.
The inequality constraints come from i ∈ B (1 , 2) k .
So there are L inequality constraints.
Now, the following lemma proves that feasible sets deﬁned by these equality/inequality constraints added to (4) exactly correspond to the regions where g k ( z, v k ) T v k = 0 .
Recall from Lemma A.1 that
S i,k = {− 1 , +1 } for i ∈ B (1) k , S i,k = {− 1 } or { +1 } for i ∈ B (2) k , and S i,k = { 0 } for i ∈ B (3) k .
Lemma A.3.
Let { σ i,k } i ∈ B (2) k be the only element of (cid:81) i ∈ B (2) k S
i,k .
Then, in SO-T EST , (cid:91) { σ i,k } i ∈ B (1) k ∈ (cid:81) i S i,k (cid:110) v k | ∀ i ∈ B (3) k , ¯ x Ti v k = 0 , and ∀ i ∈ B (1 , 2) k , σ i,k ¯ x Ti v k ≥ 0 (cid:111) =
(cid:110) v k | ∀ i ∈ B (3) k ,
¯ x Ti v k = 0 , and ∀ i ∈ B (2) k , σ i,k ¯ x Ti v k ≥
(cid:111) =
(cid:8) v k | g k ( z, v k ) T v k = 0 (cid:9) .
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-T EST 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 ﬂat 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 ﬂat extreme rays (Line 22), the algorithm calls SO-T EST for each element of (cid:81)
k ∈
[ d h ] (cid:81)
i ∈
B k S i,k .
Recall that | S
i,k | = 2 for i ∈ B (1) k , so (cid:12)(cid:12)(cid:12)(cid:12)(cid:89)
[Table]
In summary, if there is no ﬂat extreme ray, the algorithm solves just one QP with d h + M equality constraints.
If there are ﬂat 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-T EST returns result to SOSP-C HECK .
The algorithm returns two booleans and one perturbation tuple.
The ﬁrst 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 satisﬁes η T H ( z, η ) η = 0 .
After solving all QPs, if any of SO-T EST calls found out η (cid:54) =
such that g ( z, η ) T η = 0 and η T H ( z, η ) η = 0 , then we conclude SOSP-C HECK with “SOSP.”
If all QPs terminated with unique minimum at zero, then we can conclude “Local
Minimum.”
B P ROOF OF LEMMAS B. P ROOF OF L EMMA
By deﬁnition, 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 [ 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 ¯ x i ’s are linearly dependent, i.e., there exists a 1 , . .
a M k ∈ R , not all zero, such that
[Equation]
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 afﬁne 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 afﬁne space, i.e., a hyperplane in R d x .
This contradicts Assumption 2.
B. P ROOF OF L EMMA
From Assumption 1, (cid:96) ( w, y ) is twice differentiable and convex in w .
By Taylor expansion of (cid:96) ( · ) at ( Y ( x i ) , y i ) ,
[Equation]
=
[Equation]
where the ﬁrst-order term (cid:80)
[Equation]
)) can be further expanded to show
[Equation]
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. P ROOF OF L EMMA
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 ˆ W be an submatrix of W whose columns are w q +1 , . .
. , w p .
With this deﬁnition, note that I − A T ( AA T ) − 1 A
= ˆ W ˆ W T .
Suppose that we are given η ( t ) satisfying Aη ( t ) = 0 .
Then we can write η ( t )
=
ˆ Wµ ( t ) , where µ ( t ) ∈
R p − q and [ µ ( t ) ]
i = w Ti + q η ( t ) .
Deﬁne µ ( t +1) likewise.
Then, noting η ( t ) =
ˆ W ˆ W T η ( t ) gives ˆ
[Equation]
Deﬁne C :
= ˆ W T Q ˆ W ∈ R ( p − q ) × ( p − 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 µ
[Equation]
This proves that this iteration converges or diverges exponentially fast.
Starting from the initial point η (0)
=
ˆ Wµ (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 inﬁnity quickly and ﬁnds an η such that η T Qη < 0 (T3).
If all λ i ≥ 0 , it converges exponentially fast to ˆ W (cid:80) i : λ i =
( ν Ti µ (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 sufﬁces to show that λ max ( Q ) ≥ λ max ( C ) .
Note that
[Equation]
Using the facts that λ max ( Q ) =
λ max ( W T QW ) and C is a principal submatrix of W T QW ,
[Equation]
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 ν Ti µ (0) (cid:54) = 0 for all i ∈
[ p − q ] , so we will get the correct convergence/divergence result almost surely.
B. P ROOF OF L EMMAB.4. P RELIMINARIES
Before we prove the complexity lemma, we introduce the deﬁnitions of copositivity and Pareto spectrum, which are closely related concepts to our speciﬁc form of QP.
Deﬁnition 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 , η (cid:54) = 0 .
Testing whether Q is not copositive known to be NP-complete (Murty & Kabadi, 1987); it is certainly a difﬁcult 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 deﬁnition of Pareto spectrum, taken from Seeger (1999); Hiriart-Urruty & Seeger (2010).
Deﬁnition B.2.
Consider the problem
[Equation]
KKT conditions for the above problem gives us a complementarity system
[Equation]
where λ ∈ R is viewed as a Lagrange multiplier associated with (cid:107) η (cid:107) 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).
Now, the following lemma tells us how to compute Pareto spectrum of Q .
Lemma B.2 (Theorem 4.1 of Seeger (1999)) .
Let Q be a matrix of order r .
Consider a nonempty index set J ⊆
[ r ] .
Given J , Q J refers to the principal submatrix of Q with the rows and columns of Q indexed by J .
Let 2 [ r ] \ ∅ denote the set of all nonempty subsets of [ r ] .
Then λ ∈ Π( Q ) if and only if there exists an index set J ∈ 2 [ r ] \ ∅ and a vector ξ ∈ R | J | such that
[Equation]
In such a case, the vector η ∈ R r by
[Equation]
is a Pareto-eigenvector of Q associated to the Pareto eigenvalue λ .
These lemmas tell us that the Pareto spectrum of Q can be calculated by computing eigensystems of all 2 r − 1 possible Q J , which takes O ( r 3 2 r ) time in total, and from this we can determine whether a symmetric Q is copositive.
B.4. P ROOF OF THE LEMMA
With the preliminary concepts presented, we now start proving our Lemma 4.
We will ﬁrst transform η to eliminate the equality constraints and obtain an inequality constrained problem of the form minimize w : ¯
Bw ≥ 0 w T Rw .
From there, we can use the theorems from Martin & Jacobson (1981), which tell us that by testing positive deﬁniteness of a ( p − q − r ) × ( p − q − r ) matrix and copositivity of a r × r matrix we can determine which of the three categories the QP falls into.
Transforming η and testing positive deﬁniteness take O ( p 3 ) time and testing copositivity takes O ( r 3 2 r ) time, so the test in total is done in O ( p 3 + r 3 2 r ) time.
We now describe how to transform η and get an equivalent optimization problem of the form we want.
We assume without loss of generality that
A
=
[ A
A 2 ] where A 1 ∈ R q × q is invertible.
If not, we can permute components of η .
Then make a change of variables
[Equation]
that
[Equation]
Consequently, the constraint Aη = 0 becomes ¯ w = 0 .
Now partition B =
[ B
B 2 ] , where
B 1 ∈ R r × q .
Also let R be the principal submatrix of T TA QT A composed with the last p − q rows and columns.
It is easy to check that minimize η η T Qη subject to
Aη = 0 q , Bη ≥ 0 r .
≡ minimize w w T Rw subject to ( B 2 − B 1 A − 1 1 A 2 ) w ≥ 0 r .
Let us quickly check if B 2 − B
A − 1 1 A 2 has full row rank.
One can observe that
[Equation] [Equation]
−
[Equation]
(cid:21) .
It follows from the assumption rank( (cid:2)
A T
B T (cid:3) )
=
q + r that ¯ B :=
B 2 − B 1 A − 1 1 A 2 has rank r , which means it has full row rank.
Before stating the results from Martin & Jacobson (1981), we will transform the problem a bit further.
Again, assume without loss of generality that ¯ B = (cid:2) ¯ B¯ B 2 (cid:3) where ¯ B 1 ∈ R r × r is invertible.
Deﬁne another change of variables as the following:
[Equation]
Consequently, we get minimize w w T Rw subject to ¯
[Equation]
≡ minimize w
[Equation]
subject to ν 1 ≥
[Equation]
r
[Equation]
Given this transformation, we are ready to state the lemmas.
Lemma B.3 (Theorem 2.2 of Martin & Jacobson (1981)) .
If ¯ B = (cid:2) ¯ B¯ B 2 (cid:3) , with ¯ B 1 r × r invertible, then with ¯ R ij ’s given as above, w T Rw >
whenever ¯
Bw ≥ 0 , w (cid:54) =
if and only if
• ¯ R 22 is positive deﬁnite, and • ¯ R 11 − ¯ R 12 ¯ R − 1 22 ¯ R T 12 is strictly copositive.
Lemma B.4 (Theorem 2.1 of Martin & Jacobson (1981)) .
If ¯ B = (cid:2) ¯ B¯ B 2 (cid:3) , with ¯ B 1 r × r invertible, then with ¯ R ij ’s given as above, w T Rw ≥
whenever ¯ Bw ≥ 0 if and only if
• ¯ R 22 is positive semideﬁnite, null( ¯ R 22 )
⊆ null( ¯ R 12 ) , and • ¯ R 11 − ¯ R 12 ¯ R † 22 ¯ R T 12 is copositive,
where ¯ R † 22 is a pseudoinverse of ¯ R 22 .
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 ¯ R 22 and see which of the following disjoint categories it belongs to:
(PD1) All eigenvalues λ 1 , . .
λ p − q − r of ¯ R 22 satisfy λ i > 0 .
(PD2) ∀
i, λ i ≥ 0 , but ∃ i such that
λ
i = 0 , and ∀ ν 2 s.t.
¯ R 22 ν 2 = 0 , we have ¯ R 12 ν 2 = 0 .
(PD3) ∀
i, λ i ≥ 0 , but ∃ i such that
λ i = 0 , and
∃ ν 2 s.t.
¯ R 22 ν 2 =
but ¯ R 12 ν 2 (cid:54) = 0 .
(PD4) ∃
i such that λ
i
<
i.e., ∃ ν 2 such that ν T 2 ¯ R
22 ν
<
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 =
so that ν T ¯ Rν =
ν
T 2 ¯ R 22 ν 2 < 0 .
In case of (PD3), one can ﬁx any ν 1 satisfying ν T 1 ¯ R 12 ν 2 (cid:54) = 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 :
= ¯ R 11 − ¯ R 12 ¯ R † 22 ¯ R T 12 and check which case S belongs to:
(CP1) S = ¯ R 11 − ¯ R 12 ¯ R † 22 ¯ R T 12 is strictly copositive.
(CP2) S is copositive, but
∃ ν 1 ≥ 0 , ν 1 (cid:54) =
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 deﬁned in Lemma B.2.
If we have (CP3), we can declare (T3) because one can ﬁx ν 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. P ROOF OF L EMMA A.
With the given η ,
[Equation]
, ∆ 2 = (cid:2)
d y × ( k − 1) − [ W 2 ] · ,k 0 d y × ( d h − k ) (cid:3) .
It is straightforward to check that for all i ∈ [ m ] , dY
[Equation]
+ δ
[Equation]
−
[Equation]
O
[Equation]
x i
[Equation]
] k [ W 2 ] · ,k + W(cid:34)
k −
[ O ( x i )]
k 0 d h − k
(cid:35)
= 0 .
From this, g ( z, η ) T η = (cid:80) i ∇ (cid:96) T i dY 1 ( x i )
= 0 .
For the second order terms, η T H ( z, η ) η = m (cid:88) i = ∇ (cid:96)
Ti dY 2 ( x i ) +m (cid:88) i
= (cid:107) dY 1 ( x i ) (cid:107) 2 ∇ 2 (cid:96) i = (cid:88) m i
=1 ∇ (cid:96)
Ti ∆ 2 J ( x i )(∆ 1 x i + δ 1 ) =
(cid:88) m i =1 ∇ (cid:96)
Ti ( − [ O ( x i )]
k [ W 2 ] · ,k ) = − (cid:16)(cid:88) m i =
[ O ( x i )]
k ∇ (cid:96) Ti (cid:17) [ W 2 ] · ,k .
From the fact that z is a FOSP of R , it follows that (cid:80) i ∇ (cid:96)
i O ( x i ) T = 0 , so η T H ( z, η ) η = 0 .
B. P ROOF OF L EMMA A.
The ﬁrst equality is straightforward, because it follows from S i,k = {− 1 , +1 } for all i ∈ B (1) k that taking union of { ¯ x Ti v k ≤ 0 } and { ¯ x Ti v k ≥ 0 } will eliminate the inequality constraints for i ∈ B (1) k .
For the next equality, we start by expressing U 1 :
=
(cid:8) v k | g k ( z, v k ) T v k = 0 (cid:9) as a linear combination of its linearly independent components.
The set U 1 can be expressed in the following form:
[Equation] [Equation]
∀
[Equation]
∈ B
[Equation]
k , β
[Equation]
≥
[Equation]
where ˆ v i,k ∈ V k ∩ span { ¯ x j | j ∈ B k \ { i }} ⊥ for all i ∈ B (1 , 2) k .
Additionally, for i ∈ B (2) k , ˆ v i,k is in the direction that satisﬁes σ i,k = sign(¯
x
Ti ˆ v i,k ) .
To see why U 1 can be expressed in such a form, ﬁrst note that at the moment SO-T EST is executed, it is already given that the point z is a FOSP.
So, for any perturbation v k we have g k ( z, v k ) ∈
V k , and g k ( z, v k ) T v ⊥ = 0 for any v
⊥ ∈
V ⊥ k .
For the remaining components, please recall FO-I NCREASING -T EST and Lemma A.1; ˆ v i,k are ﬂat extreme rays, so they are the ones satisfying g k
( z, v k ) T v k = 0 .
It remains to show that U 2 :
= { v k | ∀ i ∈ B (3) k , ¯ x Ti v k = 0 , and ∀ i ∈ B (2) k , σ i,k ¯ x Ti v k ≥ 0 }
=
U 1 .
We show this by proving U 1 ⊆
U 2 and U c 1 ⊆
U c 2 .
To show the ﬁrst part, we start by noting that for any v ⊥ ∈
V ⊥ k , ¯ x Ti v ⊥ = 0 for i ∈ B (2 , 3) k because ¯ x i ∈
V k for these i ’s. Also, for all i ∈ B (1) k , it follows from the deﬁnition of ˆ v i,k that ¯ x
Tj ˆ v i,k = 0 for all j ∈ B (2 , 3) k .
Similarly, for all i ∈ B (2) k , ¯ x
Tj ˆ v i,k = 0 for all j ∈ B (2 , 3) k \ { i } , and σ i,k ¯ x
Ti ˆ v i,k > 0 .
Therefore, any v k ∈ U 1 must satisfy all constraints in U 2 , hence U 1 ⊆
U 2 .
For the next part, we prove that v k ∈ U c 1 violates at least one constraint in U 2 .
Observe that the whole vector space R p can be expressed as
[Equation]
Therefore, any v k ∈ U c 1 either has a nonzero component w in V k ∩ span { ˆ v i,k , i ∈ B (1 , 2) k } ⊥ or there exists i ∈ B ( k )
such that β i < 0 .
By deﬁnition, ˆ v i,k ∈ span { ¯ x j | j ∈ B (3) k } ⊥ for any i ∈ B (1 , 2) k , which implies that V k ∩ span { ˆ v i,k , i ∈ B (1 , 2) k } ⊥ = span { ¯ x j | j ∈ B (3) k } .
Thus, a nonzero component w ∈ span { ¯ x j | j ∈ B (3) k } will violate some equality constraints in U 2 .
Next, in case where ∃ i ∈ B ( k )such that β i < 0 , this violates the inequality constraint corresponding to i .