P RIOR C ONVICTIONS : B LACK -B OX A DVERSARIAL A TTACKS WITH B ANDITS AND P RIORS
Anonymous authors
Paper under double-blind review
A BSTRACT
We study the problem of generating adversarial examples in a black-box setting in which only loss-oracle access to a model is available.
We introduce a framework that conceptually uniﬁes much of the existing work on black-box attacks and we demonstrate that the current state-of-the-art methods are optimal in a natural sense.
Despite this optimality, we show how to improve black-box attacks by bringing a new element into the problem: gradient priors.
We give a bandit optimization-based algorithm that allows us to seamlessly integrate any such priors and we explicitly identify and incorporate two examples.
The resulting methods use two to four times fewer queries and fail two to ﬁve times less than the current state-of-the-art.
I NTRODUCTION
Recent research has shown that neural networks exhibit signiﬁcant vulnerability to adversarial examples, or slightly perturbed inputs designed to fool the network prediction.
This vulnerability is present in a wide range of settings, from situations in which inputs are fed directly to classiﬁers (Szegedy et al., 2013; Carlini et al., 2016) to highly variable real-world environments (Kurakin et al., 2016; Athalye et al., 2017).
Researchers have developed a host of methods to construct such attacks (Goodfellow et al., 2014; Moosavi-Dezfooli et al., 2015; Carlini & Wagner, 2017; Madry et al., 2017), most of which correspond to ﬁrst order (i.e., gradient based) methods.
These attacks turn out to be highly effective: in many cases, only a few gradient steps sufﬁce to construct an adversarial perturbation.
A signiﬁcant shortcoming of many of these attacks, however, is that they fundamentally rely on the white-box threat model.
That is, they crucially require direct access to the gradient of the classiﬁcation loss of the attacked network.
In many real-world situations, expecting this kind of complete access is not realistic.
In such settings, an attacker can only issue classiﬁcation queries to the targeted network, which corresponds to a more restrictive black box threat model.
Recent work (Chen et al., 2017; Bhagoji et al., 2017; Ilyas et al., 2017) provides a number of attacks for this threat model.
Chen et al.
(2017) show how to use a basic primitive of zeroth order optimization, the ﬁnite difference method, to estimate the gradient from classiﬁcation queries and then use it (in addition to a number of optimizations) to mount a gradient based attack.
The method indeed successfully constructs adversarial perturbations.
It comes, however, at the cost of introducing a signiﬁcant overhead in terms of the number of queries needed.
For instance, attacking an
ImageNet (Russakovsky et al., 2015) classiﬁer requires hundreds of thousands of queries.
Subsequent work (Ilyas et al., 2017) improves this dependence signiﬁcantly, but still falls short of fully mitigating this issue (see Section 4.1 for a more detailed analysis).
1. O UR CONTRIBUTIONS
We revisit zeroth-order optimization in the context of adversarial example generation, both from an empirical and theoretical perspective.
We propose a new approach for generating black-box adversarial examples, using bandit optimization in order to exploit prior information about the gradient, which we show is necessary to break through the optimality of current methods.
We evaluate our approach on the task of generating black-box adversarial examples, where the methods obtained from integrating two example priors signiﬁcantly outperform state-of-the-art approaches.
Concretely, in this work: 1.
We formalize the gradient estimation problem as the central problem in the context of query-efﬁcient black-box attacks.
We then show how the resulting framework uniﬁes the previous attack methodology.
We prove that the least squares method, a classic primitive in signal processing, not only constitutes an optimal solution to the general gradient estimation problem but also is essentially equivalent to the current-best black-box attack methods.
We demonstrate that, despite this seeming optimality of these methods, we can still improve upon them by exploiting an aspect of the problem that has been not considered previously: the priors we have on the distribution of the gradient.
We identify two example classes of such priors, and show that they indeed lead to better predictors of the gradient.
Finally, we develop a bandit optimization framework for generating black-box adversarial examples which allows for the seamless integration of priors.
To demonstrate its effectiveness, we show that leveraging the two aforementioned priors yields black-box attacks that are 2-5 times more query efﬁcient and less failure-prone than the state of the art.
[Table]
B LACK - BOX ATTACKS AND THE GRADIENT ESTIMATION PROBLEM
Adversarial examples are natural inputs to a machine learning system that have been carefully perturbed in order to induce misbehaviour of the system, under a constraint on the magnitude of the pertubation (under some metric).
For image classiﬁers, this misbehaviour can be either classiﬁcation as a speciﬁc class other than the original one (the targeted attack) or misclassiﬁcation (the untargeted attack).
For simplicity and to make the presentation of the overarching framework focused, in this paper, we restrict our attention to the untargeted case.
Both our algorithms and the whole framework can be, however, easily adapted to the targeted setting.
Also, we consider the most standard threat model in which adversarial perturbations must have (cid:96) p -norm, for some ﬁxed p , less than some (cid:15) p .
2. F IRST - ORDER ADVERSARIAL ATTACKS
Suppose that we have some classiﬁer C ( x ) with a corresponding classiﬁcation loss function L ( x, y ) , where x is some input and y its corresponding label.
In order to generate a misclassiﬁed input from some input-label pair ( x, y ) , we want to ﬁnd an adversarial example x (cid:48) which maximizes L ( x (cid:48) , y ) but still remains (cid:15) p -close to the original input.
We can thus formulate our adversarial attack problem as the following constrained optimization task:
[Equation]
First order methods tend to be very successful at solving the problem despite its non-convexity (Goodfellow et al., 2014; Carlini & Wagner, 2017; Madry et al., 2017).
A ﬁrst order method used as the backbone of some of the most powerful white-box adversarial attacks for (cid:96) p bounded adversaries is projected gradient descent (PGD) .
This iterative method, given some input x and its correct label y , computes a perturbed input x k by applying k steps of the following update (with x 0 = x )
[Equation]
Here, Π S is the projection onto the set S , B p ( x (cid:48) , ε (cid:48) ) is the (cid:96) p ball of radius ε (cid:48) around x (cid:48) , η is the step size, and ∂U is the boundary of a set U .
Also, as is standard in continuous optimization, we make s l be the projection of the gradient ∇ x L ( x l − 1 , y ) at x l − 1 onto the unit (cid:96) p ball.
This way we ensure that s l corresponds to the unit (cid:96) p -norm vector that has the largest inner product with ∇ x L ( x l − 1 , y ) .
(Note that, in the case of the (cid:96) 2 -norm, s l is simply the normalized gradient but in the case of, e.g., the (cid:96) ∞ -norm, s l corresponds to the sign vector, sgn ( ∇ x L ( x l − 1 , y )) of the gradient.)
So, intuitively, the PGD update perturbs the input in the direction that (locally) increases the loss the most.
Observe that due to the projection in (1), x k is always a valid perturbation of x , as desired.
2. B LACK - BOX ADVERSARIAL ATTACKS
The projected gradient descent (PGD) method described above is designed to be used in the context of so-called white-box attacks.
That is, in the setting where the adversary has full access to the gradient ∇ x L ( x, y ) of the loss function of the attacked model.
In many practical scenarios, however, this kind of access is not available—in the corresponding, more realistic black-box setting, the adversary has only access to an oracle that returns for a given input ( x, y ) , only the value of the loss L ( x, y ) .
One might expect that PGD is thus not useful in such black-box setting.
It turns out, however, that this intuition is incorrect.
Speciﬁcally, one can still estimate the gradient using only such value queries.
(In fact, this kind of estimator is the backbone of so-called zeroth-order optimization frameworks (Spall, 2005).)
The most canonical primitive in this context is the ﬁnite difference method .
This method estimates the directional derivative D v f ( x ) =
(cid:104)∇ x f ( x ) , v (cid:105) of some function f at a point x in the direction of a vector v as
[Equation]
Here, the step size δ > 0 governs the quality of the gradient estimate.
Smaller δ gives more accurate estimates but also decreases reliability, due to precision and noise issues.
Consequently, in practice, δ is a tunable parameter.
Now, we can just use ﬁnite differences to construct an estimate of the gradient.
To this end, one can ﬁnd the d components of the gradient by estimating the inner products of the gradient with all the standard basis vectors e 1 , . . .
, e d :
[Equation]
We can then easily implement the PGD attack (c.f. (1)) using this estimator:
[Equation]
Indeed, Chen et al.
(2017) were the ﬁrst to use ﬁnite differences methods in this basic form to power
PGD–based adversarial attack in the black-box setting.
This basic attack was shown to be successful but, since its query complexity is proportional to the dimension, its resulting query complexity was prohibitively large.
For example, the Inception v3 (Szegedy et al., 2015) classiﬁer on the ImageNet dataset has dimensionality d=268,203 and thus this method would require 268,204 queries.
(It is worth noting, however, that Chen et al.
(2017) developed additional methods to, at least partially, reduce this query complexity.)
2. B LACK - BOX ATTACKS WITH IMPERFECT GRADIENT ESTIMATORS
In the light of the above discussion, one can wonder if the algorithm (4) can be made more queryefﬁcient.
A natural idea here would be to avoid fully estimating the gradient and rely instead only on its imperfect estimators.
This gives rise to the following question: How accurate of an gradient estimate is necessary to execute a successful PGD attack?
We examine this question ﬁrst in the simplest possible setting: one in which we only take a single
PGD step (i.e., the case of k = 1 ).
Previous work (Goodfellow et al., 2014) indicates that such an attack can already be quite powerful.
So, we study how the effectiveness of this attack varies with gradient estimator accuracy.
Our experiments, shown in Figure 1, suggest that it is feasible to generate adversarial examples without estimating correctly even most of the coordinates of the gradient.
For example, in the context of (cid:96) ∞ attacks, setting a randomly selected 20% of the coordinates in the gradient to match the true gradient (and making the remaining coordinates have random sign) is
[Figure]
a d v e r s a r i a li t y r a t e
[Figure]
sufﬁcient to fool the classiﬁer on more than 60% images with single-step PGD.
Our experiments thus demonstrate that an adversary is likely to be able to cause a misclassiﬁcation by performing the iterated PGD attack, even when driven by a gradient estimate that is largely imperfect.
2. T HE GRADIENT ESTIMATION PROBLEM
The above discussion makes it clear that successful attacks do not require a perfect gradient estimation, provided this estimate is suitably constructed.
It is still unclear, however, how to efﬁciently ﬁnd this kind of imperfect but helpful estimator.
Continuous optimization methodology suggests that the key characteristic needed from our estimator is for it to have a sufﬁciently large inner product with the actual gradient.
We thus capture this challenge as the following gradient estimation problem :
Deﬁnition 1 (Gradient estimation problem) .
For an input/label pair ( x, y ) and a loss function L , let g ∗ =
∇ x L ( x, y ) be the gradient of L at ( x, y ) .
Then the goal of the gradient estimation problem is to ﬁnd a unit vector (cid:98)
[Equation]
maximizing the inner product
[Equation]
from a limited number of (possibly adaptive) function value queries L ( x (cid:48) , y (cid:48) ) .
(The expectation here is taken over the randomness of the estimation algorithm.)
One useful perspective on the above gradient estimation problem stems from casting the recovery of g ∗ in (5) as an underdetermined vector estimation task.
That is, one can view each execution of the ﬁnite difference method (see (2)) as computing an inner product query in which we obtain the value of the inner product of g ∗ and
some chosen direction vector A i .
Now, if we execute k such queries, and k < d (which is the regime we are interested in), the information acquired in this process can be expressed as the following (underdetermined) linear regression problem Ag ∗ =
y , where the rows of the matrix
A correspond to the queries A 1 , . . .
, A k and the entries of the vector y gives us the corresponding inner product values.
Relation to compressive sensing
The view of the gradient estimation problem we developed bears striking similarity to the compressive sensing setting (Foucart & Rauhut, 2013).
Thus one might wonder if the toolkit of that area could be applied here.
Compressive sensing crucially requires, however, certain sparsity structure in the estimated signal (here, in the gradient g ∗ ) and, to our knowledge, the loss gradients do not exhibit such a structure.
(We discuss this further in Appendix B.)
The least squares method In light of this, we turn our attention to another classical signalprocessing method: norm-minimizing (cid:96) 2 least squares estimation.
This method approaches the estimation problem posed in (5) by casting it as an undetermined linear regression problem of the form Ag ∗ =
b , where we can choose the matrix A (the rows of A correspond to inner product queries with g ∗ ).
Then, it obtains the solution (cid:98) g to the regression problem by solving:
[Equation]
A reasonable choice for A (via Johnson & Lindenstrauss (1984) and related results) is the distancepreserving random Gaussian projection matrix, i.e. A ij normally distributed.
The resulting algorithm turns out to yield solutions that are approximately those given by Natural
Evolution Strategies (NES), which (Ilyas et al., 2017) previously applied to black-box attacks.
In particular, in Appendix A, we prove the following theorem.
Theorem 1 (NES and Least Squares equivalence) .
Let ˆ x NES be the Gaussian k -query NES estimator of a d -dimensional gradient g and let ˆ x LSQ be the minimal-norm k -query least-squares estimator of g .
For any p > 0 , with probability at least 1 − p we have that
[Equation]
Note that when we work in the underdetermined setting, i.e., when k (cid:28) d (which is the setting we are interested in), the right hand side bound becomes vanishingly small.
Thus, the equivalence indeed holds.
In fact, using the precise statement (given and proved in Appendix A), we can show that
Theorem 1 provides us with a non-vacuous equivalence bound.
Further, it turns out that one can exploit this equivalence to prove that the algorithm proposed in Ilyas et al.
(2017) is not only natural but optimal, as the least-squares estimate is an information-theoretically optimal gradient estimate.
Theorem 2 (Least-squares optimality (Proof in Appendix A)) .
For a linear regression problem y
=
A g with known A and y , unknown g , and isotropic Gaussian errors, the least-squares estimator is ﬁnite-sample efﬁcient, i.e. the minimum-variance unbiased (MVU) estimator of the latent vector g .
B LACK - BOX ADVERSARIAL ATTACKS WITH PRIORS
The optimality of least squares strongly suggests that we have reached the limit of query-efﬁciency of black-box adversarial attacks.
But is this really the case?
Surprisingly, we show that an improvement is still possible.
The key observation is that the optimality we established of least-squares (and by
Theorem 1, the NES approach in (Ilyas et al., 2017)) holds only for the most basic setting of the gradient estimation problem, a setting where we assume that the target gradient is a truly arbitrary and completely unknown vector.
However, in the context we care about this assumption does not hold – there is actually plenty of prior knowledge about the gradient available.
Firstly, the input with respect to which we compute the gradient is not arbitrary and exhibits locally predictable structure which is consequently reﬂected in the gradient.
Secondly, when performing iterative gradient attacks (e.g. PGD), the gradients used in successive iterations are likely to be heavily correlated.
The above observations motivate our focus on prior information as an integral element of the gradient estimation problem.
Speciﬁcally, we enhance Deﬁnition 1 by making its objective
[Equation]
I is prior information available to us
[Equation]
This change in perspective gives rise to two important questions: does there exist prior information that can be useful to us? , and does there exist an algorithmic way to exploit this information?
We show that the answer to both of these questions is afﬁrmative.
3. G RADIENT PRIORS
Consider a gradient ∇ x L ( x, y ) of the loss function corresponding to some input ( x, y ) .
Does there exist some kind of prior that can be extracted from the dataset { x i } , in general, and the input ( x, y ) in particular, that can be used as a predictor of the gradient?
We demonstrate that it is indeed the case, and give two example classes of such priors.
Time-dependent priors
The ﬁrst class of priors we consider are time-dependent priors, a standard example of which is what we refer to as the “multi-step prior.”
We ﬁnd that along the trajectory taken by estimated gradients, successive gradients are in fact heavily correlated.
We show this empirically by taking steps along the optimization path generated by running the NES estimator at each point, and plotting the normalized inner product (cosine similarity) between successive gradients, given by
[Equation]
[Figure] [Figure]
Figure 2 demonstrates that there indeed is a non-trivial correlation between successive gradients— typically, the gradients of successive steps (using step size from Ilyas et al.
(2017)) have a cosine similarity of about 0.9.
Successive gradients continue to correlate at higher step sizes: Appendix B shows that the trend continues even at step size 4.0 (a typical value for the total perturbation bound ε ).
This indicates that there indeed is a potential gain from incorporating this correlation into our iterative optimization.
To utilize this gain, we intend to use the gradients at time t − 1 as a prior for the gradient at time t , where both the prior and the gradient estimate itself evolve over iterations.
Data-dependent priors
We ﬁnd that the time-dependent prior discussed above is not the only type of prior one can exploit here.
Namely, we can also use the structure of the inputs themselves to reduce query complexity (in fact, the existence of such data-dependent priors is what makes machine learning successful in the ﬁrst place).
In the case of image classiﬁcation, a simple and heavily exploited example of such a prior stems from the fact that images tend to exhibit a spatially local similarity (i.e. pixels that are close together tend to be similar).
We ﬁnd that this similarity also extends to the gradients: speciﬁcally, whenever two coordinates ( i, j ) and ( k, l ) of ∇ x L ( x, y ) are close, we expect ∇ x L ( x, y ) ij ≈ ∇ x L ( x, y ) kl too.
To corroborate and quantify this phenomenon, we compare ∇ x L ( x, y ) with an average-pooled, or “tiled”, version (with “tile length” k ) of the same signal.
An example of such an average-blurred gradient can be seen in Appendix B. More concretely, we apply to the gradient the mean pooling operation with kernel size ( k, k, 1) and stride ( k, k, 1) , then upscale the spatial dimensions by k .
We then measure the cosine similarity between the average-blurred gradient and the gradient itself.
Our results, shown in Figure 3, demonstrate that the gradients of images are locally similar enough to allow for average-blurred gradients to maintain relatively high cosine similarity with the actual gradients, even when the tiles are large.
Our results suggest that we can reduce the dimensionality of our problem by a factor of k 2 (for reasonably large k ) and still estimate a vector pointing close to the same direction as the original gradient.
This factor, as we show later, leads to signiﬁcantly improved black-box adversarial attack performance.
3. A FRAMEWORK FOR GRADIENT ESTIMATION WITH PRIORS
Given the availability of these informative gradient priors, we now need a framework that enables us to easily incorporate these priors into our construction of black-box adversarial attacks.
Our proposed method builds on the framework of bandit optimization , a fundamental tool in online convex optimization Hazan (2016).
In the bandit optimization framework, an agent plays a game that consists of a sequence of rounds.
In round t , the agent must choose a valid action, and then by playing the action incurs a loss given by a loss function (cid:96) t ( · ) that is unknown to the agent.
After playing the action, he/she only learns the loss that the chosen action incurs; the loss function is speciﬁc to the round t and may change arbitrarily between rounds.
The goal of the agent is to minimize the average loss incurred over all rounds, and the success of the agent is usually quantiﬁed by comparing the total loss incurred to that of the best expert in hindsight (the best single-action policy).
By the nature of this formulation, the rounds of this game can not be treated as independent — to perform well, the agent needs to keep track of some latent record that aggregates information learned over a sequence of rounds.
This latent record usually takes a form of a vector v t that is constrained to a speciﬁed (convex) set K .
As we will see, this aspect of the bandit optimization framework will provide us with a convenient way to incorporate prior information into our gradient prediction.
An overview of gradient estimation with bandits.
We can cast the gradient estimation problem as an bandit optimization problem in a fairly direct manner.
Speciﬁcally, we let the action at each round t be a gradient estimate g t (based on our latent vector v t ), and the loss (cid:96) t correspond to the (negative) inner product between this prediction and the actual gradient.
Note that we will never have a direct access to this loss function (cid:96) t
but we are able to evaluate its value on a particular prediction vector g t via the ﬁnite differences method (2) (which is all that the bandits optimization framework requires us to be able to do).
Just as this choice of the loss function (cid:96) t allows us to quantify performance on the gradient estimation problem, the latent vector v t will allow us to algorithmically incorporate prior information into our predictions.
Looking at the two example priors we consider, the time-dependent prior will be reﬂected by carrying over the latent vector between the gradient estimations at different points.
Data-dependent priors will be captured by enforcing that our latent vector has a particular structure.
For the speciﬁc prior we quantify in the preceding section (data-dependent prior for images), we will simply reduce the dimensionality of the latent vector via average-pooling (“tiling“), removing the need for extra queries to discern components of the gradient that are spatially close.
3. I MPLEMENTING GRADIENT ESTIMATION IN THE BANDIT FRAMEWORK
We now describe our bandit framework for adversarial example generation in more detail.
Note that the algorithm is general and can be used to construct black-box adversarial examples where the perturbation is constrained to any convex set ( (cid:96) p -norm constraints being a special case).
We discuss the algorithm in its general form, and then provide versions explicitly applied to the (cid:96) 2 and (cid:96) ∞ cases.
As previously mentioned, the latent vector v t ∈ K serves as a prior on the gradient for the corresponding round t – in fact, we make our prediction g t be exactly v t projected onto the appropriate space, and thus we set K to be an extension of the space of valid adversarial perturbations (e.g. R n for (cid:96) 2 examples, [ − 1 , 1] n for (cid:96) ∞ examples).
Our loss function (cid:96) t is deﬁned as
[Equation]
(9) for a given gradient estimate g , where we access this inner product via ﬁnite differences.
Here,
L ( x, y ) is the classiﬁcation loss on an image x with true class y .
The crucial element of our algorithm will thus be the method of updating the latent vector v t .
We will adapt here the canonical “reduction from bandit information” (Hazan, 2016).
Speciﬁcally, our update procedure is parametrized by an estimator ∆ t of the gradient ∇ v (cid:96) t ( v ) , and a ﬁrst-order update step
A ( K × R dim( K ) → K ) , which maps the latent vector v t and the estimated gradient of (cid:96) t with respect to v t (which we denote ∆ t ) to a new latent vector v t
+1 .
The resulting general algorithm is presented as Algorithm 1.
In our setting, we make the estimator ∆ of the gradient −∇ v (cid:104)∇ L ( x, y ) , v (cid:105) of the loss (cid:96) be the standard spherical gradient estimator (see Hazan (2016)).
We take a two-query estimate of the expectation, and employ antithetic sampling which results in the estimate being computed as
[Equation]
1: procedure B ANDIT -O
PT -L OSS -G
RAD -E ST ( x, y init ) 2: v 0 ← A ( φ ) 3: for each round t = 1 , . .
, T do 4: //
Our loss in round t is (cid:96) t ( g t ) =
−(cid:104)∇ x L ( x, y init ) , g t (cid:105) 5: g t ← v t − 1 6: ∆ t ← G RAD -E ST ( x, y init , v t − 1 ) //
Estimated Gradient of (cid:96) t 7: v t ← A ( v t − 1 , ∆ t ) 8: g ← v T 9: return Π ∂ K
[ g ] where u is a Gaussian vector sampled from N (0 , 1 d I ) .
The resulting algorithm for calculating the gradient estimate given the current latent vector v , input x and the initial label y is Algorithm 2.
1: procedure G RAD -E ST ( x, y, v ) 2: u ← N (0 , 1 d I ) //
Query vector 3: { q 1 , q 2 } ← { v + δ u , v − δ u } //
Antithetic samples 4: (cid:96) t ( q 1 ) =
−(cid:104)∇ L ( x, y ) , q 1 (cid:105)
≈ L ( x,y ) − L ( x + (cid:15) · q 1 ,y ) (cid:15) //
Gradient estimation loss at q5: (cid:96) t ( q 2 ) =
−(cid:104)∇ L ( x, y ) , q 2 (cid:105)
≈
L ( x,y ) − L ( x + (cid:15) · q 2 ,y ) (cid:15) //
Gradient estimation loss at q6: ∆ ← (cid:96) t ( q 1 ) − (cid:96)
[Equation]
u 7: //
Note that due to cancellations we can actually evaluate ∆ with only two queries to L 8: return ∆
A crucial point here is that the above gradient estimator ∆ t parameterizing the bandit reduction has no direct relation to the “gradient estimation problem” as deﬁned in Section 2.4.
It is simply a general mechanism by which we can update the latent vector v t in bandit optimization.
It is the actions g t (equal to v t ) which provide proposed solutions to the gradient estimation problem from Section 2.4.
The choice of the update rule A tends to be natural once the convex set K is known.
For K = R n , we can simply use gradient ascent:
[Equation]
and the exponentiated gradients (EG) update when the constraint is an (cid:96) ∞ bound (i.e. K =
[ − 1 , 1] n ): p
[Equation]
Finally, in order to translate our gradient estimation algorithm into an efﬁcient method for constructing black-box adversarial examples, we interleave our iterative gradient estimation algorithm with an iterative update of the image itself, using the boundary projection of g t in place of the gradient (c.f. (1)).
This results in a general, efﬁcient, prior-exploiting algorithm for constructing black-box adversarial examples.
The resulting algorithm in the (cid:96) 2 -constrained case is shown in Algorithm 3.
E XPERIMENTS AND EVALUATION
We evaluate our bandit approach described in Section 3 and the natural evolutionary strategies (NES) approach of Ilyas et al.
(2017) on their effectiveness in generating untargeted adversarial examples.
We consider both the (cid:96) 2 and (cid:96) ∞ threat models on the ImageNet (Russakovsky et al., 2015) dataset, in terms of success rate and query complexity.
We further investigate loss and gradient estimate quality over the optimization trajectory in each method.
To show the method extends to other datasets,
1: procedure A
3: v 0 ← 0 1 × d // If
, d
4: x 0 ← x
// Adversarial to be constructed 5: while C ( x ) =
y init do 6: g t ← v t − 1 7: x t ← x t − 1 + h · g t || g t
||
// Boundary projection g
|| g t || standard PGD: c.f.
(Rigollet, 2015) 8: ∆ t ← G RAD -E ST ( x t − 1 , y init , v t − 1 ) //
Estimated Gradient of (cid:96) t 9: v t ← v t − 1 + η · ∆ t 10: t ←
we also compare to NES in the CIFAR- (cid:96) ∞ threat model; in all threat models, we show results on
Inception-v3, Resnet-50, and VGG16 classiﬁers.
In evaluating our approach, we test both the bandit approach with time prior (Bandits T ), and our bandit approach with the given examples of both the data and time priors (Bandits TD ).
We use 10,000 and 1,000 randomly selected images (scaled to [0 , 1] ) to evaluate all approaches on ImageNet and CIFAR-10 respectively.
For NES, Bandits T , and Bandits TD we found hyperparameters (given in
Appendix C, along with the experimental parameters) via grid search.
4. R ESULTS
For ImageNet, we record the effectiveness of the different approaches in both threat models in Table( (cid:96) 2 and (cid:96) ∞ perturbation constraints), where we show the attack success rate and the mean number of queries (of the successful attacks) needed to generate an adversarial example for the Inception-v classiﬁer (results for other classiﬁers in Appendix F).
For all attacks, we limit the attacker to at most 10,000 oracle queries.
As shown in Table 1, our bandits framework with both data-dependent and time prior (Bandits TD ), is six and three times less failure-prone than the previous state of the art (NES (Ilyas et al., 2017)) in the (cid:96) ∞ and (cid:96) 2 settings, respectively.
Despite the higher success rate, our method actually uses around half as many queries as NES.
In particular, when restricted to the inputs on which NES is successful in generating adversarial examples, our attacks are 2.5 and 5 times as query-efﬁcient for the (cid:96) ∞ and (cid:96) 2 settings, respectively.
In Appendix G, we also compare against the
AutoZOOM method of Tu et al.
(2018), where we show that our Bandits TD method at a higher 100% success rate is over 6 times as query-efﬁcient.
Finally, we also have similar results for CIFARunder the (cid:96) ∞ threat model, which can be found in Appendix E.
We also further quantify the performance of our methods in terms of black-box attacks, and gradient estimation.
Speciﬁcally, we ﬁrst measure average queries per success after reaching a certain success rate (Figure 4a), which indicates the dependence of the query count on the desired success rate.
The data shows that for any ﬁxed success rate, our methods are more query-efﬁcient than NES, and (due to the exponential trend) suggest that the difference may be ampliﬁed for higher success rates.
We then plot the loss of the classiﬁer over time (averaged over all images), and performance on the gradient estimation problem for both (cid:96) ∞ and (cid:96) 2 cases (which, crucially, corresponds directly to the expectation we maximize in (7).
We show these three plots for (cid:96) ∞ in Figure 4, and show the results for (cid:96) 2 (which are extremely similar) in Appendix D, along with CDFs showing the success of each method as a function of the query limit.
We ﬁnd that on every metric in both threat models, our methods strictly dominate NES in terms of performance.
R ELATED WORK
All known techniques for generating adversarial examples in the black-box setting so far rely on either iterative optimization schemes (our focus) or so-called substitute networks and transferability.
In the ﬁrst line of work, algorithms use queries to gradually perturb a given input to maximize a corresponding loss, causing misclassiﬁcation.
Nelson et al.
(2012) presented the ﬁrst such iterative attack on a special class of binary classiﬁers.
Later, Xu et al.
(2016) gave an algorithm for fooling a
[Figure]
c o s s i m il a r it y
Correlation with g ∗ real-world system with black-box attacks.
Speciﬁcally, they fool PDF document malware classiﬁer by using a genetic algorithms-based attack.
Soon after, Narodytska & Kasiviswanathan (2017) described the ﬁrst black-box attack on deep neural networks; the algorithm uses a greedy search algorithm that selectively changes individual pixel values.
Chen et al.
(2017) were the ﬁrst to design black-box attack based on ﬁnite-differences and gradient based optimization.
The method uses coordinate descent to attack black-box neural networks, and introduces various optimizations to decrease sample complexity.
Building on the work of Chen et al.
(2017), Ilyas et al.
(2017) designed a black-box attack strategy that also uses ﬁnite differences but via natural evolution strategies (NES) to estimate the gradients.
They then used their algorithm as a primitive in attacks on more restricted threat models.
In a concurrent line of work, Papernot et al.
(2017) introduced a method for attacking models with so-called substitute networks.
Here, the attacker ﬁrst trains a model – called a substitute network – to mimic the target network’s decision boundaries.
The attacker then generates adversarial examples on the substitute network, and uses them to attack the original target mode.
Increasing the rate at which adversarial examples generated from substitute networks fool the target model is a key aim of substitute networks work.
In Papernot et al.
(2017), the attacker generates a synthetic dataset of examples labeled by the target classiﬁer using black-box queries.
The attacker then trains a substitute network on the dataset.
Adversarial examples generated with methods developed with recent methods Papernot et al.
; Liu et al.
(2016) tend to transfer to a target MNIST classiﬁer.
We note, however, that the overall query efﬁciency of this type of methods tends to be worse than that of the gradient estimation based ones.
(Their performance becomes more favorable as one becomes interested in attacking more and more inputs, as the substitute network has to be trained only once.)
C ONCLUSION
We develop a new, unifying perspective on black-box adversarial attacks.
This perspective casts the construction of such attacks as a gradient estimation problem.
We prove that a standard least-squares estimator both captures the existing state-of-the-art approaches to black-box adversarial attacks, and actually is, in a certain natural sense, an optimal solution to the problem.
We then break the barrier posed by this optimality by considering a previously unexplored aspect of the problem: the fact that there exists plenty of extra prior information about the gradient that one can exploit to mount a successful adversarial attack.
We identify two examples of such priors: a “time-dependent” prior that corresponds to similarity of the gradients evaluated at similar inputs, and a “data-dependent” prior derived from the latent structure present in the input space.
Finally, we develop a bandit optimization approach to black-box adversarial attacks that allows for a seamless integration of such priors.
The resulting framework signiﬁcantly outperforms the state-of-the-art methods, achieving a factor of two to six improvement in terms of success rate and query efﬁciency.
Our results thus open a new avenue towards ﬁnding priors for construction of even more efﬁcient black-box adversarial attacks.
A P ROOFS
Theorem 1 (NES and Least Squares equivalence) .
Let ˆ x NES be the Gaussian k -query NES estimator of a d -dimensional gradient g and let ˆ x LSQ be the minimal-norm k -query least-squares estimator of g .
For any p > 0 , with probability at least 1 − p we have that
[Equation]
and in particular,
[Equation]
with probability at least 1 − p , where
[Equation]
Proof.
Let us ﬁrst recall our estimation setup.
We have k query vectors δ i ∈ R d drawn from an i.i.d
Gaussian distribution whose expected squared norm is one, i.e. δ i ∼ N (0 ,
1 d I ) , for each 1 ≤ i ≤ k .
Let the vector y ∈ R
k denote the inner products of δ i s with the gradient, i.e.
[Equation]
, for each 1 ≤ i ≤ k .
We deﬁne the matrix A to be a k × d matrix with the δ i s being its rows.
That is, we have
[Equation]
Now, recall that the closed forms of the two estimators we are interested in are given by
[Equation]
which implies that
[Equation]
We can bound the difference between these two inner products as
[Equation]
Now, to bound the ﬁrst term in (12), observe that
[Equation]
and thus
I − ( AA T ) − 1 = ∞ (cid:88) l
= ( AA T − I ) l .
(Note that the ﬁrst term in the above sum has been canceled out.)
This gives us that
[Equation]
∞
[Equation]
[Table]
≤ (cid:12)(cid:12)(cid:12)(cid:12) AA T − I (cid:12)(cid:12)(cid:12)(cid:12) 1 − ||
AA T −
I || ≤ 2 (cid:12)(cid:12)(cid:12)(cid:12) AA T
[Equation]
I (cid:12)(cid:12)(cid:12)(cid:12)
[Equation]
as long as (cid:12)(cid:12)(cid:12)(cid:12) AA T − I (cid:12)(cid:12)(cid:12)(cid:12) ≤ 12 (which, as we will see, is indeed the case with high probability).
Our goal thus becomes bounding (cid:12)(cid:12)(cid:12)(cid:12)
AA T − I (cid:12)(cid:12)(cid:12)(cid:12) =
λ max ( AA T − I ) , where λ max ( · ) denotes the largest (in absolute value) eigenvalue.
Observe that AA T and − I commute and are simultaneously diagonalizable.
As a result, for any 1 ≤ i ≤ k , we have that the i -th largest eigenvalue
λ
i ( AA T − I ) of AA T − I can be written as
[Equation]
So, we need to bound
[Equation]
To this end, recall that E [ AA T ] =
I (since the rows of A are sampled from the distribution N (0 , 1 d I ) ), and thus, by the covariance estimation theorem of Gittens and Tropp Gittens & Tropp (2011) (see
Corollary 7.2) (and union bounding over the two relevant events), we have that
[Equation]
Setting
[Equation]
ensuring that ε ≤ 12 , gives us
[Equation]
and thus
[Equation]
with probability at least 1 − kk +1 p .
To bound the second term in (12), we note that all the vectors δ i are chosen independently of the vector g and each other.
So, if we consider the set { ˆ g, ˆ δ 1 , . . .
, ˆ δ k } of k + 1 corresponding normalized directions, we have (see, e.g., (Gorban et al., 2016))
that the probability that any two of them have the (absolute value of) their inner product be larger than some ε (cid:48)
= (cid:113) 2log(
( k +1) /p )
d is at most
[Equation]
On the other hand, we note that each δ i is a random vector sampled from the distribution N (0 , 1 d I d ) , so we have that (see, e.g., Lemma 1 in (Laurent & Massart, 2000)), for any 1 ≤ i ≤ k and any ε (cid:48)(cid:48) > 0 ,
Pr
[Equation]
Setting
[Equation]
d yields
[Equation]
d
[Equation]
Applying these two bounds (and, again, union bounding over all the relevant events), we get that
[Equation]
with probability at most pk +1 .
Finally
[Equation]
by plugging the above bound and the bound (13) into the bound (12)
[Equation]
we obtain that
[Equation]
||
[Equation]
, with probability 1 − p , where κ =(cid:115) log (cid:18) 2 k ( k + 1) p (cid:19) .
This completes the proof.
Theorem 2 (Least-Squares Optimality) .
For a ﬁxed projection matrix A and under the following observation model of isotropic Gaussian noise:
y =
A g + (cid:126)ε where ε ∼ N ( 0 , ε Id ) , the least-squares estimator as in Theorem 1, ˆ x LSQ =
A T ( AA T ) − 1 y is a ﬁnite-sample efﬁcient (minimum-variance unbiased) estimator of the parameter g .
Proof.
Proving the theorem requires an application of the Cramer-Rao Lower Bound theorem:
Theorem 3 (Cramer-Rao Lower Bound) .
Given a parameter θ , an observation distribution p ( x ; θ ) , and an unbiased estimator ˆ θ that uses only samples from p ( x ; θ ) , then (subject to Fisher regularity conditions trivially satisﬁed by Gaussian distributions),
[Equation]
1 where I ( θ ) is the Fisher matrix:
[Equation]
Now, note that the Cramer-Rao bound implies that if the variance of the estimator ˆ θ is the inverse of the Fisher matrix, ˆ θ must be the minimum-variance unbiased estimator.
Recall the following form of the Fisher matrix:
[Equation]
Now, suppose we had the following equality, which we can then simplify using the preceding equation:
[Equation]
Multiplying the preceding by [ I ( θ )] − 1 on both the left and right sides yields:
[Equation]
which tells us that (15) is a sufﬁcient condition for ﬁnite-sample efﬁciency (minimal variance).
We show that this condition is satisﬁed in our case, where we have y ∼ A g + ε , ˆ θ = ˆ x LSQ , and θ = g .
We begin by computing the Fisher matrix directly, starting from the distribution of the samples y :
[Equation]
Using (14)
[Equation] [Equation]
Finally, note that we can write:
[Equation]
which concludes the proof, as we have shown that ˆ x LSQ satisﬁes the condition (15), which in turn implies ﬁnite-sample efﬁciency.
Claim 1.
Applying the precise bound that we can derive from Theorem 1 on an ImageNet-sized dataset ( d = 300000) and using k = 100 queries (what we use in our (cid:96) ∞ threat model and ten times that used for our (cid:96) 2 threat model),
[Equation]
For 10 queries,
[Equation]
B O MITTED F IGURES B. C OMPRESSIVE S ENSING
Compressed sensing approaches can, in some cases, solve the optimization problem presented in
Section 2.4.
However, these approaches require sparsity to improve over the least squares method.
Here we show the lack of sparsity in gradients through a classiﬁer on a set of canonical bases for images.
In Figure
[Figure]
we plot the fraction of (cid:96) 2 weight accounted for by the largest k components in randomly chosen image gradients when using two canonical bases: standard and wavelet (db4).
While lack of sparsity in these bases does not strictly preclude the existence of a basis on which gradients are sparse, it suggests the lack of a fundamental structural sparsity in gradients through a convolutional neural network.
[Figure]
B. T ILING
An example of the tiling procedure applied to a gradient can be seen in Figure 6.
[Figure]
B. T IME - DEPENDENT P RIORS AT H IGHER S TEP S IZES
We show in Figure 7 that the correlation between successive gradients on the NES trajectory are signﬁcantly correlated, even at much higher step sizes (up to (cid:96) 2 norm of 4.0, which is a typical value for ε , the total adversarial perturbation bound and thus an absolute bound on step size).
This serves as further motivation for the time-dependent prior.
[Figure]
C H YPERPARAMETERS
[Table]
[Table] [Table]
D
F ULL R ESULTS
[Figure]
iteration
[Figure]
o ss
Average Loss ( (cid:96) 2 ) 5k 10k 0 .
.iteration
c
o s s i m il a r it y
Correlation with g ∗ ( (cid:96) 2 )
NES
Bandits T (time prior)
Bandits TD (time + data) 5k 10k  iteration
[Figure]
ss
Average Loss ( (cid:96) ∞ )
[Figure]
0 .iteration
c
o s s i m il a r it y
Correlation with g
[Figure]
( (cid:96)
[Figure] [Figure]
cce ss r a t e
Success
[Figure]
( (cid:96)
[Figure] [Figure]
E R ESULTS FOR CIFAR-
Here, we give results for the CIFAR-10 dataset, comparing our best method (Bandits TD ) and NES.
We train Inception-v3, ResNet-50, and VGG16 classiﬁers by ﬁne-tuning the standard PyTorch ImageNet classiﬁers.
As such, all images are upsampled to 224 × 224 ( 299 × 299 ) for ResNet-50 and VGG (and Inception-v3).
Just as for ImageNet, we use a maximum (cid:96) ∞ perturbation of 0 .
05 , where images are scaled to [0 , 1] .
[Table]
F R ESULTS FOR OTHER C LASSIFIERS
Here
[Table]
we give results for the ImageNet dataset, comparing our best method (Bandits TD ) and NES for Inception-v3 (also shown in Table 1), VGG
[Table]
and ResNet50 classiﬁers.
Note that we do not ﬁne-tune the hyperparameters to the new classiﬁers, but simply use the hyperparameters found for
Inception-v3.
Nevertheless, our best method consistently outperforms NES on black-box attacks.
[Table]
G C OMPARISON TO (T U ET AL , 2018)
To compare with the method of Tu et al.
(2018), we consider the same classiﬁer and dataset (Inceptionv3 and Imagenet) under the same (cid:96) 2 threat model.
Note that Tu et al.
(2018) use mean rather than maximum (cid:96) 2 perturbation to evaluate their attacks (since the method is based on a Lagrangian relaxation).
To ensure a fair comparison we compare against the average number of queries to reach the adversarial examples bounded within a pertubation budget of 2 · 10 − 4 , which is explicitly reported byTu et al.
For the bandits approach, we used Bandits T , (the bandits method with the time prior) and Bandits TD (the bandits method with both time and data prior) and run the methods until 100% success is reached.
We use the same hyperparameters from the untargeted ImageNet experiments (given in Appendix C).
Our ﬁndings, given in Table 7 show that our best method achieves an 100% success rate, and an over 6-fold reduction in queries.
Note that the method of Tu et al.
(2018) achieves 100% success rate in general, but only constrains the mean (cid:96) 2 perturbation, and thus actually achieves a strictly less than 100% success rate with this perturbation threshold. Attack
[Table]
AutoZOOM-BiLin (Tu et al., 2018) [Table] AutoZOOM-AE (Tu et al., 2018)
[Table]