Exactly Computing the Local Lipschitz Constant of ReLU Networks

Matt Jordan, Alexandros G. Dimakis

Introduction

We are interested in computing the Lipschitz constant of neural networks with ReLU activations. Formally, for a network ff with multiple inputs and outputs, we are interested in the quantity

Estimating or bounding the Lipschitz constant of a neural network is an important and well-studied problem. For the Wasserstein GAN formulation the discriminator is required to have a bounded Lipschitz constant, and there are several techniques to enforce this . For supervised learning Bartlett et al. have shown that classifiers with lower Lipschitz constants have better generalization properties. It has also been observed that networks with smaller gradient norms are more robust to adversarial attacks. Bounding the (local) Lipschitz constant has been used widely for certifiable robustness against targeted adversarial attacks . Lipschitz bounds under fair metrics may also be used as a means to certify the individual fairness of a model .

The Lipschitz constant of a function is fundamentally related to the supremal norm of its Jacobian matrix. Previous work has demonstrated the relationship between these two quantities for functions that are scalar-valued and smooth . However, neural networks used for multi-class classification with ReLU activations do not meet either of these assumptions. We establish an analytical result that allows us to formulate the local Lipschitz constant of a vector-valued nonsmooth function as an optimization over the generalized Jacobian. We access the generalized Jacobian by means of the chain rule. As we discuss, the chain rule may produce incorrect results for nonsmooth functions, even ReLU networks. To address this problem, we present a sufficient condition over the parameters of a ReLU network such that the chain rule always returns an element of the generalized Jacobian, allowing us to solve the proposed optimization problem.

We demonstrate our algorithm on various applications. We evaluate a variety of Lipschitz estimation techniques to definitively evaluate their relative error compared to the true Lipschitz constant. We apply our algorithm to yield reliable empirical insights about how changes in architecture and various regularization schemes affect the Lipschitz constants of ReLU networks.

We present novel analytic results connecting the Lipschitz constant of an arbitrary, possibly nonsmooth, function to the supremal norm of generalized Jacobians.

We present a sufficient condition for which the chain rule will always yield an element of the generalized Jacobian of a ReLU network.

We show that that it is provably hard to approximate the Lipschitz constant of a network to within a factor that scales almost linearly with input dimension.

We present a Mixed-Integer Programming formulation (LipMIP) that is able to exactly compute the local Lipschitz constant of a scalar-valued ReLU network over a polyhedral domain.

We analyze the efficiency and accuracy of LipMIP against other Lipschitz estimators. We provide experimental data demonstrating how Lipschitz constants change under training.

Gradient Norms and Lipschitz Constants

First we define the problem of interest. There have been several recent papers that leverage an analytical result relating the Lipschitz constant of a function to the maximal dual norm of its gradient . This analytical result is limited in two aspects: namely it only applies to functions that are both scalar-valued and continuously differentiable. Neural networks with ReLU nonlinearities are nonsmooth and for multi-class classification or unsupervised learning settings, typically not scalar-valued. To remedy these issues, we will present a theorem relating the Lipschitz constant to the supremal norm of an element of the generalized Jacobian. We stress that this analytical result holds for all Lipschitz continuous functions, though we will only be applying this result to ReLU networks in the sequel.

The quantity we are interested in computing is defined as follows:

And if L(α,β)(f,X)L^{(\alpha,\beta)}(f,\mathcal{X}) exists and is finite, we say that ff is (α,β)(\alpha,\beta)-locally Lipschitz over X\mathcal{X}.

If ff is scalar-valued, then we denote the above quantity Lα(f,X)L^{\alpha}(f,\mathcal{X}) where ∣∣⋅∣∣β=∣⋅∣||\cdot||_{\beta}=|\cdot| is implicit. For smooth, scalar-valued ff, it is well-known that

where ∣∣z∣∣α∗:=sup⁡∣∣y∣∣α≤1yTz||z||_{\alpha^{*}}:=\sup_{||y||_{\alpha}\leq 1}y^{T}z is the dual norm of ∣∣⋅∣∣α||\cdot||_{\alpha} . We seek to extend this result to be applicable to vector-valued nonsmooth Lipschitz continuous functions. As the Jacobian is not well-defined everywhere for this class of functions, we recall the definition of Clarke’s generalized Jacobian :

The (Clarke) generalized Jacobian of ff at xx, denoted δf(x)\delta_{f}(x), is the convex hull of the set of limits of the form lim⁡i→∞∇f(xi)\lim\limits_{i\rightarrow\infty}\nabla f(x_{i}) for any sequence (xi)i=1∞(x_{i})_{i=1}^{\infty} such that ∇f(xi)\nabla f(x_{i}) is well-defined and xi→xx_{i}\rightarrow x.

Informally, δf(x)\delta_{f}(x) may be viewed as the convex hull of the Jacobian of nearby differentiable points. We remark that for smooth functions, δf(x)={∇f(x)}\delta_{f}(x)=\{\nabla f(x)\} for all xx, and for convex nonsmooth functions, δf(⋅)\delta_{f}(\cdot) is the subdifferential operator.

The following theorem relates the norms of the generalized Jacobian to the local Lipschitz constant.

where δf(X):={G∈δf(x)∣x∈X}\delta_{f}(\mathcal{X}):=\{G\in\delta_{f}(x)\mid x\in\mathcal{X}\} and ∣∣M∣∣α,β:=sup⁡∣∣v∣∣α≤1∣∣Mv∣∣β||M||_{\alpha,\beta}:=\sup\limits_{||v||_{\alpha}\leq 1}||Mv||_{\beta}.

This result relies on the fact that Lipschitz continuous functions are differentiable almost everywhere (Rademacher’s Theorem). As desired our result recovers equation 3 for scalar-valued smooth functions. Developing techniques to optimize the right-hand-side of equation 4 will be the central algorithmic focus of this paper.

ReLU Networks and the Chain Rule

Theorem 1 relates the Lipschitz constant to an optimization over generalized Jacobians. Typically we access the Jacobian of a function through backpropagation, which is simply an efficient implementation of the familiar chain rule. However the chain rule is only provably correct for functions that are compositions of continuously differentiable functions, and hence does not apply to ReLU networks . In this section we will provide a sufficient condition over the parameters of a ReLU network such that any standard implementation of the chain rule will always yield an element of the generalized Jacobian.

To motivate the discussion, we turn our attention to neural networks with ReLU nonlinearities. We say that a function is a ReLU network if it may be written as a composition of affine operators and element-wise ReLU nonlinearities, which may be encoded by the following recursion:

where σ(⋅)\sigma(\cdot) here is the ReLU operator applied element-wise. We present the following example where the chain rule yields a result not contained in the generalized Jacobian. The univariate identity function may be written as I(x):=2x−σ(x)+σ(−x)I(x):=2x-\sigma(x)+\sigma(-x). Certainly at every point xx, δI(x)={1}\delta_{I}(x)=\{1\}. However as Pytorch’s automatic differentiation package defines σ′(0)=0\sigma^{\prime}(0)=0, Pytorch will compute I′(0)I^{\prime}(0) as 2 . Indeed, this is exactly the case where naively replacing the feasible set δf(X)\delta_{f}(\mathcal{X}) in Equation 4 by the set of Jacobians returned by the chain rule will yield an incorrect calculation of the Lipschitz constant. To correctly relate the set of generalized Jacobians to the set of elements returnable by an implementation of the chain rule, we introduce the following definition:

Consider any implementation of the chain rule which may arbitrarily assign any element of the generalized gradient δσ(0)\delta_{\sigma}(0) for each required partial derivative σ′(0)\sigma^{\prime}(0). We define the set-valued function ∇#f(⋅)\nabla^{\#}f(\cdot) as the collection of answers yielded by any such chain rule.

The subdifferential of the ReLU function at zero is the closed interval $,sothechainruleasimplementedinPyTorchandTensorflowwillyieldanelementcontainedin, so the chain rule as implemented in PyTorch and Tensorflow will yield an element contained in\nabla^{\#}f(\cdot).Ourgoalwillbetodemonstratethat,forabroadclassofReLUnetworks,thefeasiblesetinEquation4maybereplacedbytheset. Our goal will be to demonstrate that, for a broad class of ReLU networks, the feasible set in Equation 4 may be replaced by the set\{G\in\nabla^{\#}f(x)\mid x\in\mathcal{X}\}$.

We say that a ReLU network with nn neurons is in general position if, for every subset of neurons S⊆[n]S\subseteq[n], the intersection ∩i∈SKi\cap_{i\in S}K_{i} is a finite union of (d−∣S∣)(d-|S|)-dimensional polytopes.

We emphasize that this definition requires that particular ReLU kernel is a finite union of (d−1)(d-1)-dimensional polytopes, i.e. the ‘bent hyperplanes’ referred to in . For a general position neural net, no (d+1)(d+1) ReLU kernels may have a nonempty intersection. We now present our theorem on the correctness of chain rule for general position ReLU networks.

Let ff be a general position ReLU network, then for every xx in the domain of ff, the set of elements returned by the generalized chain rule is exactly the generalized Jacobian:

In particular this theorem implies that, for general position ReLU nets,

We will develop algorithms to solve this optimization problem predicated upon the assumption that a ReLU network is in general position. As shown by the following theorem, almost every ReLU network satisfies this condition.

The set of ReLU networks not in general position has Lebesgue measure zero over the parameter space.

Inapproximability of the Local Lipschitz Constant

In general, we seek algorithms that yield estimates of the Lipschitz constant of ReLU networks with provable guarantees. In this section we will address the complexity of Lipschitz estimation of ReLU networks. We show that under mild complexity theoretic assumptions, no deterministic polynomial time algorithm can provably return a tight estimate of the Lipschitz constant of a ReLU network

Computing Local Lipschitz Constants With Mixed-Integer Programs

While mixed-integer programming requires exponential time in the worst-case, implementations of mixed-integer programming solvers typically have runtime that is significantly lower than the worst-case. Our algorithm is unlikely to scale to massive state-of-the-art image classifiers, but we nevertheless argue the value of such an algorithm in two ways. First, it is important to provide a ground-truth as a frame of reference for evaluating the relative error of alternative Lipschitz estimation techniques. Second, an algorithm that provides provable guarantees for Lipschitz estimation allows one to make accurate claims about the properties of neural networks. We empirically demonstrate each of these use-cases in the experiments section.

We state the following theorem about the correctness of our MIP formulation and will spend the remainder of the section describing the construction yielding the proof.

Mixed-integer programming may be viewed as the extension of linear programming where some variables are constrained to be integral. The feasible sets of mixed-integer programs, may be defined as follows:

Mixed-integer programming then optimizes a linear function over a mixed-integer polytope.

From equation 7, our goal is to frame ∇#f(X)\nabla^{\#}f(\mathcal{X}) as a mixed-integer polytope. More accurately, we aim to frame {∣∣GT∣∣α∣G∈∇#f(X)}\{||G^{T}||_{\alpha}\mid G\in\nabla^{\#}f(\mathcal{X})\} as a mixed-integer polytope. The key idea for how we do this is encapsulated in the following example. Suppose X\mathcal{X} is some set and we wish to solve the optimization problem max⁡x∈X(g∘f)(x)\max_{x\in\mathcal{X}}(g\circ f)(x). Letting Y:={f(x)∣x∈X}\mathcal{Y}:=\{f(x)\mid x\in\mathcal{X}\} and Z:={g(y)∣y∈Y}\mathcal{Z}:=\{g(y)\mid y\in\mathcal{Y}\}, we see that

Thus, if X\mathcal{X} is a mixed-integer polytope, and ff is such that f(X)f(\mathcal{X}) is also a mixed-integer polytope and similar for gg, then the optimization problem may be solved under the MIP framework.

From the example above, it suffices to show that ∇#f(⋅)\nabla^{\#}f(\cdot) is a composition of functions fif_{i} with the property that fif_{i} maps mixed-integer polytopes to mixed-integer polytopes without blowing up in encoding-size. We formalize this notion with the following definition:

We say that a function gg is MIP-encodable if, for every mixed-integer polytope MM, the image of MM mapped through gg is itself a mixed-integer polytope.

As an example, we show that the affine function g(x):=Dx+eg(x):=Dx+e is MIP-encodable, where gg is applied only to the continuous variables. Consider the canonical mixed-integer polytope MM defined in equation 8, then g(M)g(M) is the mixed-integer polytope over the existing variables (x,a)(x,a), with the dimension lifted to include the new continuous variable yy and a new equality constraint:

To represent {∣∣GT∣∣α∣x∈∇#f(X)}\{||G^{T}||_{\alpha}\mid x\in\nabla^{\#}f(\mathcal{X})\} as a mixed-integer polytope, there are two steps. First we must demonstrate a set of primitive functions such that ∣∣∇#f(x)∣∣α||\nabla^{\#}f(x)||_{\alpha} may be represented as a composition of these primitives, and then we must show that each of these primitives are MIP-encodable. In this sense, the following construction allows us to ‘unroll’ backpropagation into a mixed-integer polytope.

Then we have the two following lemmas which suffice to show that ∇#f(⋅)\nabla^{\#}f(\cdot) is a MIP-encodable function:

Let ff be a scalar-valued general position ReLU network. Then f(x)f(x), ∇#f(x)\nabla^{\#}f(x), ∣∣⋅∣∣1||\cdot||_{1}, and ∣∣⋅∣∣∞||\cdot||_{\infty} may all be written as a composition of affine, conditional and switch operators.

This is easy to see for f(x)f(x) by the recurrence in Equation 5; indeed this construction is used in the MIP-formulation for evaluating robustness of neural networks . For ∇#f\nabla^{\#}f, one can define the recurrence:

where Λi(x)\Lambda_{i}(x) is the conditional operator applied to the input to the ithi^{th} layer of ff. Since Λi(x)\Lambda_{i}(x) takes values in {0,1}∗\{0,1\}^{*}, Diag(Λ(x))Yi+1(x)\text{Diag}(\Lambda(x))Y_{i+1}(x) is equivalent to S(Yi+1(x),Λi(x))S(Y_{i+1}(x),\Lambda_{i}(x)).

Let gg be a composition of affine, conditional and switch operators, where global lower and upper bounds are known for each input to each element of the composition. Then gg is a MIP-encodable function.

As we have seen, affine operators are trivially MIP-encodable. For the conditional and switch operators, global lower and upper bounds are necessary for MIP-encodability. Provided that our original set X\mathcal{X} is bounded, there exist several efficient schemes for propagating upper and lower bounds globally. Conditional and switch operators may be incorporated into the composition by adding only a constant number of new linear inequalities for each new variable. These constructions are described in full detail in Appendix D.

Related Work

We note the deep connection between certifying the robustness of neural networks and estimating the Lipschitz constant. Mixed-integer programming has been used to exactly certify the robustness of ReLU networks to adversarial attacks . Broadly speaking, the mixed-integer program formulated in each of these works is the same formulation we develop to emulate the forward-pass of a ReLU network. Our work may be viewed as an extension of these techniques where we emulate the forward and backward pass of a ReLU network with mixed-integer programming, instead of just the forward pass. We also note that the subroutine we use for bound propagation is exactly the formulation of FastLip , which can be viewed as a form of reachability analysis, for which there is a deep body of work in the adversarial robustness setting .

Experiments

We have described an algorithm to exactly compute the Lipschitz constant of a ReLU network. We now demonstrate several applications where this technique has value. First we will compare the performance and accuracy of the techniques introduced in this paper to other Lipschitz estimation techniques. Then we will apply LipMIP to a variety of networks with different architectures and different training schemes to examine how these changes affect the Lipschitz constant. Full descriptions of the computing environment and experimental details are contained in Appendix F. We have also included extra experiments analyzing random networks, how estimation changes during training, and an application to vector-valued networks in Appendix F.

Accuracy vs. Efficiency: As is typical in approximation techniques, there is frequently a tradeoff between efficiency and accuracy. This is the case for Lipschitz estimation of neural nets. While ours is the first algorithm to provide quality guarantees about the returned estimate, it is worthwhile to examine how accurate the extant techniques for Lipschitz estimation are. We compare against the following estimation techniques: CLEVER , FastLip , LipSDP , SeqLip and our MIP formulation (LipMIP) and its LP-relaxation (LipLP). We also provide the accuracy of a random lower-bounding technique where we report the maximum gradient dual norm over a random selection of test points (RandomLB) and a naive upper-bounding strategy (NaiveUB) where we report the product of the operator norm of each affine layer and scale by d\sqrt{d} due to equivalence of norms. In Table 1, we demonstrate the runtime and relative error of each considered technique. We evaluate each technique over the unit hypercube across random networks, networks trained on synthetic datasets, and networks trained to distinguish between MNIST 1’s and 7’s.

Effect of Training On Lipschitz Constant: As other techniques do not provide reliable estimates of the Lipschitz constant, we argue that these are insufficient for making broad statements about how the parameters or training scheme of a neural network affect the Lipschitz constant. In Figure 1 (left), we compare the returned estimate from a variety of techniques as a network undergoes training on a synthetic dataset. Notice how the estimates decrease in quality as training proceeds. On the other hand, in Figure 1 (right), we use LipMIP to provide reliable insights as to how the Lipschitz constant changes as a neural network is trained on a synthetic dataset under various training schemes. A similar experiment where we vary network architecture is presented in Appendix F.

Conclusion and Future Work

We framed the problem of local Lipschitz computation of a ReLU network as an optimization over generalized Jacobians, yielding an analytical result that holds for all Lipschitz continuous vector-valued functions. We further related this to an optimization over the elements returnable by the chain rule and demonstrated that even approximately solving this optimization problem is hard. We propose a technique to exactly compute this value using mixed integer programming solvers. Our exact method takes exponential time in the worst case but admits natural LP relaxations that trade-off accuracy for efficiency. We use our algorithm to evaluate other Lipschitz estimation techniques and evaluate how the Lipschitz constant changes as a network undergoes training or changes in architecture.

There are many interesting future directions. We have only started to explore relaxation approaches based on LipMIP and a polynomial time method that scales to large networks may be possible. The reliability of an exact Lipschitz evaluation technique may also prove useful in developing both new empirical insights and mathematical conjectures.

Acknowledgments and Disclosure of Funding

This research has been supported by NSF Grants CCF 1763702,1934932, AF 1901292, 2008710, 2019844 research gifts by Western Digital, WNCG IAP, computing resources from TACC and the Archie Straiton Fellowship.

Broader Impact

As deep learning begins to see use in situations where safety or fairness are critical, it is increasingly important to have tools to audit and understand these models. The Lipschitz computation technique we have outlined in this work is one of these tools. As we have discussed, an upper bound on the Lipschitz constant of a model may be used to efficiently generate certificates of robustness against adversarial attacks. Lipschitz estimates have the advantage over other robustness certificates in that they may be used to make robustness claims about large subsets of the input space, rather than certifying that a particular input is robust against adversarial attacks. Lipschitz estimation, if comuputable with respect to fair metrics, may be utilized to generate certificates of individual fairness (see for examples of this formulation of fair metrics and individual fairness). Our approach is the first to provide a scheme for Lipschitz estimation with respect to arbitrary norms, which may include these fair metrics.

Exact verification of neural networks has the added benefit that we are guaranteed to be generate the correct answer and not just a sound approximation. We argue that a fundamental understanding of the behavior of these models needs to be derived from both theoretical results and accurate empirical validation. As we have demonstrated, our technique is able to provide accurate measurements of the Lipschitz constant of small-scale neural networks. The computational complexity of the problem suggests that such accurate measurements are not tractably attainable for networks with millions of hyperparameters. Our experiments demonstrate that our technique is scalable to networks large enough that insights may be drawn, such as claims about how regularized training affects the Lipschitz constant. Further, exact verification techniques may be used as benchmarks to verify the accuracy of the more efficient verification techniques. Future Lipschitz estimation techniques, assuming that they do not provide provable guarantees, will need to assert the accuracy of their reported answers: it is our hope that this will be empirically done by comparisons against exact verification techniques, where the accuracy claims may then be extrapolated to larger networks.

References

Appendix

We first start with formal definitions and known facts. We present our results in general for vector-valued functions, but we will make remarks about the implications for scalar-valued networks along the way.

As we will be frequently referring to arbitrary norms, we recall the formal definition:

A norm ∣∣⋅∣∣||\cdot|| over vector space VV is a nonnegative valued function that meets the following three properties:

Triangle Inequality: For all x,y∈Vx,y\in V, ∣∣x+y∣∣≤∣∣x∣∣+∣∣y∣∣||x+y||\leq||x||+||y||

Absolute Homogeneity: For all x∈Vx\in V, and any field element aa, ∣∣ax∣∣=∣a∣⋅∣∣x∣∣||ax||=|a|\cdot||x||.

Point Separation: If ∣∣x∣∣=0||x||=0, then x=0x=0, the zero vector of VV.

A convenient way to keep the notation straight is that AA, above, can be viewed as a linear operator which maps elements from a space which has norm ∣∣⋅∣∣α||\cdot||_{\alpha} to a space which has norm ∣∣⋅∣∣β||\cdot||_{\beta}, and hence is equipped with the norm ∣∣A∣∣α,β||A||_{\alpha,\beta}. As long as ∣∣⋅∣∣α,∣∣⋅∣∣β||\cdot||_{\alpha},||\cdot||_{\beta} are norms, then ∣∣⋅∣∣α,β||\cdot||_{\alpha,\beta} is a norm as well in that the three properties listed above are satisfied.

Every norm induces a dual norm, defined as

Indeed, assuming WLOG that neither xx nor yy are zero, and letting u=x∣∣x∣∣αu=\frac{x}{||x||_{\alpha}}, we have

We can make a similar claim about the matrix norms defined above, ∣∣⋅∣∣α,β||\cdot||_{\alpha,\beta}:

Indeed, assuming WLOG that xx is nonzero, letting y=x/∣∣x∣∣αy=x/||x||_{\alpha} such that ∣∣y∣∣α=1||y||_{\alpha}=1, we have

Then the Lipschitz constant, L(α,β)(f,X)L^{(\alpha,\beta)}(f,\mathcal{X}), is the infimum over all such LL. Equivalently, one can define Lα,β(f,X)L^{\alpha,\beta}(f,\mathcal{X}) as

Where we note that we are taking limits of a vector-valued function. We now add the following known facts:

If ff is lipschitz continuous, then it is absolutely continuous.

If ff is differentiable at xx, all directional derivatives exist at xx. The converse is not true, however.

If ff is differentiable at xx, then for any vector vv, dvf(x)=∇f(x)Tvd_{v}f(x)=\nabla f(x)^{T}v.

A.2 Proof of Theorem 1

Now we can state our first lemma, which claims that for any norm, the maximal directional derivative is attained at a differentiable point of ff:

Essentially the plan is to say each of the following quantities are within ϵ\epsilon of each other: ∣∣dvf(x)∣∣β||d_{v}f(x)||_{\beta}, the limit definition of ∣∣dvf(x)∣∣β||d_{v}f(x)||_{\beta}, the limit definition of ∣∣dvf(x′)∣∣β||d_{v}f(x^{\prime})||_{\beta} for nearby differentiable x′x^{\prime}, and the norm of the gradient at x′x^{\prime} applied to the direction vv.

By the definition of sup⁡\sup, for every ϵ>0\epsilon>0, there exists an x∈Dvx\in\mathcal{D}_{v} such that

Then for all ϵ>0\epsilon>0, by the limit definition of dvf(x)d_{v}f(x) there exists a δ>0\delta>0 such that for all tt with ∣t∣<δ|t|<\delta

Next we note that, since lipschitz continuity implies absolute continuity of ff, and tt is now a fixed constant, the function h(x):=f(x)∣∣tv∣∣αh(x):=\frac{f(x)}{||tv||_{\alpha}} is absolutely continuous. Hence there exists some δ′\delta^{\prime} such that for all y∈Xy\in\mathcal{X}, zz with ∣∣z∣∣α≤δ′||z||_{\alpha}\leq\delta^{\prime}

Hence, by Rademacher’s theorem, there exists some differentiable x′x^{\prime} within a δ′\delta^{\prime}-neighborhood of xx, such that both ∣∣f(x′)−f(x)∣∣β∣∣tv∣∣α<ϵ/4\frac{||f(x^{\prime})-f(x)||_{\beta}}{||tv||_{\alpha}}<\epsilon/4 and ∣∣f(x′+tv)−f(x+tv)∣∣β∣∣tv∣∣α<ϵ/4\frac{||f(x^{\prime}+tv)-f(x+tv)||_{\beta}}{||tv||_{\alpha}}<\epsilon/4, hence by the triangle inequality for ∣∣⋅∣∣β||\cdot||_{\beta}

Combining equations 27 and 29 we have that

Taking limits over δ→0\delta\rightarrow 0, we get that the final term in equation 30 becomes 3ϵ/4+∣∣dvf(x′)∣∣β3\epsilon/4+||d_{v}f(x^{\prime})||_{\beta}, which is equivalent to 3ϵ/4+∣∣∇f(x)Tv∣∣β3\epsilon/4+||\nabla f(x)^{T}v||_{\beta}. Hence we have that

as desired, as our choice of vv was arbitrary.

Now we can restate and prove our main theorem.

Before we proceed with the proof, we make some remarks. First, note that if ff is scalar-valued and continuously differentiable, then ∇f(x)T\nabla f(x)^{T} is a row-vector, and ∣∣∇f(x)T∣∣α,β=∣∣∇f(x)∣∣α∗||\nabla f(x)^{T}||_{\alpha,\beta}=||\nabla f(x)||_{\alpha^{*}}, recovering the familiar known result. Second, to gain some intuition for this statement, consider the case where f(x)=Ax+bf(x)=Ax+b is an affine function. Then ∇f(x)T=A\nabla f(x)^{T}=A, and by applying the theorem and leveraging the definition of L(α,β)(f,X)L^{(\alpha,\beta)}(f,\mathcal{X}), we have

where the last equality holds because X\mathcal{X} is open.

It suffices to prove the following equality:

This follows naturally as if x∈Diff(X)x\in\text{Diff}(\mathcal{X}) then δf(x)={∇f(x)}\delta_{f}(x)=\{\nabla f(x)\}. On the other hand, if x∉Diff(X)x\not\in\text{Diff}(\mathcal{X}), then for every extreme point GG in δf(x)\delta_{f}(x), there exists an x′∈Diff(X)x^{\prime}\in\text{Diff}(\mathcal{X}) such that ∇f(x′)=G\nabla f(x^{\prime})=G (by definition). As we seek to optimize over a norm, which is by definition convex, there exists an extreme point of δf(x)\delta_{f}(x) which attains the optimal value. Hence, we proceed by showing that Equation 34 holds.

We show that for all x,y∈Xx,y\in\mathcal{X} that ∣∣f(x)−f(y)∣∣β∣∣x−y∣∣α\frac{||f(x)-f(y)||_{\beta}}{||x-y||_{\alpha}} is bounded above by sup⁡x∈Diff(X)∣∣∇f(x)∣∣α,β\sup_{x\in\text{Diff}(\mathcal{X})}||\nabla f(x)||_{\alpha,\beta}. Then we will show the opposite inequality.

Fix any x,y∈Xx,y\in\mathcal{X}, and note that since the dual of a dual norm is the original norm,

Moving the sup⁡\sup to the outside, we have

Further, there exists a lebesgue integrable function g(t)g(t) that equals hc′(t)h_{c}^{\prime}(t) almost everywhere and

We can assume without loss of generality that

where the supremum is defined over all points where hc′(t)h_{c}^{\prime}(t) is defined. Then because gg agrees almost everywhere with hc′h_{c}^{\prime} and is bounded pointwise, we have the following chain of inequalities:

Where Equation 45 holds by Proposition 1, Equation 46 holds by Lemma 3, and the final inequality holds by Proposition 2. Dividing by ∣∣x−y∣∣α||x-y||_{\alpha} yields the desired result.

On the other hand, we wish to show, for every ϵ>0\epsilon>0, the existence of an x,y∈Xx,y\in\mathcal{X} such that

Fix ϵ>0\epsilon>0 and consider any point z∈Xz\in\mathcal{X} with ∣∣∇f(z)T∣∣α,β≥sup⁡x∈X∣∣∇f(x)T∣∣α,β−ϵ/2||\nabla f(z)^{T}||_{\alpha,\beta}\geq\sup_{x\in\mathcal{X}}||\nabla f(x)^{T}||_{\alpha,\beta}-\epsilon/2.

Then ∣∣∇f(z)T∣∣α,β=sup⁡∣∣v∣∣α≤1∣∣∇f(z)Tv∣∣β=sup⁡∣∣v∣∣α≤1∣∣dvf(z)∣∣β||\nabla f(z)^{T}||_{\alpha,\beta}=\sup_{||v||_{\alpha}\leq 1}||\nabla f(z)^{T}v||_{\beta}=\sup_{||v||_{\alpha}\leq 1}||d_{v}f(z)||_{\beta}. By the definition of the directional derivative, there exists some δ>0\delta>0 such that for all ∣t∣<δ|t|<\delta,

Hence setting x=z+tvx=z+tv and y=vy=v, we recover equation 48. ∎

Appendix B Chain Rule and General Position proofs

In this section, we provide the formal proofs of statements made in Section 3.

ReLU Kernels: For a ReLU network, define the functions gi(x)g_{i}(x) as the input to the ithi^{th} ReLU of ff. We define the ithi^{th} ReLU kernel as the set for which gi=0g_{i}=0:

The Chain Rule: The chain rule is a means to compute derivatives of compositions of smooth functions. Backpropagation is a dynamic-programming algorithm to perform the chain rule, increasing efficiency by memoization. This is most easily viewed as performing a backwards pass over the computation graph, where each node has associated with it a partial derivative of its output with respect to its input. As mentioned in the main paper, the chain rule may perform incorrectly when elements of the composition are nonsmooth, such as the ReLU operator. Indeed, the ReLU σ\sigma has a derivative which is well defined everywhere except for zero, for which it has a subdifferential of $$.

Consider any implementation of the chain rule which may arbitrarily assign any element of the generalized gradient δσ(0)\delta_{\sigma}(0) for each required partial derivative σ′(0)\sigma^{\prime}(0). We define the set-valued function ∇#f(⋅)\nabla^{\#}f(\cdot) as the collection of answers yielded by any such chain rule.

While we note that our mixed-integer programming formulation treats ∇#(f)\nabla^{\#}(f) in this set-valued sense, most implementations of automatic differentiation choose either {0,1}\{0,1\} to be the evaluation of σ′(0)\sigma^{\prime}(0) such that ∇#f\nabla^{\#}f is not set valued (e.g.,in PyTorch and Tensorflow, σ′(0)=0\sigma^{\prime}(0)=0). Our theory holds for our set-valued formulation, but in the case of automatic differentiation packages, as long as σ′(0)∈\sigma^{\prime}(0)\in, our results will hold.

B.2 Proof of Theorem 2

Before restating Theorem 2 and the proof, we introduce the following lemmas:

Let {Ki}i=1m\{K_{i}\}_{i=1}^{m} be the ReLU kernels of a general position neural net, ff. Then for any xx contained in exactly kk of them, say WLOG K1,…,KkK_{1},\dots,K_{k}, xx lies in the relative interior of one of the polyhedral components of ∩i=1kKi\cap_{i=1}^{k}K_{i}.

Since ff is in general position, ∩i=1kKi\cap_{i=1}^{k}K_{i} is a union of (d−k)(d-k)-dimensional polytopes. Let PP be one of the polytopes in this union such that x∈Px\in P. Since PP is an (d−k)(d-k)-face in the polyhedral complex induced by {Ki}i=1m\{K_{i}\}_{i=1}^{m}, each point on the boundary of PP is the intersection of at least k+1k+1 ReLU kernels of ff. Thus xx cannot be contained in the boundary of PP and must reside in the relative interior. ∎

The rest of the components are geometric. We introduce the notion of a cutting hyperplane:

We say that a hyperplane HH is a cutting hyperplane of a polytope PP if it is neither a separating nor supporting hyperplane of PP.

We now state and prove several properties of cutting hyperplanes:

HH contains a point in the relative interior of PP, and H∩P≠PH\cap P\neq P.

HH cuts PP into two polytopes with the same dimension as PP: dim(P∩H+)=dim(P∩H−)=dim(P)dim(P\cap H^{+})=dim(P\cap H^{-})=dim(P) and H∩P≠PH\cap P\neq P.

Throughout we will denote the affine hull of PP as UU. \reflemma:cut-a  ⟹  \reflemma:cut-b\text{\ref{lemma:cut-a}}\implies\text{\ref{lemma:cut-b}}: By assumption, HH is neither a supporting nor separating hyperplane. Since neither H+∩PH^{+}\cap P nor H−∩PH^{-}\cap P is PP, H∩P≠PH\cap P\neq P. Thus H∩PH\cap P is a codimension 1 subspace, with respect to UU. Since HH is not a supporting hyperplane, H∩UH\cap U must not lie on the boundary of PP (relative to UU). Thus H∩UH\cap U contains a point in the relative interior of PP and so does HH.

\reflemma:cut-b  ⟹  \reflemma:cut-c\text{\ref{lemma:cut-b}}\implies\text{\ref{lemma:cut-c}}: By assumption H∩P≠PH\cap P\neq P. Consider some point, xx, inside HH and the relative interior of PP. By definition of relative interior, there is some neighborhood Nϵ(x)N_{\epsilon}(x) such that Nϵ(x)∩U⊂PN_{\epsilon}(x)\cap U\subset P. Thus there exists some x′∈Nϵ(x)x^{\prime}\in N_{\epsilon}(x) such that (Nϵ′(x′)∩U)⊂(Ho+∩P)(N_{\epsilon^{\prime}}(x^{\prime})\cap U)\subset(H_{o}^{+}\cap P) and thus the affine hull of H+∩PH^{+}\cap P must have the same dimension as UU. Similarly for H−∩PH^{-}\cap P.

\reflemma:cut-c  ⟹  \reflemma:cut-a\text{\ref{lemma:cut-c}}\implies\text{\ref{lemma:cut-a}}: Since P∩H+P\cap H^{+} and P∩H−P\cap H^{-} are nonempty, then P∩HP\cap H is nonempty and thus HH is not a separating hyperplane of PP. Suppose for the sake of contradiction that H+∩P=PH^{+}\cap P=P. Then Ho−∩P=∅H_{o}^{-}\cap P=\emptyset, this implies that dim(H∩P)=dim(P)dim(H\cap P)=dim(P) which only occurs if P⊆HP\subseteq H which is a contradiction. Repeating this for H−∩PH^{-}\cap P, we see that HH is not a supporting hyperplane of PP. ∎

Let FF be a (k)(k)-dimensional face of a polytope PP. If HH is a cutting hyperplane of FF, then HH is a cutting hyperplane of PP.

Since HH is a cutting hyperplane of FF, HH is neither a separating hyperplane nor is P⊆HP\subseteq H. Thus it suffices to show that HH is not a supporting hyperplane of PP. Since HH cuts FF, there exist points inside F∩Ho+F\cap H_{o}^{+} and F∩Ho−F\cap H_{o}^{-}, where Ho+H_{o}^{+}, Ho−H_{o}^{-} are the open halfspaces induced by HH. Thus neither P∩Ho+P\cap H_{o}^{+} nor P∩Ho−P\cap H_{o}^{-} are empty, which implies that HH is not a supporting hyperplane of PP, hence HH must also be a cutting hyperplane of PP.

Now we can proceed with the proof of Theorem 2:

Let ff be a general position ReLU network, then for every xx in the domain of ff, the set of elements returned by the generalized chain rule ∇#f(x)\nabla^{\#}f(x) is exactly the generalized Jacobian:

Part 1: The first part of this proof shows that if xx is contained in exactly kk ReLU kernels, then xx is contained in 2k2^{k} full-dimensional linear regions of ff. We prove this claim by induction on kk. The case where k=1k=1 is trivial. Now assume that the claim holds up to k−1k-1. Assume that xx lies in the ReLU kernel for every neuron in a set S⊆[m]S\subseteq[m], with ∣S∣=k|S|=k. Without loss of generality, let j∈Sj\in S be a neuron whose depth, LL, is at least as great as the depth of every other neuron in SS. Then one can construct a subnetwork f′f^{\prime} of ff by considering only the first LL layers of ff and omitting neuron jj. Now KiK_{i} is a ReLU kernel of f′f^{\prime} for every i∈S∖{j}i\in S\setminus\{j\}, and further suppose that f′f^{\prime} is a general position ReLU net. From the inductive hypothesis, we can see that xx is contained in exactly 2k−12^{k-1} linear regions of f′f^{\prime}. By Lemma 4, xx resides in the relative interior of a (n−k+1)(n-k+1)-dimensional polytope, PP, contained in the union that defines ∩i=1k−1Ki\cap_{i=1}^{k-1}K_{i}. Since jj has maximal depth, gj(⋅)g_{j}(\cdot) is affine in PP, and thus there exists some hyperplane HH such that P∩Kj=P∩HP\cap K_{j}=P\cap H. Thus by Lemma 5 b, HH is a cutting hyperplane of PP.

Consider some linear region RR of f′f^{\prime} containing xx. Then gj(x)g_{j}(x) is affine inside each RR and hence there exists some hyperplane HRH_{R} such that R∩Kj=R∩HRR\cap K_{j}=R\cap H_{R}, with the additional property that HR∩P=H∩PH_{R}\cap P=H\cap P. By general position, H∩P≠PH\cap P\neq P and thus HRH_{R} is a cutting hyperplane for PP by Lemma 5 b. Since PP is a (n−k+1)(n-k+1)-dimensional face of RR, we can apply Lemma 6 to see that HRH_{R} is a cutting hyperplane for RR as desired.

Now we show that the implication proved in part 1 of the proof implies that ∇#f(x)=δf(x)\nabla^{\#}f(x)=\delta_{f}(x). This follows in two steps. The first step is to show that ∇f#(x)\nabla f^{\#}(x) is a convex set for all xx, and the second step is to show the following inclusion holds:

Where, for any convex set CC, V(C)\mathcal{V}(C) denotes the set of extreme points of CC. Then the theorem will follow by taking convex hulls.

To show that ∇#f(x)\nabla^{\#}f(x) is convex, we make the following observation: every element of ∇#f(x)\nabla^{\#}f(x) must be attainable by some implementation of the chain rule which assigns values for every σ′(0)\sigma^{\prime}(0). If Λ0∈∇#f(x)\Lambda_{0}\in\nabla^{\#}f(x) is attainable by setting exactly zero σ′(0)′s\sigma^{\prime}(0)^{\prime}s to lie in the open interval (0,1)(0,1), then Λ0\Lambda_{0} is the Jacobian matrix corresponding to one of the full-dimensional linear regions that xx is contained in. Consider some Λr∈∇#f(x)\Lambda_{r}\in\nabla^{\#}f(x) which is attainable by setting exactly rr σ′(0)′s\sigma^{\prime}(0)^{\prime}s to lie in the open interval (0,1)(0,1). Then certainly Λr\Lambda_{r} may be written as the convex combination of Λr−1(1)\Lambda^{(1)}_{r-1} and Λr−1(2)\Lambda^{(2)}_{r-1} for two elements of δf(x)\delta_{f}(x), attainable by setting exactly (r−1)(r-1) ReLU partial derivatives to be nonintegral. This holds for all r∈{1,…k}r\in\{1,\dots k\} and thus ∇#f(x)\nabla^{\#}f(x) is convex.

To show the equality in Equation 52, we first consider some element of V(δf(x))\mathcal{V}(\delta_{f}(x)). Certainly this must be the Jacobian of some full-dimensional linear region containing xx, and hence there exists some assignment of ReLU partial derivatives such that the chain rule yields this Jacobian. On the other hand, we’ve shown in the previous section that every element of ∇#f(x)\nabla^{\#}f(x) may be written as a convex combination of the Jacobians of the full-dimensional linear regions of ff containing xx. Hence each extreme point of ∇#f(x)\nabla^{\#}f(x) must be the Jacobian of one of the full-dimensional linear regions of ff containing xx. ∎

B.3 Proof of Theorem 3

The set of ReLU networks not in general position has Lebesgue measure zero over the parameter space.

We prove the claim by induction over the number of neurons of a ReLU network. As every ReLU network with only one neuron is in general position, the base case holds trivially. Now suppose that the claim holds for families of ReLU networks with k−1k-1 neurons. Then we can add a new neuron in one of two ways: either we add a new neuron to the final layer, or we add a new layer with only a single neuron. Every neural network may be constructed in this fashion, so the induction suffices to prove the claim. Both cases of the induction may be proved with the same argument:

Consider some ReLU network, ff, with k−1k-1 neurons. Then consider adding a new neuron to ff in either of the two ways described above. Let BfB_{f} denote the set of neural networks with the same architecture as ff that are not in general position, and similarly for Bf′B_{f^{\prime}}. Let Cf′C_{f^{\prime}} denote the set of neural networks with the same architecture as f′f^{\prime} that are not in general position, but are in general position when the kthk^{th} neuron is removed. Certainly if ff is not in general position, then f′f^{\prime} is not in general position. Thus

where μf(Bf)=0\mu_{f}(B_{f})=0 by the induction hypothesis. We need to show the measure of Cf′C_{f^{\prime}} is zero as follows. Letting KkK_{k} denote the ReLU kernel of the neuron added to ff to yield f′f^{\prime}, we note that ff is not in general position only if one of the affine hulls of the polyhedral components of KkK_{k} contains the affine hull of some polyhedral component of some intersection ∩i∈SKi\cap_{i\in S}K_{i} where SS is a nonempty subset of the k−1k-1 neurons of ff. We primarily control the bias parameter, as this is universal over all linear regions, and notice that this problem reduces to the following: what is the measure of hyperplanes that contain any of a finite collection of affine subspaces? By the countable subadditivity of the Lebesgue measure and the fact that the set of hyperplanes that contain any single affine subspace has measure 0, μf′(Cf′)=0\mu_{f^{\prime}}(C_{f^{\prime}})=0. ∎

Appendix C Complexity Results

Here we recall some relevant preliminaries in complexity theory. We will gloss over some formalisms where we can, though a more formal discussion can be found here .

We are typically interested in combinatorial optimization problems, which we will define informally as follows:

A combinatorial optimization problem is composed of 4 elements: i) A set of valid instances; ii) A set of feasible solutions for each valid instance; iii) A non-negative cost or objective value for each feasible solution; iv) A goal: signifying whether we want to find a feasible solution that either minimizes or maximizes the cost function.

In this subsection, we will typically refer to problems using the letter Π\Pi, where instances of that optimization problem are xx, and feasible solutions are yy, and the cost of yy is m(y)m(y). We will refer to the cost of the optimal solution to instance x∈Πx\in\Pi as OPT(x)OPT(x). Optimization problems then typically have 3 formulations, listed in order of decreasing difficulty:

Search Problem: Given an instance xx of optimization problem Π\Pi, find yy such that m(y)=OPT(x)m(y)=OPT(x).

Computational Problem: Given an instance xx of optimization problem Π\Pi, find OPT(x)OPT(x)

Decision Problem: Given an instance xx of optimization problem Π\Pi, and a number kk, decide whether or not OPT(x)≥kOPT(x)\geq k.

Certainly an efficient algorithm to do one of these implies an efficient algorithm to do the next one. Also note that by a binary search procedure, the computational problem is polynomially-time reducible to the decision problem. As complexity theory is typically couched in discussion about membership in a language, it is slightly awkward to discuss hardness of combinatorial optimization problems. Since, every computational flavor of an optimization problem has a poly-time equivalent decision problem, we will simply claim that an optimization problem is NP-hard if its decision problem is NP-hard.

While many interesting optimization problems are hard to solve exactly, for many of these interesting problems there exist efficient approximation algorithms that can provide a guarantee about the cost of the optimal solution.

For a maximization problem Π\Pi, an approximation algorithm with approximation ratio α\alpha is a polynomial-time algorithm that, for every instance x∈Πx\in\Pi, produces a feasible solution, yy, such that m(y)≥OPT(x)/αm(y)\geq OPT(x)/\alpha.

Noting that α>1\alpha>1 can either be a constant or a function parameterized by ∣x∣|x|, length of the binary encoding of instance xx. We also note that this definition frames approximation algorithms as a “search problem".

A very powerful tool in showing the hardness of approximation problems is the notion of a cc-gap problem. This is a form of promise problem, and proofs of hardness here are slightly stronger than what we actually desire.

Given an instance of an maximization problem x∈Πx\in\Pi and a number kk, the c-gap problem aims to distinguish between the following two cases:

where there is no requirement on what the output should be, should OPT(x)OPT(x) fall somewhere in [k/c,k)[k/c,k). For minimization problems, YES cases imply OPT(x)≤kOPT(x)\leq k, and NO cases imply OPT(x)>k⋅cOPT(x)>k\cdot c.

Again we note that cc may be a function that takes the length of xx as an input. We now recall how a cc-approximation algorithm may be used to solve the cc-gap problem, implying the cc-gap problem is at least as hard as the cc-approximation.

If the cc-gap problem is hard for a maximization problem Π\Pi, then the cc-approximation problem is hard for Π\Pi.

Suppose we have an efficient cc-approximation algorithm for Π\Pi, implying that for any instance x∈Πx\in\Pi, we can output a feasible solution yy such that OPT(x)/c≤m(y)≤OPT(x)OPT(x)/c\leq m(y)\leq OPT(x). Then we let AkA_{k} be an algorithm that retuns YES if m(y)≥k/cm(y)\geq k/c, and NO otherwise, where yy is the solution returned by the approximation algorithm Then for the gap-problem, if OPT(x)≥kOPT(x)\geq k, we have that m(y)≥k/cm(y)\geq k/c so the AkA_{k} will output YES. On the other hand, if OPT(x)<k/cOPT(x)<k/c, then AkA_{k} will output NO. Hence, AkA_{k} is an efficient algorithm to decide the cc-gap problem. ∎

While hardness of approximation results arise from various forms, most notably the PCP theorem, we can black-box the heavy machinery and prove our desired results using only strict reductions, which we define as follows.

A strict reduction from problem Π\Pi to problem Π′\Pi^{\prime}, is a functions ff, such that f:Π→Π′f:\Pi\rightarrow\Pi^{\prime} maps problem instances of Π\Pi to problem instances of Π′\Pi^{\prime}. ff must satisfy the following properties that for all x∈Πx\in\Pi

∣f(x)∣∣x∣≤α\frac{|f(x)|}{|x|}\leq\alpha, where α\alpha is a fixed constant

For which we can now state and prove the following useful proposition:

If f,gf,g are a strict reduction from optimization problem Π\Pi to optimization problem Π′\Pi^{\prime}, and the cc-gap problem is hard for Π\Pi, where cc is polynomial in the size of ∣x∣|x|, then the c′c^{\prime}-gap problem is hard for Π′\Pi^{\prime}, where c′∈Θ(c)c^{\prime}\in\Theta(c).

Suppose both Π\Pi and Π′\Pi^{\prime} are maximization problems, and the cc-gap problem is hard for Π\Pi. We consider the case where cc is a function that takes as input the encoding size of instances of Π\Pi. We can define the function c′(n):=c(n/α)c^{\prime}(n):=c(n/\alpha) for all nn. Hence c(∣x∣)=c′(∣f(x)∣)c(|x|)=c^{\prime}(|f(x)|) for all x∈Πx\in\Pi by point 1 of the definition of strict reduction. Then for all kk and all x∈Πx\in\Pi, the following two implications hold

Where both implications hold because OPTΠ(x)=OPTΠ′(f(x))OPT_{\Pi}(x)=OPT_{\Pi^{\prime}}\left(f(x)\right). If the c′c^{\prime}-gap problem were efficiently decidable for Π′\Pi^{\prime}, then the c′c^{\prime}-gap problem would be efficiently decidable for Π\Pi.

If Π\Pi is a maximization problem and Π′\Pi^{\prime} is a minimization problem, then the following two implications hold:

Then letting k=k′⋅c(∣x∣)k=k^{\prime}\cdot c(|x|) we have that solving the c′c^{\prime}-gap problem for Π′\Pi^{\prime} would solve the cc-gap problem for Π\Pi. The proofs for Π,Π′\Pi,\Pi^{\prime} both being minimization problems, or Π\Pi being a minimization and Π′\Pi^{\prime} being a maximization hold using similar strategies. ∎

C.2 Proof of Theorem 4

Now we return to ReLU networks and prove novel results about the inapproximability of computing the local Lipschitz constant of a ReLU network. Recall that we have defined ReLU networks as compositions of functions of the form :

If xx is contained in the interior of some linear region of a general position ReLU network ff, then the chain rule provides the correct gradient of ff at xx, where the ithi^{th} coordinate of ∇f(x)\nabla f(x) is given by:

where Paths(i)Paths(i) is the set of paths from the ithi^{th} input, xix_{i}, to the output in the computation graph, where the ReLU at each vertex is on, and wjw_{j} is the weight of the jthj^{th} edge along the path.

We define the following optimization problems:

MAX-GRAD is an optimization problem, where the set of valid instances is the set of scalar-valued ReLU networks. The feasible solutions are the set of differentiable points x∈Xx\in\mathcal{X}, which have cost ∣∣∇f(x)∣∣1||\nabla f(x)||_{1}. The goal is to maximize this gradient norm.

MIN-LIP is an optimization problem where the set of valid instances is the set of piecewise linear neural nets. The feasible solutions are the set of constants LL such that L≥L(f)L\geq L(f). The cost is the identity function, and our goal is to minimize LL.

Of course, each of these problems have decision-problem variants, denoted by MAX-GRADdec\texttt{MAX-GRAD}_{dec} and MIN-LIPdec\texttt{MIN-LIP}_{dec}. We also remark that by Theorem 6, and proposition 4, the trivial strict reduction implies that it is at least as hard to approximate MIN-LIP as it is to approximate MAX-GRAD. For the rest of this section, we will only strive to prove hardness and inapproximability results for MAX-GRAD.

To do this, we recall the definition of the maximum independent set problem:

MIS is an optimization problem, where valid instances are undirected graphs G=(V,E)G=(V,E), and feasible solutions are U⊆VU\subseteq V such that for any vi,vj∈Uv_{i},v_{j}\in U, (vi,vj)∉E(v_{i},v_{j})\not\in E. The cost is the size of UU, and the goal is to maximize this cost.

Classically, it has been shown that MIS is NP-hard to optimize, but also is one of the hardest problems to approximate and does not admit a deterministic polynomial time algorithm to solve the O(∣V∣1−ϵ)O(|V|^{1-\epsilon})-gap problem .

For ease of exposition, we rephrase instances of MIS into instances of an equivalent problem which aims to maximize the size of consistent collections of locally independent sets. Given graph G=(V,E)G=(V,E), for any vertex vi∈Vv_{i}\in V, we let N(vi)N(v_{i}) refer to the set of vertices adjacent to ViV_{i} in GG. We sometimes will abuse notation and refer to variables by their indices, e.g., N(i)N(i). We also refer to the degree of vertex ii as d(vi)d(v_{i}) or d(i)d(i).

A locally indpendent set centered at viv_{i} is a {−1,+1}\{-1,+1\}-labelling of the vertices {vi}∪N(vi)\{v_{i}\}\cup N(v_{i}) such that the label of viv_{i} is +1+1 and the label of vj∈N(vi)v_{j}\in N(v_{i}) is −1-1. Two locally independent sets are said to be consistent if, for every vjv_{j} appearing in both locally independent sets, the label is the same in both locally independent sets. A consistent collection of locally independent sets is a set of locally independent sets that is pairwise consistent.

Then we can define an optimization problem:

LIS is an optimization problem, where valid instances are undirected graphs G=(V,E)G=(V,E), and feasible solutions are consistent collections of locally indpendent sets. The cost is the size of the collection, and the goal is to maximize this cost.

It is obvious to see that there is a trivial strict reduction between MIS and LIS. Indeed, any independent set defines the centers of a consistent collection of locally independent sets, and vice versa. As we will see, this is a more natural problem to encode with neural networks than MIS.

Now we can state our first theorem about the inapproximability of MAX-GRAD.

Next we define the second layer of ReLU’s, which has width nn, and each neuron represents the status of a locally indpendent set. We define the input to the ithi^{th} ReLU in this layer as IiI_{i} with

for some fixed-value ϵ\epsilon to be chosen later. Finally, we conclude our construction with a final affine layer to our neural net as

Let I(x)\mathcal{I}(x) denote the set of indices of ReLU’s that are ‘on’ in the second-hidden layer of hh: I(x):={i    ∣    Ii(x)>0}\mathcal{I}(x):=\{i\;\;|\;\;I_{i}(x)>0\}. Now we make the following claims about the structure of hh.

For every ii, if i∈I(x)i\in\mathcal{I}(x) then xi>1−ϵx_{i}>1-\epsilon and xj<−1+ϵx_{j}<-1+\epsilon for all j∈N(i)j\in N(i). In addition, I(x)\mathcal{I}(x) denotes the centers of a consistent collection of locally independent sets.

Indeed, if Ii(x)>0I_{i}(x)>0, then the sum of (d(i)+1)(d(i)+1) ψ\psi-terms is greater than 1−ϵ1-\epsilon. As each ψ\psi-term is in the range $,each, each\psi−termmustindividuallybeatleast-term must individually be at least1-\epsilon.And. And\psi(x_{i})\geq 1-\epsilonimpliesimpliesx_{i}\geq 1-\epsilon.Similarly,. Similarly,-\psi(x_{j})\geq 1-\epsilonimpliesthatimplies thatx_{j}\leq-1+\epsilon.Nowconsiderany. Now consider anyi_{1},i_{2}inin\mathcal{I}(x).Thenthepairoflocallyindependentsetscenteredat. Then the pair of locally independent sets centered atv_{i_{1}}andandv_{i_{2}}$ is certainly consistent. ∎

For any xx such that hh is differentiable at xx, ∇h(x)i⋅xi≥0\nabla h(x)_{i}\cdot x_{i}\geq 0.

We split into cases based on the value of xix_{i} and rely on Claim C.1. Suppose xi∈(−1+ϵ,1−ϵ)x_{i}\in(-1+\epsilon,1-\epsilon), then we have Ij<0I_{j}<0 for any jj in {i}∪N(i)\{i\}\cup N(i) and hence ∇h(x)i=0\nabla h(x)_{i}=0. If xi≥1−ϵx_{i}\geq 1-\epsilon, then every j∈N(i)j\in N(i) has Ij<0I_{j}<0 and hence by Proposition 5, the only contributions to the ∇h(x)i\nabla h(x)_{i} can be from paths that route from xix_{i} to the output through IiI_{i}. Hence

where both terms are nonnegative and hence so is ∇h(x)i\nabla h(x)_{i}. Finally, if xi≤−1+ϵx_{i}\leq-1+\epsilon, then the only contributions to ∇h(x)i\nabla h(x)_{i} come from paths that route through IjI_{j} for j∈N(i)j\in N(i), hence

where the first term is nonnegative and the second term is always nonpositive. We remark that because we have assumed hh to be differentiable at xx, the chain rule provides correct answers, by Rademacher’s theorem. ∎

For any xx, let I(x)\mathcal{I}(x) be defined as above, I(x):={i    ∣    Ii(x)>0}\mathcal{I}(x):=\{i\;\;|\;\;I_{i}(x)>0\}. Then ∣∣∇h(x)∣∣1≤∣I(x)∣||\nabla h(x)||_{1}\leq|\mathcal{I}(x)| and for every xx. In addition, for every xx, there exists a yy with ∣∣∇h(y)∣∣1≥∣I(x)∣||\nabla h(y)||_{1}\geq|\mathcal{I}(x)|.

where the final inequality follows because ∣∣∇ψ(xi)∣∣1≤1||\nabla\psi(x_{i})||_{1}\leq 1 everywhere it is defined. Combining equations 61 and 63 yields that ∣∣∇h(x)∣∣1≤∣I(x)∣||\nabla h(x)||_{1}\leq|\mathcal{I}(x)|.

On the other hand, suppose I(x)\mathcal{I}(x) is given. Then we can construct yy such that I(y)=I(x)\mathcal{I}(y)=\mathcal{I}(x) and ∣∣∇h(y)∣∣1=∣I(x)∣||\nabla h(y)||_{1}=|\mathcal{I}(x)|. To do this, set yi=1−ϵ2ny_{i}=1-\frac{\epsilon}{2n} if i∈I(x)i\in\mathcal{I}(x) and yi=−1+ϵ2ny_{i}=-1+\frac{\epsilon}{2n} otherwise. Then note that I(x)=I(y)\mathcal{I}(x)=\mathcal{I}(y) and for every i∈I(y)i\in\mathcal{I}(y)

and hence by Claim 2, we can replace the inequalities in equations 61 and 63 we have that

To demonstrate that this is indeed a strict reduction, we need to define functions ff and gg, where ff maps instances of LIS to instances of MAX-GRAD, and gg maps feasible solutions of MAX-GRAD back to LIS. Clearly the construction we have defined above is ff. The function gg can be attained by reading off the indices in I(x)\mathcal{I}(x).

To demonstrate that the size of this construction does not blow up by more than a constant factor, observe that by representing weights as sparse matrices, the number of nonzero weights is a constant factor times the number of edges in GG. Indeed, encoding each ψ\psi in the first layer takes O(1)O(1) parameters for each vertex in GG. Encoding Ii(x)I_{i}(x) requires only O(d(i))O(d(i)) parameters for each ii, and hence 2∣E∣2|E| parameters total. Assuming a RAM model where numbers can be represented by single atomic units, and ϵ\epsilon is chosen to be (n+2)−1(n+2)^{-1}, this is only a constant factor expansion.

The crux of this argument is to demonstrate that OPTMAX-GRAD(f(q))=OPTLIS(q)OPT_{\texttt{MAX-GRAD}}(f(q))=OPT_{\texttt{LIS}}(q). It suffices to show that for every locally independent set LL, there exists an xx such that ∣∣∇h(x)∣∣1≥k||\nabla h(x)||_{1}\geq k, and for every yy, there exists a locally independent set L′L^{\prime} such that ∣L′∣≥∣∣∇h(y)∣∣1|L^{\prime}|\geq||\nabla h(y)||_{1}.

Suppose LL is a consistent collection of locally independent sets, with ∣L∣=k|L|=k. Any consistent collection of locally independent sets equivalently defines a labelling of each vertex of GG, where lil_{i} denotes the label of vertex viv_{i}: li:=+1l_{i}:=+1 if the locally independent set centered at viv_{i} is contained in the collection, and li:=−1l_{i}:=-1 otherwise. Then one can construct an xx such that ∣∣∇h(x)∣∣1≥k||\nabla h(x)||_{1}\geq k. Indeed, for every viv_{i} with label lil_{i}, set xi=li(1−ϵ2n)x_{i}=l_{i}(1-\frac{\epsilon}{2n}). By Claim C.1, under this xx, Ii(x)≥0\mathcal{I}_{i}(x)\geq 0 for every ii such that li=+1l_{i}=+1, Ii(x)>0I_{i}(x)>0. Then ∣I(x)∣=k|\mathcal{I}(x)|=k and by Claim C.3 there exists a yy such that ∣∣∇h(y)∣∣1≥k||\nabla h(y)||_{1}\geq k.

On the other hand, suppose the maximum gradient of hh is kk. Then there exists an xx that attains this and by Claim C.3, ∣I(x)∣≥k|\mathcal{I}(x)|\geq k. By Claim C.1, we have that I(x)\mathcal{I}(x) denotes the centers of a consistent collection of locally independent sets.

The rest of this contsruction is nearly identical to the preceding construction, with the exception being that ∣∣∇h(x)∣∣1||\nabla h(x)||_{1} can be replaced by δh(x)δxn+1\dfrac{\delta h(x)}{\delta x_{n+1}} throughout as an indicator to count the size of I(x)\mathcal{I}(x).

About General Position: Finally we note that this proof is valid even when you do not assume the network be in general position. Observe that the optimal value of the gradient norm is attained at a point in the strict interior of some linear region. Next observe that a network not being in general position may only increase the optimal objective value over what is reported by the Jacobians of the linear regions of ff, but this cannot happen by claim C.3. Thus general position-ness has no bearing on this construction.

As an aside, we note that the strict reduction demonstrates that MAX-GRADdec\texttt{MAX-GRAD}_{dec} is NP-complete, which implies that MIN-LIPdec\texttt{MIN-LIP}_{dec} is CoNP-complete.

Appendix D LipMIP Construction

In this appendix we will describe in detail the necessary steps for LipMIP construction. In particular, we will present how to formulate the gradient norm ∣∣∇#f∣∣∗||\nabla^{\#}f||_{*} for scalar-valued, general position ReLU network ff as a composition of affine, conditional and switch operators. Then we will present the proofs of MIP-encodability of each of these operators. Finally, we will describe how the global upper and lower bounds are obtained using abstract interpretation.

Our aim in this section is to demonstrate how ∣∣∇#f∣∣∗||\nabla^{\#}f||_{*} may be written as a composition of affine, conditional, and switch operators. For completeness, we redefine these operators here:

for some fixed matrix WW and vector bb.

We will often abuse notation, and let conditional and switch operators apply to vectors, where the operator is applied elementwise. Now we recover Lemma 1 from section 5 of the main paper.

Let ff be a scalar-valued general position ReLU network. Then f(x)f(x), ∇#f(x)\nabla^{\#}f(x), ∣∣⋅∣∣1||\cdot||_{1}, and ∣∣⋅∣∣∞||\cdot||_{\infty} may all be written as a composition of affine, conditional and switch operators.

We recall that ff is defined recursively like:

It amounts to demonstrate how Zi(x)Z_{i}(x) may be computed as a composition of affine, conditional and switch operator. Since σ(x)=S(x,C(x))\sigma(x)=S(x,C(x)), one can write, Z1(x)=WiS(x,C(x))+biZ_{1}(x)=W_{i}S(x,C(x))+b_{i}. Letting Λi(x):=C(Zi(x))\Lambda_{i}(x):=C(Z_{i}(x)) and Ai(x):=Wi(x)+biA_{i}(x):=W_{i}(x)+b_{i}, one can write Zi(x)=Ai∘S(Zi(x),Λi(x)))Z_{i}(x)=A_{i}\circ S\left(Z_{i}(x),\Lambda_{i}(x))\right). Since f(x)f(x) is an affine operator applied to Zd(x)Z_{d}(x), f(x)f(x) can certainly be encoded using only affine, switch, and conditional operators.

To demonstrate that ∇f(x)\nabla f(x) may also be written as such a composition, we require the same definition to compute Zi(x)Z_{i}(x) as above. Then by the chain rule, we have that

As the ∇#f(x)\nabla^{\#}f(x) is an affine operator applied to Y1(x)Y_{1}(x), and Yd+1(x)Y_{d+1}(x) is constant, we only need to show that Yi(x)Y_{i}(x) may be written as a composition of affine, conditional, and switch operators. This follows from the fact that

Then letting AiT(x):=WiTxA_{i}^{T}(x):=W_{i}^{T}x we have that Yi(x)=AiT∘(S(Yi+1(x),Λi(x))Y_{i}(x)=A_{i}^{T}\circ(S\left(Y_{i+1}(x),\Lambda_{i}(x)\right). Hence ∇#f(x)\nabla^{\#}f(x) may be encoded as a composition of affine, conditional, and switch operators.

All that is left is to show that ∣∣⋅∣∣1,∣∣⋅∣∣∞||\cdot||_{1},||\cdot||_{\infty} may be encoded likewise. For each of these, we require ∣⋅∣|\cdot| which can equivalently be written ∣x∣=σ(x)+σ(−x)|x|=\sigma(x)+\sigma(-x), and hence ∣x∣=S(x,C(x))+S(−x,C(−x))|x|=S(x,C(x))+S(-x,C(-x)). ∣∣x∣∣1||x||_{1} then is encoded as the sum of the elementwise sum over ∣xi∣|x_{i}|. ∣∣⋅∣∣∞||\cdot||_{\infty} requires the max⁡(… )\max(\dots) operator. To encode this, we see that max⁡(x1,… )=max⁡(x1,max⁡(… ))\max(x_{1},\dots)=\max(x_{1},\max(\dots)) and max⁡(x,y)=x+σ(y−x)=x+S(y−x,C(y−x))\max(x,y)=x+\sigma(y-x)=x+S(y-x,C(y-x)). ∎

D.2 MIP-encodability of Affine, Conditional, Switch:

Here we will explain the MIP-encodability each of the affine, conditional, and switch operators. For completeness, we copy the definition of MIP-encodability:

We say that a function gg is MIP-encodable if, for every mixed-integer polytope MM, the image of MM mapped through gg is itself a mixed-integer polytope.

We now prove Lemma 2 from the main paper:

Let gg be a composition of affine, conditional, and switch operators, where global lower and upper bounds are known for each input to each element of the composition. Then gg is a MIP-encodable function.

It suffices to show that each of the primitive operators are MIP-encodable. This amounts to, for each operator gg, to define a system of linear inequalities Γ(x,x′)\Gamma(x,x^{\prime}) which is satisfied if and only if g(x)=x′g(x)=x^{\prime} (or x′∈g(x)x^{\prime}\in g(x) for set valued gg), provided xx lies in the global lower and upper bounds, x∈[l,u]x\in[l,u].

The affine operator is trivially attainable by letting Γ(x,x′)\Gamma(x,x^{\prime}) be the equality constraint

To encode C(x)C(x) as a system of linear constraints, we introduce the integer variable aa and wish to encode a=C(x)a=C(x), or equivalently, a=1⇔x≥0a=1\Leftrightarrow x\geq 0. We assume that we know values l,ul,u such that l≤x≤ul\leq x\leq u. Then the implication a=1⇒x≥0a=1\Rightarrow x\geq 0 is encoded by the constraint:

Since if x<0x<0, then a=1a=1 yields a contradiction in that 0>x≥(1−1)⋅u=00>x\geq(1-1)\cdot u=0. The implication x≥0⇒a=1x\geq 0\Rightarrow a=1 is encoded by the constraint

Since if x≥0x\geq 0, then a=0a=0 yields a contradiction in that 0≤x≤(0)⋅(1−l)−1=−10\leq x\leq(0)\cdot(1-l)-1=-1. Hence a=1⇔x≥0a=1\Leftrightarrow x\geq 0. We note that if l>0l>0 or u<0u<0, then the value of aa is fixed and can be encoded with one equality constraint.

Encoding S(x,a)S(x,a) as a system of linear inequalities requires the introduction of continuous variable yy. As we assume we know l,ul,u such that l≤x≤ul\leq x\leq u. Denote l^:=min⁡(l,0)\hat{l}:=\min(l,0) and u^:=max⁡(u,0)\hat{u}:=\max(u,0). The system of linear inequalities Γ(a,x,y)\Gamma(a,x,y) is defined as the conjunction of:

We wish to show that y=S(x,a)⇔Γ(a,x,y)y=S(x,a)\Leftrightarrow\Gamma(a,x,y). Suppose that Γ(a,x,y)\Gamma(a,x,y) is satisfied. Then if a=1a=1, xx must equal yy, since it is implied by left-column constraints of equation 73. The right-column constraints are satisfied by assumption. Alternatively, if a=0a=0 then yy must equal : it is implied by the right-column constraints of equation 73. The left columns are satisfied with a=0a=0 and y=1y=1 since l≤x≤ul\leq x\leq u by assumption. On the other hand, suppose y=S(x,a)y=S(x,a). If a=1a=1, then y=xy=x by definition and we have already shown that Γ(1,x,x)\Gamma(1,x,x) satisfied for all x∈[l,u]x\in[l,u]. Similarly, if a=0a=0, then y=0y=0 and we have shown that Γ(0,x,0)\Gamma(0,x,0) is satisfied for all x∈[l,u]x\in[l,u].

Finally we note that if one can guarantee that a=0a=0 or a=1a=1 always, then only the equality constraint y=xy=x or y=0y=0 is needed. ∎

Finally we’ll remark that while the above are valid encodings of affine, conditional and switch operators, encodings with fewer constraints for compositions of these primitives do exist. For example, suppose we instead wish to encode a continuous piecewise linear function with one breakpoint over one variable

Where which requires 12 linear inequalities. Instead we can encode this function using only 4 linear inequalities. Supposing we know l,ul,u such that l≤x≤ul\leq x\leq u, then R(x)R(x) can be encoded by introducing an auxiliary integer variable aa and four constraints. Letting

This formulation admits a more efficient encoding for functions like σ(⋅)\sigma(\cdot), and ∣⋅∣|\cdot|.

D.3 Abstract Interpretations for Bound Propagation

Here we discuss techniques to compute the lower and upper bounds needed for the MIP encoding of affine, conditional and switch operators. We will only need to show that for each of our primitive operators, we can map sound input bounds to sound output bounds.

and γn(H)={x  ∣  l≤x≤u}\gamma^{n}(H)=\{x\;|\;l\leq x\leq u\}. An equivalent parameterization is by vectors c,rc,r such that c=l+u2c=\frac{l+u}{2} and r=u−l2r=\frac{u-l}{2}. We will sometimes use this parameterization when it is convenient.

Similarly, the boolean hyperbox abstract domain Bn\mathcal{B}^{n} represents sets over {0,1}n\{0,1\}^{n}. For each Xb⊆{0,1}n\mathcal{X}_{b}\subseteq\{0,1\}^{n} such that B=α(Xb)B=\alpha(\mathcal{X}_{b}), BB is parameterized by a vector v∈{0,1,?}nv\in\{0,1,?\}^{n} such that

We will now define pushforward operators for each of our primitives.

where ∣W∣|W| is the elementwise absolute value of WW. To see that this is sound, it suffices to show that for every x∈Xx\in\mathcal{X}, ci′−ri′≤A(xi)≤ci′+ri′c^{\prime}_{i}-r^{\prime}_{i}\leq A(x_{i})\leq c^{\prime}_{i}+r^{\prime}_{i}. Fix an x∈Xx\in\mathcal{X} and consider A(x)i=wiTx+biA(x)_{i}=w_{i}^{T}x+b_{i} where wiw_{i} is the ithi^{th} row of WW. Note that x=c+ex=c+e for some vector ee with ∣e∣≤r|e|\leq r elementwise. Then

Soundness follows trivially: for any x∈Xx\in\mathcal{X}, if li>0l_{i}>0, then xi>0x_{i}>0 and C(x)i=1C(x)_{i}=1. If ui<0u_{i}<0, then xi<0x_{i}<0 and C(x)i=0C(x)_{i}=0. Otherwise, vi=?v_{i}=?, which is always a sound approximation as C(x)i∈{0,1}C(x)_{i}\in\{0,1\}.

We make some remarks about the applications of abstract interpretation as a technique for optimization. Recall that, for any set X\mathcal{X} and functions g,fg,f, if Y={f(x)  ∣  x∈X}\mathcal{Y}=\{f(x)\;|\;x\in\mathcal{X}\} we have that

Instead if Z\mathcal{Z} is such that {f(x)  ∣  x∈X}⊆Z\{f(x)\;|\;x\in\mathcal{X}\}\subseteq\mathcal{Z}, then

In particular, suppose ff is a nasty function, but gg has properties that make it amenable to optimization. Optimization frameworks may not be able to solve max⁡x∈Xg(f(x))\max_{x\in\mathcal{X}}g(f(x)). On the other hand, it might be the case that the RHS of equation 88 is solvable. In particular, if gg is concave and Z\mathcal{Z} is a convex set obtained by Z:=γ(f#(α(X)))\mathcal{Z}:=\gamma(f^{\#}(\alpha(\mathcal{X}))), then by soundness we have Z⊃Y\mathcal{Z}\supset\mathcal{Y}. In fact, this is the formal definition of a convex relaxation.

Under this lens, one can use the abstract domains and pushforward operators previously defined to recover FastLip , though the algorithm was not presented using abstract interpretations. Indeed, using the hyperbox and boolean hyperbox domains, over a set X\mathcal{X}, one can recover a hyperbox Z⊇{∇f(x)  ∣  x∈X}\mathcal{Z}\supseteq\{\nabla f(x)\;|\;x\in\mathcal{X}\}. Then we have that

Appendix E Extensions of LipMIP

This section will provide more details regarding how we extend LipMIP to be applicable to vector-valued functions and to other norms. We will present an example of a nonstandard norm by detailing an application towards untargeted classification robustness.

one can substitute Equation 91 into Equation 90 to yield

The plan is to make LipMIP optimize over xx and zz simultaneously and maximize the gradient norm of gz(x)g_{z}(x). To be more explicit, we note that the scalar-valued LipMIP solves::

where we have shown that ∇f(x)\nabla f(x) is MIP-encodable and the supremum over yy can be encoded for ∣∣⋅∣∣1||\cdot||_{1}, ∣∣⋅∣∣∞||\cdot||_{\infty}, because there exist nice closed form representations of ∣∣⋅∣∣1||\cdot||_{1}, ∣∣⋅∣∣∞||\cdot||_{\infty}. The extension, then, only comes from the sup⁡∣∣z∣∣β∗≤1\sup_{||z||_{\beta^{*}}\leq 1} term. We can explicitly define ff as

And the recursion for ∇#gz(x)\nabla^{\#}g_{z}(x) is defined as

Thus we notice the only change occurs in the definition of Yd+1(x)Y_{d+1}(x). In the scalar-valued ff case, Yd+1(x)Y_{d+1}(x) is always the constant vector, cc. In the vector-valued case, we can let Yd+1(x)Y_{d+1}(x) be the output of an affine operator. Thus as long as the dual ball {z  ∣  ∣∣z∣∣β∗}\{z\;|\;||z||_{\beta}^{*}\} is representable as a mixed-integer polytope, we may solve the optimization problem of Equation 92.

In the same setting as Theorem 5, if ∣∣⋅∣∣α||\cdot||_{\alpha} is ∣∣⋅∣∣1||\cdot||_{1} or ∣∣⋅∣∣∞||\cdot||_{\infty}, and ∣∣⋅∣∣β||\cdot||_{\beta} is a linear norm, then LipMIP applied to ff and X\mathcal{X} yields the answer

where the parameters of LipMIP have been adjusted to reflect the norms of interest.

The proof ideas are identical to that for Theorem 5. The only difference is that the norm ∣∣⋅∣∣β||\cdot||_{\beta} has been replaced from ∣⋅∣|\cdot| to an arbitrary linear norm. The argument for correctness in this case is presented in the paragraphs preceding the corollary statement. ∎

E.2 Application to Untargeted Classification Robustness

Indeed, this follows from the definition of the Lipschitz constant as

Then, by the contrapositive of implication 100 , if sign(f(x))≠sign(f(y))\text{sign}(f(x))\neq\text{sign}(f(y)) then ∣f(x)−f(y)∣≥∣f(x)∣|f(x)-f(y)|\geq|f(x)| and for all x,y∈Xx,y\in\mathcal{X},

arriving at the desired contrapositive implication.

In the multiclass classification setting, we introduce the similar lemma.

where we’ve defined fij(x):=(ei−ej)Tf(x)f_{ij}(x):=(e_{i}-e_{j})^{T}f(x).

To see this, suppose F(y)=jF(y)=j for some j≠ij\neq i. Then ∣fij(x)−fij(y)∣≥∣fij(x)∣|f_{ij}(x)-f_{ij}(y)|\geq|f_{ij}(x)|, as by definition fij(x)>0f_{ij}(x)>0 and fij(y)<0f_{ij}(y)<0. Then by the definition of Lipschitz constant :

arriving at the desired contrapositive LHS. We only note that we need to take min⁡\min over all jj so that fij(y)≥0f_{ij}(y)\geq 0 for all jj. ∎

Now we present our main Theorem regarding multiclassification robustness:

Then for x,y∈Xx,y\in\mathcal{X} with F(x)=iF(x)=i,

In addition, if ∣∣⋅∣∣×||\cdot||_{\times} is a linear norm, and ff is in general position, then L(α,×)(f,X)L^{(\alpha,\times)}(f,\mathcal{X}) is computable by LipMIP.

Certainly equation 107 follows directly from Lemma 9 and equation 106. ∎

What remains to be shown is a ∣∣⋅∣∣×||\cdot||_{\times} such that equation 106 holds. To this end, we present a lemma describing convenient formulations for norms:

Nonnegativity and absolute homogeneity are trivial. To see the triangle inequality holds for ∣∣⋅∣∣C||\cdot||_{\mathcal{C}}, we see that, for any x,yx,y,

And point separation follows because C\mathcal{C} contains an open set and if x≠0x\neq 0, then there exists at least one yy in C\mathcal{C} such that ∣yTx∣>0|y^{T}x|>0. ∎

Now we can define our norm ∣∣⋅∣∣×||\cdot||_{\times} that satisfies equation 106:

We note that by Lemma 10 and since E\mathcal{E} contains the positive simplex, E\mathcal{E} contains an open set and hence the cross-norm is certainly a norm. Indeed, because the convex hull of a finite point-set is a polytope, the cross-norm is a linear norm. Further, we note that the polytope E\mathcal{E} has an efficient H-description.

As E\mathcal{E} is the convex hull of eije_{ij} and eie_{i} for all i≠j∈[m]i\neq j\in[m]. Certainly each of these points is feasible in P\mathcal{P}, and since P\mathcal{P} is convex, by the definition of a convex hull, E⊆P\mathcal{E}\subseteq\mathcal{P}. In the other direction, consider some x∈Px\in\mathcal{P}. Decompose xx into x+x^{+}, and −x−-x^{-}, by only considering the positive and negative components of xx. The goal is to write xx as a convex combination of {eij,ei}\{e_{ij},e_{i}\}. Further decompose x+x^{+} into y+,z+y^{+},z^{+} such that x+=y++z+x^{+}=y^{+}+z^{+}, y+≥0y^{+}\geq 0, z+≥0z^{+}\geq 0, and ∑iyi+=∑ixi−\sum_{i}y_{i}^{+}=\sum_{i}x_{i}^{-}. Then we can write yi+−xi−y_{i}^{+}-x_{i}^{-} as a convex combination of eij′se_{ij}^{\prime}s andzi+z_{i}^{+} is a convex combination of ei′se_{i}^{\prime}s and , where we note that 0∈E0\in\mathcal{E} because eije_{ij}, ejie_{ji} are in E\mathcal{E}. ∎

Now we desire to show equation 106 holds for the cross-norm.

For any open set X\mathcal{X}, the Lipschitz constant with respect to the cross norm, ∣∣⋅∣∣×||\cdot||_{\times}, and any norm ∣∣⋅∣∣α||\cdot||_{\alpha}, for x∈Xx\in\mathcal{X} with F(x)=iF(x)=i, then

so it amounts to show that L(α,×)(f,X)≥max⁡jLα(fij,X)L^{(\alpha,\times)}(f,\mathcal{X})\geq\max_{j}L^{\alpha}(f_{ij},\mathcal{X}). By the definition of the Lipschitz constant:

By switching the sup⁡\sup and max⁡\max above, and observing that, for all zz,

Appendix F Experiments

In this section we describe details about the experimental section of the main paper and present additional experimental results.

All experiments were run on a desktop with an Intel Core i7-9700K 3.6 GHz 8-Core Processor and 64GB of RAM. All experiments involving mixed-integer or linear programming were optimized using Gurobi, using two threads maximum .

The main synthetic dataset used in our experiments is generated procedurally with the following parameters:

The procedure is as follows: randomly sample num_points from the unit hypercube in dim dimensions. Points are sampled sequentially, and a sample is replaced if it is within min_separation of another, previously sampled point. Next, num_leaders points are selected uniformly randomly from the set of points and uniformly randomly assigned a label from 1 to num_classes. The remaining points are labeled according to the label of their closest ‘leader’. An example dataset and classifier learned to classify it are presented in Figure 4.

Here we will outline the hyperparameters and computing environment for each estimation technique compared against.

RandomLB: We randomly sample 1000 points in the domain of interest. At each point, we evaluate the appropriate gradient norm that lower-bounds the Lipschitz constant. We report the maximum amongst these sampled gradient norms.

CLEVER: We randomly sample 500 batches of size 1024 each and compute the appropriate gradient norm for each, for a total of 512,000 random gradient norm evaluations. The hyperparameters used to estimate the best-fitting Reverse Weibull distribution are left to their defaults from the CLEVER Github Repository: https://github.com/IBM/CLEVER-Robustness-Score, .

LipMIP: LipMIP is evaluated exactly without any early stopping or timeout parameters, using 2 threads and the Gurobi optimizer.

SeqLip: SeqLip bounds are attained by splitting each network into subproblems, with one subproblem per layer. The ∣∣⋅∣∣2,2||\cdot||_{2,2} norm of the Jacobian of each layer is estimated using the Greedy SeqLip heuristic . We scale the resulting output by a factor of d\sqrt{d}. We remark that a cheap way to make this technique local would be to use interval analysis over a local domain to determine which neurons are fixed to be on or off, and do not include decision variables for these neurons in the optimization step.

FastLip: We use a custom implementation of FastLip that more deeply represents the abstract interpretation view of this technique. As we have noted several times throughout this paper, this is equivalent to the FastLip formulation of Weng et al. .

NaiveUB: This naive upper bound is generated by multiplying the operator norm of each affine layer’s Jacobian matrix and scaling by d\sqrt{d}.

F.2 Experimental Details

Here we present more details about each experiment presented in the main paper.

In the random dataset example, we evaluated 20 randomly generated neural networks with layer sizes $$. Parameters were initialized according to He initialization .

For each experiment, we presented only the results for compute time and standard deviations, as well as mean relative error with respect to the answer returned by LipMIP.

The same setup was used to evaluate the accuracy of various estimators during training. The network that was considered in this case was the one trained only using CrossEntropy loss.

F.3 Additional Experiments

We investigate the effects of changing architecture on Lipschitz estimation techniques. We generate a single synthetic dataset, train networks with varying depth and width, and evaluate each Lipschitz Estimation technique on each network over the 2^{2} domain. The synthetic dataset used is over 2 dimensions, with 300 random points, 10 leaders and 2 classes. Training for both the width and depth series is performed using 200 epochs of Adam with learning rate 0.001 over the CrossEntropy loss, with no regularization.

To investigate the effects of changing width, we train networks with size [2,C,C,C,2][2,C,C,C,2] where CC is the x-axis displayed in Figure 5 (left).

To explore the effects under changing depth, we train networks with size +×C++\times C+, where CC is the x-axis displayed in Figure 5 (right). Note that the yy-axis is a log-scale: indicating that estimated Lipschitz constants rise exponentially with depth.

In section 7 of the main paper, we described two relaxed forms of LipMIP: one that leverages early stopping of mixed-integer programs that can be terminated at a desired integrality gap, and one that is a linear-programming relaxation of LipMIP. Here we present results regarding the accuracy vs. efficiency tradeoff for these techniques. We evaluate LipMIP with integrality gaps of at most {100%,10%,1%,0%}\{100\%,10\%,1\%,0\%\} and LipLP over the unit hypercube on the same random networks and synthetic datasets used to generate the data in Table 2. These results are displayed in Table 4.

where we evaluate this naively (Naive), or with the search space of all eije_{ij} encoded directly with mixed-integer-programming (MIPCrossLip(i)). We also evaluate the ∣∣⋅∣∣×(i)||\cdot||_{\times(i)} norm in lieu of ∣∣⋅∣∣β||\cdot||_{\beta}, where ∣∣⋅∣∣×(i)||\cdot||_{\times(i)} is defined as

where we denote this technique (CrossLip(i)). Times and returned Lipschitz values are displayed in Table 5.