E VALUATING THE R OBUSTNESS OF N EURAL N ETWORKS : A N E XTREME V ALUE T HEORY A
PPROACH
Anonymous authors
Paper under double-blind review
A BSTRACT
The robustness of neural networks to adversarial examples has received great attention due to security implications.
Despite various attack approaches to crafting visually imperceptible adversarial examples, little has been developed towards a comprehensive measure of robustness.
In this paper, we provide a theoretical justiﬁcation for converting robustness analysis into a local Lipschitz constant estimation problem, and propose to use the Extreme Value Theory for efﬁcient evaluation.
Our analysis yields a novel robustness metric called CLEVER, which is short for C ross L ipschitz E xtreme V alue for n E twork R obustness.
The proposed CLEVER score is attack-agnostic and computationally feasible for large neural networks.
Experimental results on various networks, including ResNet, Inceptionv3 and MobileNet, show that (i) CLEVER is aligned with the robustness indication measured by the (cid:96) 2 and (cid:96) ∞ norms of adversarial examples from powerful attacks, and (ii) defended networks using defensive distillation or bounded ReLU indeed achieve better CLEVER scores.
To the best of our knowledge, CLEVER is the ﬁrst attack-independent robustness metric that can be applied to any neural network classiﬁer.
I NTRODUCTION
Recent studies have highlighted the lack of robustness in state-of-the-art neural network models, e.g., a visually imperceptible adversarial image can be easily crafted to mislead a well-trained network (Szegedy et al., 2013; Goodfellow et al., 2015; Chen et al., 2017a).
Even worse, researchers have identiﬁed that these adversarial examples are not only valid in the digital space but also plausible in the physical world (Kurakin et al., 2016a; Evtimov et al., 2017).
The vulnerability to adversarial examples calls into question safety-critical applications and services deployed by neural networks, including autonomous driving systems and malware detection protocols, among others.
In the literature, studying adversarial examples of neural networks has twofold purposes: (i) security implications : devising effective attack algorithms for crafting adversarial examples, and (ii) robustness analysis : evaluating the intrinsic model robustness to adversarial perturbations to normal examples.
Although in principle the means of tackling these two problems are expected to be independent, that is, the evaluation of a neural network’s intrinsic robustness should be agnostic to attack methods, and vice versa, existing approaches extensively use different attack results as a measure of robustness of a target neural network.
Speciﬁcally, given a set of normal examples, the attack success rate and distortion of the corresponding adversarial examples crafted from a particular attack algorithm are treated as robustness metrics.
Consequently, the network robustness is entangled with the attack algorithms used for evaluation and the analysis is limited by the attack capabilities.
More importantly, the dependency between robustness evaluation and attack approaches can cause biased analysis.
For example, adversarial training is a commonly used technique for improving the robustness of a neural network, accomplished by generating adversarial examples and retraining the network with corrected labels.
However, while such an adversarially trained network is made robust to attacks used to craft adversarial examples for training, it can still be vulnerable to unseen attacks.
Motivated by the evaluation criterion for assessing the quality of text and image generation that is completely independent of the underlying generative processes, such as the BLEU score for texts (Papineni et al., 2002) and the INCEPTION score for images (Salimans et al., 2016), we aim to propose a comprehensive and attack-agnostic robustness metric for neural networks.
Stemming from a perturbation analysis of an arbitrary neural network classiﬁer, we derive a universal lower bound on the minimal distortion required to craft an adversarial example from an original one, where the lower bound applies to any attack algorithm and any (cid:96) p norm for p ≥ 1 .
We show that this lower bound associates with the maximum norm of the local gradients with respect to the original example, and therefore robustness evaluation becomes a local Lipschitz constant estimation problem.
To efﬁciently and reliably estimate the local Lipschitz constant, we propose to use extreme value theory (De Haan & Ferreira, 2007) for robustness evaluation.
In this context, the extreme value corresponds to the local Lipschitz constant of our interest, which can be inferred by a set of independently and identically sampled local gradients.
With the aid of extreme value theory, we propose a robustness metric called CLEVER, which is short for C ross L ipschitz E xtreme V alue for n E twork R obustness.
We note that CLEVER is an attack-independent robustness metric that applies to any neural network classiﬁer.
In contrast, the robustness metric proposed in Hein & Andriushchenko (2017), albeit attack-agnostic, only applies to a neural network classiﬁer with one hidden layer.
We highlight the main contributions of this paper as follows:
• We propose a novel robustness metric called CLEVER, which is short for C ross L ipschitz E xtreme V alue for n E twork R obustness.
To the best of our knowledge, CLEVER is the ﬁrst robustness metric that is attack-independent and can be applied to any arbitrary neural network classiﬁer and scales to large networks for ImageNet.
• The proposed CLEVER score is well supported by our theoretical analysis on formal robustness guarantees and the use of extreme value theory.
Our robustness analysis extends the results in Hein & Andriushchenko (2017) from continuously differentiable functions to a special class of non-differentiable functions – neural+ networks with ReLU activations.
• We corroborate the effectiveness of CLEVER by conducting experiments on state-of-theart models
for ImageNet, including ResNet (He et al., 2016), Inception-v3 (Szegedy et al., 2016) and MobileNet (Howard et al., 2017).
We also use CLEVER to investigate defended networks against adversarial examples, including the use of defensive distillation (Papernot et al., 2016) and bounded ReLU (Zantedeschi et al., 2017).
Experimental results show that our CLEVER score well aligns with the attack-speciﬁc robustness indicated by the (cid:96) 2 and (cid:96)
∞ distortions of adversarial examples.
B ACKGROUND AND R ELATED WORK 2. A TTACKING N EURAL N ETWORKS USING A DVERSARIAL E XAMPLES
One of the most popular formulations found in literature for crafting adversarial examples to mislead a neural network is to formulate it as a minimization problem, where the variable δ ∈ R d to be optimized refers to the perturbation to the original example, and the objective function takes into account unsuccessful adversarial perturbations as well as a speciﬁc norm on δ for assuring similarity.
For instance, the success of adversarial examples can be evaluated by their cross-entropy loss (Szegedy et al., 2013; Goodfellow et al., 2015) or model prediction (Carlini & Wagner, 2017b).
The norm constraint on δ can be implemented in a clipping manner (Kurakin et al., 2016b) or treated as a penalty function (Carlini & Wagner, 2017b).
The (cid:96) p norm of δ , deﬁned as (cid:107) δ (cid:107) p =
( (cid:80) di =1 | δ i | p ) 1 /p for any p ≥ 1 , is often used for crafting adversarial examples.
In particular, when p = ∞ , (cid:107) δ (cid:107) ∞ = max i ∈{ 1 ,...,d } | δ i | measures the maximal variation among all dimensions in δ .
When p = 2 , (cid:107) δ (cid:107) 2 becomes the Euclidean norm of δ .
When p = 1 , (cid:107) δ (cid:107)
= (cid:80) pi =
1 | δ i | measures the total variation of δ .
The state-of-the-art attack methods for (cid:96) ∞ , (cid:96) 2 and (cid:96) 1 norms are the iterative fast gradient sign method (I-FGSM)
(Goodfellow et al., 2015; Kurakin et al., 2016b), Carlini and
Wagner’s attack (CW attack) (Carlini & Wagner, 2017b), and elastic-net attacks to deep neural networks (EAD) (Chen et al., 2017b), respectively.
These attacks fall into the category of white-box attacks since the network model is assumed to be transparent to an attacker.
Adversarial examples can also be crafted from a black-box network model using an ensemble approach (Liu et al., 2016), training a substitute model (Papernot et al., 2017), or employing zeroth-order optimization based attacks (Chen et al., 2017c).
2. E XISTING D EFENSE M ETHODS
Since the discovery of vulnerability to adversarial examples (Szegedy et al., 2013), various defense methods have been proposed to improve the robustness of neural networks.
The rationale for defense is to make a neural network more resilient to adversarial perturbations, while ensuring the resulting defended model still attains similar test accuracy as the original undefended network.
Papernot et al.
proposed defensive distillation (Papernot et al., 2016), which uses the distillation technique (Hinton et al., 2015) and a modiﬁed softmax function at the ﬁnal layer to retrain the network parameters with the prediction probabilities (i.e., soft labels) from the original network.
Zantedeschi et al.
(2017) showed that by changing the ReLU function to a bounded ReLU function, a neural network can be made more resilient.
Another popular defense approach is adversarial training , which generates and augments adversarial examples with the original training data during the network training stage.
On
MNIST, the adversarially trained model proposed by Madry et al.
(2017) can successfully defend a majority of adversarial examples at the price of increased network capacity.
Model ensemble has also been discussed to increase the robustness to adversarial examples (Tram`er et al., 2017; Liu et al., 2017). In addition, detection methods such as feature squeezing (Xu et al., 2017) and example reforming (Meng & Chen, 2017) can also be used to identify adversarial examples.
However, the CW attack is shown to be able to bypass 10 different detection methods (Carlini & Wagner, 2017a).
In this paper, we focus on evaluating the intrinsic robustness of a neural network model to adversarial examples.
The effect of detection methods is beyond our scope.
2. T HEORETICAL R OBUSTNESS G UARANTEES FOR N EURAL N ETWORKS
Szegedy et al.
(2013) compute global Lipschitz constant for each layer and use their product to explain the robustness issue in neural networks, but the global Lipschitz constant often gives a very loose bound.
Hein & Andriushchenko (2017) gave a robustness lower bound using a local Lipschitz continuous condition and derived a closed-form bound for a multi-layer perceptron (MLP) with a single hidden layer and softplus activation.
Nevertheless, a closed-form bound is hard to derive for a neural network with more than one hidden layer.
Wang et al.
(2016) utilized terminologies from topology to study robustness.
However, no robustness bounds or estimates were provided for neural networks.
On the other hand, works done by Ehlers (2017); Katz et al.
(2017a;b);
Huang et al.
(2017) focus on formally verifying the viability of certain properties in neural networks for any possible input, and transform this formal veriﬁcation problem into satisﬁability modulo theory (SMT) and large-scale linear programming (LP) problems.
These SMT or LP based approaches have high computational complexity and are only plausible for very small networks.
Intuitively, we can use the distortion of adversarial examples found by a certain attack algorithm as a robustness metric.
For example, Bastani et al.
(2016) proposed a linear programming (LP) formulation to ﬁnd adversarial examples and use the distortions as the robustness metric.
They observe that the LP formulation can ﬁnd adversarial examples with smaller distortions than other gradient-based attacks like L-BFGS (Szegedy et al., 2013).
However, the distortion found by these algorithms is an upper bound of the true minimum distortion and depends on speciﬁc attack algorithms.
These methods differ from our proposed robustness measure CLEVER, because CLEVER is an estimation of the lower bound of the minimum distortion and is independent of attack algorithms.
Additionally, unlike LP-based approaches which are impractical for large networks, CLEVER is computationally feasible for large networks like Inception-v3.
The concept of minimum distortion and upper/lower bound will be formally deﬁned in Section 3.
A NALYSIS OF F ORMAL R OBUSTNESS G UARANTEES FOR A C LASSIFIER
In this section, we provide formal robustness guarantees of a classiﬁer in Theorem 3.2.
Our robustness guarantees are general since they only require a mild assumption on Lipschitz continuity of the classiﬁcation function.
For differentiable classiﬁcation functions, our results are consistent with the main theorem in (Hein & Andriushchenko, 2017) but are obtained by a much simpler and more intuitive manner 1 .
Furthermore, our robustness analysis can be easily extended to non-differentiable classiﬁcation functions (e.g. neural networks with ReLU) as in Lemma 3.3, whereas the analysis in Hein & Andriushchenko (2017) is restricted to differentiable functions.
Speciﬁcally, Corollary 3.2.1 shows that the robustness analysis in (Hein & Andriushchenko, 2017) is in fact a special case
[Table]
of our analysis.
We start our analysis by deﬁning the notion of adversarial examples, minimum (cid:96) p distortions, and lower/upper bounds.
All the notations are summarized in Table 1.
Deﬁnition 3.1 (perturbed example and adversarial example) .
Let x 0 ∈ R
d be an input vector of a K -class classiﬁcation function f : R d → R K and the prediction is given as c ( x 0 )
=
argmax 1 ≤ i ≤ K f i ( x 0 ) .
Given x 0 , we say x a is a perturbed example of x 0 with noise δ ∈ R d and (cid:96) p -distortion ∆ p if x a = x 0 + δ and ∆ p = (cid:107) δ (cid:107) p .
An adversarial example is a perturbed example x a that changes c ( x 0 ) .
A successful untargeted attack is to ﬁnd a x a such that c ( x a ) (cid:54) =
c ( x 0 ) while a successful targeted attack is to ﬁnd a x a such that c ( x a ) =
t given a target class t (cid:54) =
c ( x 0 ) .
Deﬁnition 3.2 (minimum adversarial distortion ∆ p, min ) .
Given an input vector x 0 of a classiﬁer f , the minimum (cid:96) p adversarial distortion of x 0 , denoted as ∆ p, min , is deﬁned as the smallest ∆ p over all adversarial examples of x 0 .
Deﬁnition 3.3 (lower bound of ∆ p, min ) .
Suppose ∆ p, min is the minimum adversarial distortion of x 0 .
A lower bound of ∆ p, min , denoted by β L where β L ≤ ∆ p, min , is deﬁned such that any perturbed examples of x 0 with (cid:107) δ (cid:107) p ≤ β L are not adversarial examples.
Deﬁnition 3.4 (upper bound of ∆ p, min ) .
Suppose ∆ p, min is the minimum adversarial distortion of x 0 .
An upper bound of ∆ p, min , denoted by β U where β U ≥ ∆ p, min , is deﬁned such that there exists an adversarial example of x 0 with (cid:107) δ (cid:107) p ≥ β U .
The lower and upper bounds are instance-speciﬁc because they depend on the input x 0 .
While β U can be easily given by ﬁnding an adversarial example of x 0 using any attack method, β L is not easy to ﬁnd.
β L guarantees that the classiﬁer is robust to any perturbations with (cid:107) δ (cid:107) p ≤ β L , certifying the robustness of the classiﬁer.
Below we show how to derive a formal robustness guarantee of a classiﬁer with Lipschitz continuity assumption.
Speciﬁcally, our analysis obtains a lower bound of (cid:96) p minimum adversarial distortion β L = min j (cid:54) =
c f c ( x 0 ) − f j ( x 0 ) L jq .
Lemma 3.1 (Lipschitz continuity and its relationship with gradient norm (Paulavi ˇ cius & ˇZilinskas, 2006)) .
Let S ⊂ R d be a convex bounded closed set and let h ( x ) :
S → R be a continuously differentiable function on an open set containing S .
Then, h ( x ) is a Lipschitz function with Lipschitz constant L q if the following inequality holds for any x , y ∈ S :
[Equation]
where L q = max {(cid:107)∇ h ( x ) (cid:107) q : x ∈ S } , ∇ h ( x ) = ( ∂h ( x ) ∂x 1 , · · · , ∂h ( x ) ∂x d ) (cid:62) is the gradient of h ( x ) , and 1 p + 1 q = 1 , 1 ≤ p, q ≤ ∞ .
Given Lemma 3.1, we then provide a formal guarantee to the lower bound β L .
Theorem 3.2 (Formal guarantee on lower bound β L for untargeted attack) .
Let x 0 ∈ R d and f : R d → R K be a multi-class classiﬁer with continuously differentiable components
f i and let c =
[Equation]
1 ≤ i ≤ K f i
[Equation]
x 0 ) be the class which f predicts for x 0 .
For all δ ∈ R d with
[Equation]
argmax 1 ≤ i ≤ K f i ( x 0 + δ ) =
c holds with 1 p + 1 q = 1 , 1 ≤ p, q ≤ ∞ and L jq is the Lipschitz constant for the function f c ( x ) − f j ( x ) in (cid:96) p norm.
In other words, β L = min j (cid:54) =
c f c ( x 0 ) − f j ( x 0 )
L jq is a lower bound of minimum distortion.
The intuitions behind Theorem 3.2 is shown in
Figure 1 with an one-dimensional example.
The function value g ( x ) =
f c ( x ) − f j ( x ) near point x 0 is inside a double cone formed by two lines passing ( x 0 , g ( x 0 )) and with slopes equal to ±
L q , where L q is the (local) Lipschitz constant of g ( x ) near x 0 .
In other words, the function value of g ( x ) around x 0 , i.e. g ( x 0 + δ ) can be bounded by g ( x 0 ) , δ and the Lipschitz constant L q .
When g ( x 0 + δ ) is decreased to 0, an adversarial example is found and the minimal change of δ is g ( x 0 )
L q .
The complete proof is deferred to Appendix A.
Remark 1.
L jq is the Lipschitz constant of the function involving cross terms: f c ( x ) − f j ( x ) , hence we also call it cross Lipschitz constant following (Hein & Andriushchenko, 2017).
To distinguish our analysis from (Hein & Andriushchenko, 2017), we show in Corollary 3.2.1 that we can obtain the same result in (Hein & Andriushchenko, 2017) by Theorem 3.2.
In fact, the analysis in (Hein & Andriushchenko, 2017) is a special case of our analysis because the authors implicitly assume Lipschitz continuity on f i ( x ) when requiring f i ( x ) to be continuously differentiable.
They use local Lipschitz constant ( L q,x 0 ) instead of global Lipschitz constant ( L q ) to obtain a tighter bound in the adversarial perturbation δ .
Corollary 3.2.1 (Formal guarantee on β L for untargeted attack) .
2 Let L jq,x 0 be local Lipschitz constant of function f c ( x ) − f j
( x ) at x 0 over some ﬁxed ball B p ( x 0 , R ) :
= { x ∈ R d |
[Equation]
x − x 0 (cid:107) p ≤ R } and let δ ∈ B p ( 0 , R ) .
By Theorem 3.2, we obtain the bound in (Hein & Andriushchenko, 2017):
[Equation]
An important use case of Theorem 3.2 and Corollary 3.2.1 is the bound for targeted attack:
Corollary 3.2.2 (Formal guarantee on β L for targeted attack) .
Assume the same notation as in Theorem 3.2 and Corollary 3.2.1.
For a speciﬁed target class j , we have (cid:107) δ (cid:107) p ≤ min (cid:8) f c ( x 0 ) − f j ( x 0 ) L jq,x , R (cid:9) .
In addition, we further extend Theorem 3.2 to a special case of non-differentiable functions – neural networks with ReLU activations. In this case the Lipchitz constant used in Lemma 3.1 can be replaced by the maximum norm of directional derivative, and our analysis above will go through.
Lemma 3.3 (Formal guarantee on β L for ReLU networks) .
3 Let h ( · ) be a l -layer ReLU neural network with W i as the weights for layer i .
We ignore bias terms as they don’t contribute to gradient.
[Equation]
where σ ( u ) = max(0 , u ) .
Let S ⊂ R d be a convex bounded closed set, then equation (1) holds with L q = sup x ∈ S {| sup (cid:107) d (cid:107) p =1 D + h ( x ; d ) |} where D + h ( x ; d ) :=
lim t → 0 + h ( x + t d ) − h ( x ) t is the one-sided directional direvative, then Theorem 3.2, Corollary 3.2.1 and Corollary 3.2.2 still hold.
T HE CLEVER R OBUSTNESS M ETRIC VIA E XTREME V ALUE T HEORY
In this section, we provide an algorithm to compute the robustness metric CLEVER with the aid of extreme value theory, where CLEVER can be viewed as an efﬁcient estimator of the lower bound β L and is the ﬁrst attack-agnostic score that applies to any neural network classiﬁers.
Recall in Sectionwe show that the lower bound of network robustness is associated with g ( x 0 ) and its cross Lipschitz constant L jq,x 0 , where g ( x 0 ) =
f c ( x 0 ) − f j ( x 0 ) is readily available at the output of a classiﬁer and
L jq,x 0 is deﬁned as max x ∈ B p ( x 0 ,R ) (cid:107)∇ g ( x ) (cid:107) q .
Although ∇ g ( x ) can be calculated easily via back propagation, computing L jq,x 0 is more involved because it requires to obtain the maximum value of (cid:107)∇ g ( x ) (cid:107) q in a ball.
Exhaustive search on low dimensional x in B p ( x 0 , R ) seems already infeasible, not to mention the image classiﬁers with large feature dimensions of our interest.
For instance, the feature dimension d = 784 , 3072 , 150528 for MNIST, CIFAR and ImageNet respectively.
One approach to compute L jq,x 0 is through sampling a set of points x ( i ) in a ball B p ( x 0 , R ) around x 0 and taking the maximum value of (cid:107)∇ g ( x ( i ) )
(cid:107) q .
However, a signiﬁcant amount of samples might be needed to obtain a good estimate of max (cid:107)∇ g ( x ) (cid:107) q
and it is unknown how good the estimate is compared to the true maximum.
Fortunately, Extreme Value Theory ensures that the maximum value of random variables can only follow one of the three extreme value distributions, which is useful to estimate max (cid:107)∇ g ( x ) (cid:107) q with only a tractable number of samples.
It is worth noting that although Wood & Zhang (1996) also applied extreme value theory to estimate the Lipschitz constant. However, there are two main differences between their work and this paper.
First of all, the sampling methodology is entirely different.
Wood & Zhang (1996) calculates the slopes between pairs of sample points whereas we directly take samples on the norm of gradient as in Lemma 3.1.
Secondly, the functions considered in Wood & Zhang (1996) are only one-dimensional as opposed to the high-dimensional classiﬁcation functions considered in this paper.
For comparison, we show in our experiment that the approach in Wood & Zhang (1996), denoted as SLOPE in
Table 3 and Figure 4, perform poorly for high-dimensional classiﬁers such as deep neural networks.
4. E STIMATE L jq,x 0 VIA E XTREME V ALUE T HEORY
When sampling a point x uniformly in B p ( x 0 , R ) , (cid:107)∇ g ( x ) (cid:107) q can be viewed as a random variable characterized by a cumulative distribution function (CDF).
For the purpose of illustration, we derived the CDF for a 2-layer neural network in Theorem D.1.
For any neural networks, suppose we have n samples {(cid:107)∇ g ( x ( i ) )
(cid:107) q } , and denote them as a sequence of independent and identically distributed (iid) random variables Y 1 , Y 2 , · · · , Y n , each with CDF F Y ( y ) .
The CDF of max { Y 1 , · · · , Y n } , denoted as F nY ( y ) , is called the limit distribution of F Y ( y ) .
Fisher-Tippett- Gnedenko theorem says that F nY ( y ) , if exists, can only be one of the three family of extreme value distributions – the Gumbel class,
the Fr ´ echet class and the reverse Weibull class.
Theorem 4.1 (Fisher-Tippett-Gnedenko Theorem) .
If there exists a sequence of pairs of real numbers ( a n , b n ) such that a n > 0 and lim n →∞ F nY ( a n y + b n ) =
G ( y ) , where G is a non-degenerate distribution function, then G belongs to either the Gumbel class (Type I), the Fr´echet class (Type II) or the Reverse Weibull class (Type III) with their CDFs as follows: [Equation] Reverse Weibull class (Type III): G (
[Equation]
a W , where a W ∈ R , b W > 0 and c W > 0 are the location, scale and shape parameters, respectively.
Theorem 4.1 implies that the maximum values of the samples follow one of the three families of distributions.
If g ( x ) has a bounded Lipschitz constant, (cid:107)∇ g ( x ( i ) )
(cid:107) q is also bounded, thus its limit distribution must have a ﬁnite right end-point.
We are particularly interested in the reverse Weibull class, as its CDF has a ﬁnite right end-point (denoted as a W ).
The right end-point reveals the upper limit of the distribution, known as the extreme value .
The extreme value is exactly the unknown local cross Lipschitz constant L jq, x 0 we would like to estimate in this paper.
To estimate L jq, x 0 , we ﬁrst generate N s samples of x ( i ) over a ﬁxed ball B p ( x 0 , R ) uniformly and independently in each batch with a total of N b batches.
We then compute (cid:107)∇ g ( x ( i ) )
(cid:107) q and store the maximum values of each batch in set S .
Next, with samples in S , we perform a maximum likelihood estimation of reverse Weibull distribution parameters, and the location estimate ˆ a W is used as an estimate of L j q, x 0 .
4. C OMPUTE CLEVER: A ROBUSTNESS SCORE OF NEURAL NETWORK CLASSIFIERS
Given an instance x 0 , its classiﬁer f ( x 0 ) and a target class j , a targeted CLEVER score of the classiﬁer’s robustness can be computed via g ( x 0 ) and L jq,x 0 .
Similarly, untargeted CLEVER scores can be computed.
With the proposed procedure of estimating L jq,x 0 described in Section 4.1, we summarize the ﬂow of computing CLEVER score for both targeted attacks and un-targeted attacks in Algorithm 1 and 2, respectively.
Algorithm
Input: a K -class classiﬁer f ( x ) , data example x 0 with predicted class c , target class j , batch size
N b , number of samples per batch N s , perturbation norm p , maximum perturbation R
Result: CLEVER Score µ ∈ R + for target class j 1 S ← {∅} , g ( x ) ← f c ( x ) − f j ( x ) , q ← pp − 1 .
2 for i ← 1 to N b do for k ← 1 to N s do randomly select a point x
( i,k ) ∈
B p ( x 0 , R ) compute
b ik ← (cid:107)∇ g ( x ( i,k ) )
(cid:107) q via back propagation end
S ← S ∪ { max k { b ik }} 8 end 9 ˆ a W ← MLE of location parameter of reverse Weibull distribution on S 10 µ ← min( g ( x 0 ) ˆ a , R )
Input: Same as Algorithm 1, but without a target class j
Result: CLEVER score ν ∈ R + for un-targeted attack 1 for j ← 1 to K , j (cid:54) =
c do µ j ← CLEVER-t ( f, x 0 , c, j, N b , N s , p, R ) 3 end 4 ν ← min j { µ j }
E XPERIMENTAL R ESULTS 5. N ETWORKS AND P ARAMETER S ETUP
We conduct experiments on CIFAR-10 (CIFAR for short), MNIST, and ImageNet data sets.
For the former two smaller datasets CIFAR and MNIST, we evaluate CLEVER scores on four relatively small networks: a single hidden layer MLP with softplus activation (with the same number of hidden units as in (Hein & Andriushchenko, 2017)), a 7-layer AlexNet-like CNN (with the same structure as in (Carlini & Wagner, 2017b)), and the 7-layer CNN with defensive distillation (Papernot et al., 2016) (DD) and bounded ReLU (Zantedeschi et al., 2017) (BReLU) defense techniques employed.
For ImageNet data set, we use three popular deep network architectures: a 50-layer Residual Network (He et al., 2016) (ResNet-50), Inception-v3 (Szegedy et al., 2016) and MobileNet (Howard et al., 2017).
They were chosen for the following reasons: (i) they all yield (close to) state-of-theart performance among equal-sized networks; and (ii) their architectures are signiﬁcantly different with unique building blocks, i.e., residual block in ResNet, inception module in Inception net, and depthwise separable convolution in MobileNet.
Therefore, their diversity in network architectures is appropriate to test our robustness metric.
For MobileNet, we set the width multiplier to 1.0, achieving a 70 .
6% accuracy on ImageNet.
We used public pretrained weights for all ImageNet models 5 .
In all our experiments, we set the sampling parameters
N b = 500 , N s = 1024 and R = 5 .
For targeted attacks, we use 500 test-set images for CIFAR and MNIST and use 100 test-set images for
ImageNet; for each image, we evaluate its targeted CLEVER score for three targets: a random target class, a least likely class (the class with lowest probability when predicting the original example), and the top-2 class (the class with largest probability except for the true class, which is usually the easiest target to attack).
We also conduct untargeted attacks on MNIST and CIFAR for 100 test-set images, and evaluate their untargeted CLEVER scores.
5. F ITTING G RADIENT N ORM SAMPLES WITH R EVERSE W EIBULL DISTRIBUTIONS
We ﬁt the cross Lipschitz constant samples in S (see Algorithm 1) with reverse Weibull class distribution to obtain the maximum likelihood estimate of the location parameter ˆ a W , scale parameter ˆ b W and shape parameter ˆ c W , as introduced in Theorem 4.1.
To validate that reverse Weibull distribution is a good ﬁt to the empirical distribution of the cross Lipschitz constant samples, we conduct
Kolmogorov-Smirnov goodness-of-ﬁt test (a.k.a.
K-S test) to calculate the K-S test statistics D and corresponding p -values.
The null hypothesis is that samples S follow a reverse Weibull distribution.
Figure 2 plots the probability distribution function of the cross Lipschitz constant samples and the ﬁtted Reverse Weibull distribution for images from various data sets and network architectures.
The estimated MLE parameters, p -values, and the K-S test statistics D are also shown.
We also calculate the percentage of examples whose estimation have p -values greater than 0.05, as illustrated in Figure 3.
If the p -value is greater than 0.05, the null hypothesis cannot be rejected, meaning that the underlying data samples ﬁt a reverse Weibull distribution well.
Figure 3 shows that all numbers are close to 100%, validating the use of reverse Weibull distribution as an underlying distribution of gradient norm samples empirically.
Therefore, the ﬁtted location parameter of reverse Weibull distribution (i.e., the extreme value), ˆ a W , can be used as a good estimation of local cross Lipschitz constant to calculate the CLEVER score.
The exact numbers are shown in Table 5 in Appendix E.
[Figure]
D -statistics of K-S test and p-values are denoted as ks and pval .
With small ks and high p-value, the hypothesized reverse Weibull distribution ﬁts the empirical distribution of cross Lipschitz constant samples well.
[Figure]
5. C OMPARING CLEVER S CORE WITH A TTACK - SPECIFIC N ETWORK R OBUSTNESS
We apply the state-of-the-art white-box attack methods, iterative fast gradient sign method (IFGSM)
(Goodfellow et al., 2015; Kurakin et al., 2016b) and Carlini and Wagner’s attack (CW) (Carlini & Wagner, 2017b), to ﬁnd adversarial examples for 11 networks, including 4 networks trained on CIFAR, 4 networks trained on MNIST, and 3 networks trained on ImageNet.
For
CW attack, we run 1000 iterations for ImageNet and CIFAR, and 2000 iterations for MNIST, as MNIST has shown to be more difﬁcult to attack (Chen et al., 2017b).
Attack learning rate is individually tuned for each model: 0.001 for Inception-v3 and ResNet-50, 0.0005 for MobileNet and 0.01 for all other networks.
For I-FGSM, we run 50 iterations and choose the optimal (cid:15) ∈ { 0 . 01 , 0 . 025 , 0 . 05 , 0 . 1 , 0 . 3 , 0 . 5 , 0 . 8 , 1 . 0 } to achieve the smallest (cid:96) ∞ distortion for each individual image.
For defensively distilled (DD) networks, 50 iterations of I-FGSM are not sufﬁcient; we use 250 iterations for CIFAR-DD and 500 iterations for MNIST-DD to achieve a 100% success rate.
For the problem to be non-trivial, images that are classiﬁed incorrectly are skipped.
We report 100% attack success rates for all the networks, and thus the average distortion of adversarial examples can indicate the attack-speciﬁc robustness of each network.
For comparison, we compute the CLEVER scores for the same set of images and attack targets.
To the best of our knowledge, CLEVER is the ﬁrst attack-independent robustness score that is capable of handling the large networks studied in this paper, so we directly compare it with the attack-induced distortion metrics in our study.
We evaluate the effectiveness of our CLEVER score by comparing the upper bound β U (found by attacks) and CLEVER score, where CLEVER serves as an estimated lower bound, β L .
Tablecompares the average (cid:96) 2 and (cid:96) ∞ distortions of adversarial examples found by targeted CW and I-FGSM attacks and the corresponding average targeted CLEVER scores for (cid:96) 2 and (cid:96) ∞ norms, and Figure 4 visualizes the results for (cid:96) ∞ norm.
Similarly, Table 2 compares untargeted CW and I-FGSM attacks with untargeted CLEVER scores.
As expected, CLEVER is smaller than the distortions of adversarial images in most cases.
More importantly, since CLEVER is independent of attack algorithms, the reported CLEVER scores can roughly indicate the distortion of the best possible attack in terms of a speciﬁc (cid:96) p distortion.
The average (cid:96) 2 distortion found by CW attack is close to the (cid:96) 2 CLEVER score, indicating CW is a strong (cid:96) 2 attack.
In addition, when a defense mechanism (Defensive Distillation or Bounded ReLU) is used, the corresponding CLEVER scores are consistently increased (except for CIFAR-BReLU), indicating that the network is indeed made more resilient to adversarial perturbations.
For CIFAR-BReLU, both CLEVER scores and (cid:96) p norm of adversarial examples found by CW attack decrease, implying that bound ReLU is an ineffective defense for CIFAR.
CLEVER scores can be seen as a security checkpoint for unseen attacks.
For example, if there is a substantial gap in distortion between the CLEVER score and the considered attack algorithms, it may suggest the existence of a more effective attack that can close the gap.
Since CLEVER score is derived from an estimation of the robustness lower bound, we further verify the viability of CLEVER per each example, i.e., whether it is usually smaller than the upper bound found by attacks.
Table 4 shows the percentage of inaccurate estimations where the CLEVER score is larger than the distortion of adversarial examples found by CW and I-FGSM attacks in three
ImageNet networks.
We found that CLEVER score provides an accurate estimation for most of the examples.
For MobileNet and Resnet-50, our CLEVER score is a strict lower bound of these two attacks for more than 96% of tested examples.
For Inception-v3, the condition of strict lower bound is worse (still more than 75%), but we found that in these cases the attack distortion only differs from our CLEVER score by a fairly small amount.
In Figure 5 we show the empirical CDF of the gap between CLEVER score and the (cid:96) 2 norm of adversarial distortion generated by CW attack for the same set of images in Table 4.
In Figure 6, we plot the (cid:96) 2 distortion and CLEVER scores for each individual image.
A positive gap indicates that CLEVER (estimated lower bound) is indeed less than the upper bound found by CW attack.
Most images have a small positive gap, which signiﬁes
[Table] [Table] [Table] [Figure]
[Figure]
[Figure]
[Figure]
is the (cid:96) 2 distortion metric
[Figure]
T IME V . S . E STIMATION A CCURACY
In Figure 7, we vary the number of samples ( N b = 50 , 100 , 250 , 500 ) and compute the (cid:96) 2 CLEVER scores for three large ImageNet models, Inception-v3, ResNet-50 and MobileNet.
We observe that 50 or 100 samples are usually sufﬁcient to obtain a reasonably accurate robustness estimation despite using a smaller number of samples.
On a single GTX 1080 Ti GPU, the cost of 1 sample (with
N s = 1024 ) is measured as 2.9 s for MobileNet, 5.0 s for ResNet-50 and 8.9 s for Inception-v3, thus the computational cost of CLEVER is feasible for state-of-the-art large-scale deep neural networks.
Additional ﬁgures for MNIST and CIFAR datasets are given in Appendix E.
C ONCLUSION
In this paper we propose the CLEVER score, a novel and generic metric to evaluate the robustness of a target neural network classiﬁer to adversarial examples.
Compared to the existing robustness evaluation approaches, our metric has the following advantages: (i) attack-agnostic; (ii) applicable to any neural network classiﬁer; (iii) comes with strong theoretical guarantees; and (iv) is computationally feasible for large neural networks.
Our extensive experiments show that the CLEVER score well matches the practical robustness indication of a wide range of natural and defended networks
A PPENDIX A P ROOF OF T HEOREM 3.
Proof.
According to Lemma 3.1, the assumption that g ( x ) :
= f c ( x ) − f j ( x ) is Lipschitz continuous with Lipschitz constant L jq gives
[Equation]
Let x = x
+ δ
and y =
x 0 in (4), we get
[Equation]
, which can be rearranged into the following form
[Equation]
When g ( x 0 + δ ) = 0 , an adversarial example is found.
As indicated by (5), g ( x 0 + δ ) is lower bounded by g ( x 0 ) − L jq (cid:107) δ (cid:107) p .
If (cid:107) δ (cid:107) p is small enough such that g ( x 0 ) − L jq (cid:107) δ (cid:107) p ≥ 0 , no adversarial examples can be found:
[Equation]
Finally, to achieve argmax 1 ≤ i ≤ K f i ( x 0 + δ )
=
c , we take the minimum of the bound on (cid:107) δ (cid:107) p in (A) over j (cid:54) =
c .
I.e. if
[Equation]
=
c f c ( x 0 ) − f j ( x 0 )
L jq , the classiﬁer decision can never be changed and the attack will never succeed.
B P ROOF OF C OROLLARY 3.2.
Proof.
By Lemma 3.1 and let g = f c − f j , we get L jq,x 0 = max y ∈ B p ( x 0 ,R ) (cid:107)∇ g ( y ) (cid:107) q = max
y ∈ B p ( x 0 ,R ) (cid:107)∇ f j ( y ) − ∇ f c ( y ) (cid:107) q , which then gives the bound in Theorem 2.1 of (Hein & An- driushchenko, 2017).
C P ROOF OF L EMMA 3.
Proof.
For any x , y , let d = y − x (cid:107) y − x (cid:107) p be the unit vector pointing from x to y and r = (cid:107) y − x (cid:107) p .
Deﬁne uni-variate function u ( z )
= h ( x + z d ) , then u (0) = h ( x ) and u ( r ) =
h ( y ) and observe that D + h ( x + z d ; d ) and D + h ( x + z d ; − d ) are the right-hand and left-hand derivatives of u ( z ) , we have [Equation]
if [Equation] undeﬁned if [Equation]
For ReLU network, there can be at most ﬁnite number of points in z ∈ (0 , r ) such that g (cid:48) ( z {+) does not exist. This can be shown because each discontinuous z is caused by some ReLU activation, and there are only ﬁnite combinations. Let 
+}
=
z 0 < z 1 < · · · < z k − 1 < z k = 1 be those points.
Then, using the fundamental theorem of calculus on each interval separately, there exists
¯ z i ∈
( z i , z i − 1 ) for each i such that
[Equation]
Theorem 3.2 and its corollaries remain valid after replacing Lemma 3.1 with Lemma 3.3.
D T HEOREM D.1 AND ITS PROOF
Theorem D.1 ( F Y ( y ) of one-hidden-layer neural network) .
Consider a neural network f : R d → R K with input x 0 ∈ R d , a hidden layer with U hidden neurons, and rectiﬁed linear unit (ReLU) activation function.
If we sample uniformly in a ball B p ( x 0 , R ) , then the cumulative distribution function of (cid:107)∇ g ( x ) (cid:107) q , denoted as F Y ( y ) , is piece-wise linear with at most M = (cid:80) di
=0 (cid:0) Ui (cid:1) pieces, where g ( x ) =
f c ( x ) − f j ( x ) for some given c and j , and 1 p + 1 q = 1 , 1 ≤ p, q ≤ ∞ .
Proof.
The j th output of a one-hidden-layer neural network can be written as
[Equation]
where σ ( z ) = max( z, 0) is ReLU activation function, W and V are the weight matrices of the ﬁrst and second layer respectively, and w r is the r th row of W .
Thus, we can compute g ( x ) and (cid:107)∇ g ( x ) (cid:107) q below:
[Equation]
and
[Equation]
U (cid:88) r = I ( w r x + b r )( V cr − V jr ) w (cid:62) r (cid:13)(cid:13)(cid:13)(cid:13)(cid:13) q , where I ( z ) is an univariate indicator function:
[Equation]
As illustrated in Figure 8, the hyperplanes
w r x + b r = 0 , r ∈ { 1 , . . .
, U } divide the d dimensional spaces R d into different regions, with the interior of each region satisfying a different set of inequality constraints, e.g. w r + x + b r + > 0 and w r − x + b r − < 0 .
Given x , we can identify which region it belongs to by checking the sign of w r x + b r for each r .
Notice that the gradient norm is the same for all the points in the same region, i.e. for any x 1 , x 2 satisfying I ( w r x 1 + b r )
=
I ( w r x 2 + b r ) ∀ r , we have (cid:107)∇ g ( x 1 ) (cid:107) q
=
(cid:107)∇ g ( x 2 ) (cid:107) q .
Since there can be at most M = (cid:80) di =0 (cid:0) Ui (cid:1) different regions for a d -dimensional space with U hyperplanes, (cid:107)∇ g ( x ) (cid:107) q can take at most M different values.
Therefore, if we perform uniform sampling in a ball B p ( x 0 , R ) centered at x 0 with radius R and denote (cid:107)∇ g ( x ) (cid:107) q as a random variable Y , the probability distribution of Y is discrete and its CDF is piece-wise constant with at most M pieces.
Without loss of generality, assume there are M 0 ≤ M distinct values for Y and denote them as m (1) , m (2) , . . .
, m ( M 0 ) in an increasing order, the CDF of
Y , denoted as F Y ( y ) , is the following:
[Equation]
where F Y ( m (0) )
=
with m (0) < m (1) , V d ( E ) is the volume of E in a d dimensional space.
E A DDITIONAL EXPERIMENTAL RESULTS E. P ERCENTAGE OF EXAMPLES HAVING P VALUE > 0 .
Table 5 shows the percentage of examples where the null hypothesis cannot be rejected by K-S test, indicating that the maximum gradient norm samples ﬁt reverse Weibull distribution well.
of this table are illustrated in Figure
[Table]
E. CLEVER V . S . NUMBER OF SAMPLES
Figure 9 shows the (cid:96) 2 CLEVER score with different number of samples ( N b = 50 , 100 , 250 , 500 ) for MNIST and CIFAR models.
For most models except MNIST-BReLU, reducing the number of samples only change CLEVER scores very slightly.
For MNIST-BReLU, increasing the number of samples improves the estimated lower bound, suggesting that a larger number of samples is preferred.
In practice, we can start with a relatively small N b = a , and also try 2 a, 4 a, · · · samples to see if CLEVER scores change signiﬁcantly.
If CLEVER scores stay roughly the same despite increasing N b , we can conclude that using N b = a is sufﬁcient.
[Figure]