Title: SIGN-OPT: A QUERY-EFFICIENT HARD-LABEL ADVERSARIAL ATTACK

Abstract: We study the most practical problem setup for evaluating adversarial robustness of a machine learning system with limited access: the hard-label black-box attack setting for generating adversarial examples, where limited model queries are allowed and only the decision is provided to a queried data input. Several algorithms have been proposed for this problem but they typically require huge amount (>20,000) of queries for attacking one example. Among them, one of the state-of-the-art approaches (Cheng et al., 2019) showed that hard-label attack can be modeled as an optimization problem where the objective function can be evaluated by binary search with additional model queries, thereby a zeroth order optimization algorithm can be applied. In this paper, we adopt the same optimization formulation but propose to directly estimate the sign of gradient at any direction instead of the gradient itself, which enjoys the benefit of single query. Using this single query oracle for retrieving sign of directional derivative, we develop a novel query-efficient Sign-OPT approach for hard-label black-box attack. We provide a convergence analysis of the new algorithm and conduct experiments on several models on MNIST, CIFAR-10 and ImageNet. We find that Sign-OPT attack consistently requires 5× to 10× fewer queries when compared to the current state-of-the-art approaches, and usually converges to an adversarial example with smaller perturbation.

1. INTRODUCTION:

It has been shown that neural networks are vulnerable to adversarial examples (Szegedy et al., 2016; Goodfellow et al., 2015; Carlini & Wagner, 2017; Athalye et al., 2018) . Given a victim neural network model and a correctly classified example, an adversarial attack aims to compute a small perturbation such that with this perturbation added, the original example will be misclassified. Many adversarial attacks have been proposed in the literature. Most of them consider the white-box setting, where the attacker has full knowledge about the victim model, and thus gradient based optimization can be used for attack. Popular Examples include C&W (Carlini & Wagner, 2017) and PGD (Madry et al., 2017) attacks. On the other hand, some more recent attacks have considered the probability black-box setting where the attacker does not know the victim model's structure and weights, but can iteratively query the model and get the corresponding probability output. In this setting, although gradient (of output probability to the input layer) is not computable, it can still be estimated using finite differences, and algorithms many attacks are based on this (Chen et al., 2017; Ilyas et al., 2018a; Tu et al., 2019; Jun et al., 2018) .

In this paper, we consider the most challenging and practical attack setting -hard-label black-box setting -where the model is hidden to the attacker and the attacker can only make queries and get the corresponding hard-label decisions (e.g., predicted labels) of the model. A commonly used algorithm proposed in this setting, also called Boundary attack (Brendel et al., 2017) , is based on random walks on the decision surface, but it does not have any convergence guarantee. More recently, Cheng et al. (2019) showed that finding the minimum adversarial perturbation in the hard-label setting can be reformulated as another optimization problem (we call this Cheng's formulation in this paper). This new formulation enjoys the benefit of having a smooth boundary in most tasks and the function value is computable using hard-label queries. Therefore, the authors of (Cheng et al., 2019) are able to use standard zeroth order optimization to solve the new formulation. Although their algorithm converges quickly, it still requires large number of queries (e.g., 20,000) for attacking a single image since every function evaluation of Cheng's formulation has to be computed using binary search requiring tens of queries.

In this paper, we follow the same optimization formulation of (Cheng et al., 2019) which has the advantage of smoothness, but instead of using finite differences to estimate the magnitude of directional derivative, we propose to evaluate its sign using only a single query. With this single-query sign oracle, we design novel algorithms for solving the Cheng's formulation, and we theoretically prove and empirically demonstrate the significant reduction in the number of queries required for hard-label black box attack.

Our contribution are summarized below:

• Novelty in terms of adversarial attack. We elucidate an efficient approach to compute the sign of directional derivative of Cheng's formulation using a single query, and based on this technique we develop a novel optimization algorithm called Sign-OPT for hard-label black-box attack. • Novelty in terms of optimization. Our method can be viewed as a new zeroth order optimization algorithm that features fast convergence of signSGD. Instead of directly taking the sign of gradient estimation, our algorithm utilizes the scale of random direction. This make existing analysis inappropriate to our case, and we provide a new recipe to prove the convergence of this new optimizer. • We conduct comprehensive experiments on several datasets and models. We show that the proposed algorithm consistently reduces the query count by 5-10 times across different models and datasets, suggesting a practical and query-efficient robustness evaluation tool. Furthermore, on most datasets our algorithm can find an adversarial example with smaller distortion compared with previous approaches.

2. RELATED WORK:

White-box attack Since it was firstly found that neural networks are easy to be fooled by adversarial examples (Goodfellow et al., 2015) , a lot of work has been proposed in the white-box attack setting, where the classifier f is completely exposed to the attacker. For neural networks, under this assumption, back-propagation can be conducted on the target model because both network structure and weights are known by the attacker. Algorithms including (Goodfellow et al., 2015; Kurakin et al., 2016; Carlini & Wagner, 2017; Chen et al., 2018; Madry et al., 2017) are then proposed based on gradient computation. Recently, the BPDA attack introduced by Athalye et al. (2018) bypasses some models with obfuscated gradients and is shown to successfully circumvent many defenses. In addition to typical attacks based on small p norm perturbation, nonp norm perturbations such as scaling or shifting have also been considered (Zhang et al., 2019) .

Black-box attack Recently, black-box setting is drawing rapidly increasing attention. In black-box setting, the attacker can query the model but has no (direct) access to any internal information inside the model. Although there are some works based on transfer attack (Papernot et al., 2017) , we consider the query-based attack in the paper. Depending on the model's feedback for a given query, an attack can be classified as a soft-label or hard-label attack. In the soft-label setting, the model outputs a probability score for each decision. Chen et al. (2017) uses a finite difference in a coordinate-wise manner to approximately estimate the output probability changes and does a coordinate descent to conduct the attack. Ilyas et al. (2018a) uses Neural evolution strategy (NES) to approximately estimate the gradient directly. Later, some variants (Ilyas et al., 2018b; Tu et al., 2019) were proposed to utilize the side information to further speed up the attack procedure. Alzantot et al. (2019) uses a evolutionary algorithm as a black-box optimizer for the soft-label setting. Recently, Al-Dujaili & O'Reilly (2019) proposes SignHunter algorithm based on signSGD (Bernstein et al., 2018) to achieve faster convergence in the soft-label setting. The recent work (Al-Dujaili & O'Reilly, 2019) proposes SignHunter algorithm to achieve a more query-efficent sign estimate when crafting black-box adversarial examples through soft-label information.

In the hard-label case, only the final decision, i.e. the top-1 predicted class, is observed. As a result, the attacker can only make queries to acquire the corresponding hard-label decision instead of the probability outputs. Brendel et al. (2017) first studied this problem and proposed an algorithm based on random walks near the decision boundary. By selecting a random direction and projecting it onto a boundary sphere in each iteration, it aims to generate a high-quality adversarial example. Query-Limited attack (Ilyas et al., 2018a) tries to estimate the output probability scores with model query and turn the hard-label into a soft-label problem. Cheng et al. (2019) instead re-formalizes the hard-label attack into an optimization problem that finds a direction which could produce the shortest distance to decision boundary.

The recent arXiv paper (Chen et al., 2019) applied the zeroth-order sign oracle to improve Boundary attack, and also demonstrated significant improvement. The major differences to our algorithm are that we propose a new zeroth-order gradient descent algorithm, provide its algorithmic convergence guarantees, and aim to improve the query complexity of the attack formulation proposed in (Cheng et al., 2019) . For completeness, we also compare with this method in Section A.1. Moreover, (Chen et al., 2019) uses one-point gradient estimate, which is unbiased but may encounter larger variance compared with the gradient estimate in our paper. Thus, we can observe in Section A.1 that although they are slightly faster in the initial stage, Sign-OPT will catch up and eventually lead to a slightly better solution.

3. PROPOSED METHOD:

We follow the same formulation in (Cheng et al., 2019) and consider the hard-label attack as the problem of finding the direction with shortest distance to the decision boundary. Specifically, for a given example x 0 , true label y 0 and the hard-label black-box function f : R d → {1, . . . , K}, the objective function g : R d → R (for the untargeted attack) can be written as:

EQUATION

It has been shown that this objective function is usually smooth and the objective function g can be evaluated by a binary search procedure locally. At each binary search step, we query the function f (x 0 + λ θ θ ) and determine whether the distance to decision boundary in the direction θ is greater or smaller than λ based on the hard-label prediction1 .

As the objective function is computable, the directional derivative of g can be estimated by finite differences:

∇g(θ; u) := g(θ + u) -g(θ) u (2)

where u is a random Gaussian vector and > 0 is a very small smoothing parameter. This is a standard zeroth order oracle for estimating directional derivative and based on this we can apply many different zeroth order optimization algorithms to minimize g. In this work, we introduce an algorithm that hugely improves the query complexity over Cheng et al. (2019) . Our algorithm is based on the following key ideas: (i) one does not need very accurate values of directional derivative in order to make the algorithm converge, and (ii) there exists an imperfect but informative estimation of directional derivative of g that can be computed by a single query.

Algorithm 1: Sign-OPT attack Input: Hard-label model f , original image x 0 , initial θ 0 ; for t = 1, 2, . . . , T do Randomly sample u 1 , . . . , u Q from a Gaussian or Uniform distribution; Compute ĝ ← 1 Q Q q=1 sign(g(θ t + u q ) -g(θ t )) • u q ; Update θ t+1 ← θ t -η ĝ ;

Evaluate g(θ t ) using the same search algorithm in Cheng et al. (2019) ; end

3.1. A SINGLE QUERY ORACLE:

As mentioned before, the previous approach requires computing g(θ + u) -g(θ) which consumes a lot of queries. However, based on the definition of g(•), we can compute the sign of this value sign(g(θ + u) -g(θ)) using a single query. Considering the untargeted attack case, the sign can be computed by

sign(g(θ + u) -g(θ)) = +1, f (x 0 + g(θ) (θ+ u) θ+ u ) = y 0 , -1, Otherwise.

(3) This is illustrated in Figure 1 . Essentially, for a new direction θ + u, we test whether a point at the original distance g(θ) from x 0 in this direction lies inside or outside the decision boundary, i.e. if the produced perturbation will result in a wrong prediction by classifier. If the produced perturbation is outside the boundary i.e. f (x 0 + g(θ) (θ+ u) θ+ u ) = y 0 , the new direction has a smaller distance to decision boundary, and thus giving a smaller value of g. It indicates that u is a descent direction to minimize g.

3.2. SIGN-OPT ATTACK:

By sampling random Gaussian vector Q times, we can estimate the imperfect gradient by

EQUATION

which only requires Q queries. We then use this imperfect gradient estimate to update our search direction θ as θ ← θ -ηĝ with a step size η and use the same search procedure to compute g(θ) up to a certain accuracy. The detailed procedure is shown in Algorithm 1.

We note that Liu et al. (2019) designed a Zeroth Order SignSGD algorithm for soft-label black box attack (not hard-label setting). They use ∇g(θ) ≈ ĝ := Q q=1 sign(g(θ + u q ) -g(θ)u q ) and shows that it could achieve a comparable or even better convergence rate than zeroth order stochastic gradient descent by using only sign information of gradient estimation. Although it is possible to combine ZO-SignSGD with our proposed single query oracle for solving hard-label attack, their estimator will take sign of the whole vector and thus ignore the direction of u q , which leads to slower convergence in practice (please refer to Section 4.4 and Figure 5 (b) for more details).

To the best of our knowledge, no previous analysis can be used to prove convergence of Algorithm 1. In the following, we show that Algorithm 1 can in fact converge and furthermore, with similar convergence rate compared with (Liu et al., 2019) despite using a different gradient estimator. Assumption 1. Function g(θ) is L-smooth with a finite value of L. Assumption 2. At any iteration step t, the gradient of the function g is upper bounded by ∇g(θ t ) 2 ≤ σ. Theorem 3.1. Suppose that the conditions in the assumptions hold, and the distribution of gradient noise is unimodal and symmetric. Then, Sign-OPT attack with learning rate

η t = O( 1 Q √ dT ) and = O( 1 dT ) will give following bound on E[ ∇g(θ) 2 ]: E[ ∇g(θ) 2 ] = O( √ d √ T + d √ Q ).

The proof can be found in subsection A.2. The main difference with the original analysis provided by Liu et al. (2019) is that they only only deal with sign of each element, while our analysis also takes the magnitudes of each element of u q into account.

3.3. OTHER GRADIENT ESTIMATIONS:

Note that the value sign(g(θ + u) -g(θ)) computed by our single query oracle is actually the sign of the directional derivative:

sign( ∇g(θ), u ) = sign( lim →∞ g(θ + u) -g(θ) ) = sign(g(θ + u) -g(θ)

) for a small .

Therefore, we can use this information to estimate the original gradient. The Sign-OPT approach in the previous section uses q sign( ∇g(θ), u q )u q as an estimation of gradient. Let y q := sign( ∇g(θ), u q ), a more accurate gradient estimation can be cast as the following constraint optimization problem:

Find a vector z such that sign( z, u q ) = y q ∀q = 1, . . . , Q.

Therefore, this is equivalent to a hard constraint SVM problem where each u q is a training sample and y q is the corresponding label. The gradient can then be recovered by solving the following quadratic programming problem:

EQUATION

By solving this problem, we can get a good estimation of the gradient. As explained earlier, each y q can be determined with a single query. Therefore, we propose a variant of Sign-OPT, which is called SVM-OPT attack. The detailed procedure is shown in Algorithm 2. We will present an empirical comparison of our two algorithms in subsection 4.1.

Algorithm 2: SVM-OPT attack Input: Hard-label model f , original image x 0 , initial θ 0 ; for t = 1, 2, . . . , T do Sample u 1 , . . . , u Q from Gaussian or orthogonal basis ; Solve z defined by (5) ; Update θ t+1 ← θ t -ηz ; Evaluate g(θ t ) using search algorithm in (Cheng et al., 2019) ; end

4. EXPERIMENTAL RESULTS:

We evaluate the SIGN-OPT algorithm for attacking black-box models in a hard-label setting on three different standard datasets -MNIST (LeCun et al., 1998) , and ImageNet-1000 (Deng et al., 2009) and compare it with existing methods. For fair and easy comparison, we use the CNN networks provided by (Carlini & Wagner, 2017) , which have also been used by other previous hard-label attacks as well. Specifically, for both MNIST and CIFAR-10, the model consists of nine layers in total -four convolutional layers, two max-pooling layers and two fully-connected layers. Further details about implementation, training and parameters are available on (Carlini & Wagner, 2017) . As reported in (Carlini & Wagner, 2017) and (Cheng et al., 2019) , we were able to achieve an accuracy of 99.5% on MNIST and 82.5% on CIFAR-10. We use the pretrained Resnet-50 (He et al., 2016) network provided by torchvision (Marcel & Rodriguez, 2010) for ImageNet-1000, which achieves a Top-1 accuracy of 76.15%.

In our experiments, we found that Sign-OPT and SVM-OPT perform quite similarly in terms of query efficiency. Hence we compare only Sign-OPT attack with previous approaches and provide a comparison between Sign-OPT and SVM-OPT in subsection 4.1. We compare the following attacks:

• Sign-OPT attack (black box): The approach presented in this paper.

• Opt-based attack (black box): The method proposed in Cheng et al. (2019) where they use Randomized Gradient-Free method to optimize the same objective function. We use the implementation provided at https://github.com/LeMinhThong/blackbox-attack. • Boundary attack (black box): The method proposed in Brendel et al. (2017) . This is compared only in L 2 setting as it is designed for the same. We use the implementation provided in Foolbox (https://github.com/bethgelab/foolbox).

• Guessing Smart Attack (black box): The method proposed in (Brunner et al., 2018) . This attack enhances boundary attack by biasing sampling towards three priors. Note that one of the priors assumes access to a similar model as the target model and for a fair comparison we do not incorporate this bias in our experiments. We use the implementation provided at https://github.com/ttbrunner/biased_boundary_attack.

• C&W attack (white box): One of the most popular methods in the white-box setting proposed in Carlini & Wagner (2017) . We use C&W L 2 norm attack as a baseline for the white-box attack performance.

For each attack, we randomly sample 100 examples from validation set and generate adversarial perturbations for them. For untargeted attack, we only consider examples that are correctly predicted by model and for targeted attack, we consider examples that are already not predicted as target label by the model. To compare different methods, we mainly use median distortion as the metric.

Median distortion for x queries is the median adversarial perturbation of all examples achieved by a method using less than x queries. Since all the hard-label attack algorithms will start from an adversarial exmample and keep reduce the distortion, if we stop at any time they will always give an adversarial example and medium distortion will be the most suitable metric to compare their performance. Besides, we also show success rate (SR) for x queries for a given threshold ( ), which is the percentage of number of examples that have achieved an adversarial perturbation below with less than x queries. We evaluate success rate on different thresholds which depend on the dataset being used. For comparison of different algorithms in each setting, we chose the same set of examples across all attacks.

Implementation details: To optimize algorithm 1, we estimate the step size η using the same line search procedure implemented in Cheng et al. (2019) . At the cost of a relatively small number of queries, this provides significant speedup in the optimization. Similar to Cheng et al. (2019) , g(θ) in last step of algorithm 1 is approximated via binary search. The initial θ 0 in algorithm 1 is calculated 0k 5k 10k 15k 20k Queries by evaluating g(θ) on 100 random directions and taking the best one. We provide our implementation publicly2 .

4.1. COMPARISON BETWEEN SIGN-OPT AND SVM-OPT:

In our experiments, we found that the performance in terms of queries of both these attacks is remarkably similar in all settings (both L 2 /L ∞ & Targeted/Untargeted) and datasets. We present a comparison for MNIST and CIFAR-10 (L 2 norm-based) for both targeted and untargeted attacks in Figure 3 . We see that the median distortion achieved for a given number of queries is quite on part for both Sign-OPT and SVM-OPT.

Number of queries per gradient estimate::

In Figure 3 , we show the comparison of Sign-OPT attack with different values of Q. Our experiments suggest that Q does not have an impact on the convergence point reached by the algorithm. Although, small values of Q provide a noisy gradient estimate and hence delayed convergence to an adversarial perturbation. Large values of Q, on the other hand, require large amount of time per gradient estimate. After fine tuning on a small set of examples, we found that Q = 200 provides a good balance between the two. Hence, we set the value of Q = 200 for all our experiments in this section.

4.2. UNTARGETED ATTACK:

In this attack, the objective is to generate an adversary from an original image for which the prediction by model is different from that of original image. Figure 4 provides an elaborate comparison of different attacks for L 2 case for the three datasets. Sign-OPT attack consistently outperforms the current approaches in terms of queries. Not only is Sign-OPT more efficient in terms of queries, in most cases it converges to a lower distortion than what is possible by other hard-label attacks. Furthermore, we observe Sign-OPT converges to a solution comparable with C&W white-box attack (better on CIFAR-10, worse on MNIST, comparable on ImageNet). This is significant for a hard-label attack algorithm since we are given very limited information.

We highlight some of the comparisons of Boundary attack, OPT-based attack and Sign-OPT attack (L 2 norm-based) in Table 1 . Particularly for ImageNet dataset on ResNet-50 model, Sign-OPT attack reaches a median distortion below 3.0 in less than 30k queries while other attacks need more than 200k queries for the same.

4.3. TARGETED ATTACK:

In targeted attack, the goal is to generate an adversarial perturbation for an image so that the prediction of resulting image is the same as a specified target. For each example, we randomly specify the target label, keeping it consistent across different attacks. We calculate the initial θ 0 in algorithm 1 using 100 samples in target label class from training dataset and this θ 0 is the same across different attacks. same number of queries for both attacks. Sign-OPT method generates an L 2 adversarial perturbation of 0.94 in ∼ 6k queries for this particular example while Opt-based attack requires ∼ 35k for the same. Figure 5 displays a comparison among different attacks in targeted setting. In our experiments, average distortion achieved by white box attack C&W for MNIST dataset is 1.51, for which Sign-OPT requires ∼ 12k queries while others need > 120k queries. We present a comparison of success rate of different attacks for CIFAR-10 dataset in Figure 6 for both targeted and untargeted cases.

4.4. THE POWER OF SINGLE QUERY ORACLE:

In this subsection, we conduct several experiments to prove the effectiveness of our proposed single query oracle in hard-label adversarial attack setting. ZO-SignSGD algorithm (Liu et al., 2019) is proposed for soft-label black box attack and we extend it into hard-label setting. A straightforward way is simply applying ZO-SignSGD to solve the hard-label objective proposed in Cheng et al. (2019) , estimate the gradient using binary search as (Cheng et al., 2019) and take its sign. In Figure 5 (b), we clearly observe that simply combining ZO-SignSGD and Cheng et al. ( 2019) is not efficient. With the proposed single query sign oracle, we can also reduce the query count of this method, as demonstrated in Figure 5(b) . This verifies the effectiveness of single query oracle, which can universally improve many different optimization methods in the hard-label attack setting. To be noted, there is still improvement on Sign-OPT over ZO-SignSGD with single query oracle because instead of directly taking the sign of gradient estimation, our algorithm utilizes the scale of random direction u as well. In other words, signSGD's gradient norm is always 1 while our gradient norm takes into account the magnitude of u. Therefore, our signOPT optimization algorithm is fundamentally different (Liu et al., 2019) or any other proposed signSGD varieties. Our method can be viewed as a new zeroth order optimization algorithm that features fast convergence in signSGD.

5. CONCLUSION:

We developed a new and ultra query-efficient algorithm for adversarial attack in the hard-label black-box setting. Using the same smooth reformulation in Cheng et al. (2019) , we design a novel zeroth order oracle that can compute the sign of directional derivative of the attack objective using single query. Equipped with this single-query oracle, we design a new optimization algorithm that can dramatically reduce number of queries compared with Cheng et al. (2019) . We prove the convergence of the proposed algorithm and show our new algorithm is overwhelmingly better than current hard-label black-box attacks.

A APPENDIX A.1 COMPARISON WITH HOPSKIPJUMPATTACK:

There is a recent paper (Chen et al., 2019) that applied the zeroth-order sign oracle to improve Boundary attack, and also demonstrated significant improvement. The major differences to our algorithm are that we propose a new zeroth-order gradient descent algorithm, provide its algorithmic convergence guarantees, and aim to improve the query complexity of the attack formulation proposed in (Cheng et al., 2019) . To be noted, HopSkipJumpAttack only provides the bias and variance analysis (Theorem 2 and 3) without convergence rate analysis.

Also, HopSkipJumpAttack uses one-point gradient estimate compared to the 2-point gradient estimate used by SignOPT. Therefore, although the estimation is unbiased, it has large variance, which achieves successful attack faster but generates a worse adversarial example with larger distortion than ours.

For completeness, we also compare with this method (and mention the results) as follows.

Figure 7 shows a comparison of Sign-OPT and HopSkipJumpAttack for CIFAR-10 and MNIST datasets for the case of L 2 norm based attack. We find in our experiments that performance of both attacks is comparable in terms of queries consumed. In some cases, Sign-OPT converges to a better solution. A.2 PROOF Define following notations: ∇g(θ t ; u q ) := sign(g(θ t + u q ) -g(θ t ))u q ∇g(θ t ; u q ) := 1 (g(θ t + u q ) -g(θ t ))u q ∇g(θ t ; u q ) := sign( 1 (g(θ t + u q ) -g(θ t ))u q )

Thus we could write the corresponding estimate of gradients as follow:

ĝt = 1 Q Q q=1 sign(g(θ t + u q ) -g(θ t ))u q = 1 Q Q q=1 ∇g(θ t ; u q ) ġt = 1 Q Q q=1 1 (g(θ t + u q ) -g(θ t ))u q = 1 Q Q q=1 ∇g(θ t ; u q ) ḡt = 1 Q Q q=1 sign( 1 (g(θ t + u q ) -g(θ t ))u q ) = 1 Q Q q=1 ∇g(θ t ; u q )

Clearly, we have ∇g(θ t ; u q ) = sign( ∇g(θ t ; u q )) and we could relate ∇g(θ t ; u q ) and ∇g(θ t ; u q ) by writing ∇g(θ t ; u q ) = G q ∇g(θ t ; u q ) where where G q ∈ R d is absolute value of vector u q (i.e.

G q = (|u q,1 |, |u q,2 |, • • • , |u q,d |) T ).

Note that Zeroth-order gradient estimate ∇g(θ t ; u q ) is a biased approximation to the true gradient of g. Instead, it becomes unbiased to the gradient of the randomized smoothing function g

(θ) = E u [g(θ + u)] Duchi et al. (2012).

Our analysis is based on the following two assumptions:

Assumption 1 function g is L-smooth with a finite value of L.

Assumption 2 At any iteration step t, the gradient of the function g is upper bounded by ∇g(θ t ) 2 ≤ σ.

To prove the convergence of proposed method, we need the information on variance of the update ∇g(θ t ; u q ). Here, we introduce a lemma from previous works.

Lemma 1 The variance of Zeroth-Order gradient estimate ∇g(θ t ; u q ) is upper bounded by

E ∇g(θ t ; u q ) -∇g (θ t ) 2 2 ] ≤ 4(Q + 1) Q σ 2 + 2 Q C(d, ),

where C(d,

) := 2dσ 2 + 2 L 2 d 2 /2

Proof of Lemma 1 This lemma could be proved by using proposition 2 in Liu et al. ( 2019) with b = 1 and q = Q. When b = 1 there is no difference between with/without replacement, and we opt for with replacement case to obtain above bound.

By talking Q = 1, we know that E ∇g(θ t ; u q ) -∇g (θ t )

2 2 ] is upper bounded. And by Jensen's inequality, we also know that the

EQUATION

where δ l denotes the upper bound of lth coordinate of E | ∇g(θ t ; u q ) -∇g (θ t )| , and δ l is finite since E ∇g(θ t ; u q ) -∇g (θ t )

2 2 ] is upper bounded. Next, we want to show the Prob[sign((ḡ t ) l ) = sign((∇g (θ t )) l )] by following lemma.

Lemma 2 |(∇g (θ t )) l |Prob[sign((ḡ t ) l ) = sign((∇g (θ t )) l )] ≤ δ l √ Q

Proof of Lemma 2 Similar to Bernstein et al. (2018) , we first relax Prob[sign(( ∇g(θ t ; u q )) l ) = sign(∇g (θ t )) l ] by Markov inequality:

Prob[sign(( ∇g(θ t ; u q )) l ) = sign((∇g (θ t )) l )] ≤ Prob[| ∇g(θ t ; u q ) l )| ≥ |∇g (θ t ) l |] ≤ E |( ∇g(θ t ; u q ) -∇g (θ t )) l ] |∇g (θ t ) l | ≤ δ l |∇g (θ t ) l | ,

where the last inequality comes from eq (6). Recall that ( ∇g(θ t ; u q )) l ) is an unbiased estimation to (∇g (θ t )) l . Under the assumption that the noise distribution is unimodal and symmetric, from Bernstein et al. (2018) Lemma D1, we will have Prob[sign(( ∇g(θ 

t ; u q )) l ) = sign(∇g (θ t )) l ] := M ≤ 2 9 1 S 2 , S ≥ 2 √ 3 1 2 -S 2 √ 3 , otherwise < 1 2 ,

where S := |∇g (θ t ) l |/δ l .

Published as a conference paper at ICLR 2020 Note that this probability bound applies uniformly to all q ∈ Q regardless of the magnitude

EQUATION

This is true as when all |(u q ) l | = 1, Prob[sign(( Q q=1 sign( ∇g(θ t ; u q )) l ) = sign(∇g (θ t )) l ] is equivalent to majority voting of each estimate q yielding correct sign. This is the same as sum of Q bernoulli trials (i.e. binomial distribution) with error rate M. And since error probability M is independent of sampling of |(u q ) l |, calculating Prob[sign( Q q=1 |(u q ) l |sign(( ∇g(θ t ; u q )) l ) = sign(∇g (θ t )) l ] could be thought as taking Q bernoulli experiments and then independently draw a weight from unit length for each of Q experiment. Since the weight is uniform, we will have expectation of weights on correct counts and incorrect counts are the same and equal to 1/2. Therefore, the probability of Prob[sign( Q q=1 |(u q ) l |sign(( ∇g(θ t ; u q )) l ) = sign(∇g (θ t )) l ] is still the same as original non-weighted binomial distribution. Notice that by our notation, we will have sign( ∇g(θ t ; u q ) l ) = ∇g(θ t ; u q ) l thus 1 Q Q q=1 sign( ∇g(θ t ; u q )) l = (ḡ t ) l . Let Z counts the number of estimates ∇g(θ t ; u q ) l yielding correct sign of ∇g (θ t ) l . Probability in eq (7) could be written as:

Prob[sign(sign((ḡ t ) l ) = sign(∇g (θ t )) l ] = P [Z ≤ Q 2 ].

Following the derivation of theorem 2b in Bernstein et al. (2018) , we could get

P [Z ≤ Q 2 ] ≤ 1 √ QS ⇒ |(∇g (θ t )) l |Prob[sign((ḡ t ) l ) = sign((∇g (θ t )) l )] ≤ δ l √ Q (8)

We also need few more lemmas on properties of function g.

Lemma 3 g (θ 1 ) -g (θ T ) ≤ g (θ 1 ) -g * + 2 L

Proof of Lemma 3 The proof can be found in Liu et al. (2018) Lemma C.

Lemma 4 E[ ∇g(θ) 2 ] ≤ √ 2E[ ∇g (θ) 2 ] + Ld √ 2

, where g * = min θ g(θ).

Proof of Lemma 4:

The proof can be found in Liu et al. (2019) .

Theorem 1 Suppose that the conditions in the assumptions hold, and the distribution of gradient noise is unimodal and symmetric. where Ḡt is defined as Define a new random variable R with probability P (R = t) = ηt T t=1 ηt , we will have

( Ḡt ) l = Q q=1 (G q ) l ∇g(θ t ; u q ) l = Q q=1 |(u q ) l |

E[ ∇g (θ R ) 2 ] = E[E R [ ∇g (θ R ) 2 ]] = E T t=1 P (R = t) ∇g (θ t ) 2 .

Substitute all the quantities into Lemma 4, we will get (d, ) . 

E[ ∇g(θ) 2 ] ≤ √ 2(g (θ 1 ) -g * + 2 L) T t=1 ηt + dL √ 2 T t=1 ηt 2 T t=1 ηt + Ld √ 2 + T t=1 2 √ 2 √ d √ Q 4(Q + 1)σ 2 + 2C

:

Note that binary search only works in a small local region; in more general case g(θ) has to be computed by a fine-grained search plus binary search, as discussed inCheng et al. (2019).

https://github.com/cmhcbb/attackbox

Figures and Tables:

Figure 1: Illustration

Figure 2: Example of Sign-OPT targeted attack. L 2 distortions and queries used are shown above and below the images. First two rows: Example comparison of Sign-OPT attack and OPT attack. Third and fourth rows: Examples of Sign-OPT attack on CIFAR-10 and ImageNet

Figure 3: Median L 2 distortion vs Queries. First two: Comparison of Sign-OPT and SVM-OPT attack for MNIST and CIFAR-10. Third: Performance of Sign-OPT for different values of Q.

Figure 4: Untargeted attack: Median distortion vs Queries for different datasets.

Figure6: Success Rate vs Queries for CIFAR-10 (L 2 norm-based attack). First two and last two depict untargeted and targeted attacks respectively. Success rate threshold is at the top of each plot.

Figure 7: Comparison with HopSkipJumpAttack for CIFAR and MNIST: Median distortion vs Queries. (U) represents untargeted attack and (T) represents targeted attack.

By choosing = O( 1 dT ) and η t = O( 1 Q √ dT ), then the convergence rate as shown in above isO( d T + d √ Q ).

L 2 Untargeted attack -Comparison of average L 2 distortion achieved using a given number of queries for different attacks. SR stands for success rate. SR( = 1.5) #Queries Avg L 2 SR( = 0.5) #Queries Avg L 2 SR( = 3.0)

Table content: <table><tr><td/><td/><td>MNIST</td><td/><td/><td>CIFAR10</td><td/><td colspan="3">ImageNet (ResNet-50)</td></tr><tr><td colspan="3">4,000 #Queries Avg L 2 Boundary attack 4.24 8,000 4.24</td><td>1.0% 1.0%</td><td>4,000 8,000</td><td>3.12 2.84</td><td>2.3% 7.6%</td><td>4,000 30,000</td><td>209.63 17.40</td><td>0% 16.6%</td></tr><tr><td/><td>14,000</td><td>2.13</td><td>16.3%</td><td>12,000</td><td>0.78</td><td>29.2%</td><td>160,000</td><td>4.62</td><td>41.6%</td></tr><tr><td>OPT attack</td><td>4,000 8,000</td><td>3.65 2.41</td><td>3.0% 18.0%</td><td>4,000 8,000</td><td>0.77 0.43</td><td>37.0% 53.0%</td><td>4,000 30,000</td><td>83.85 16.77</td><td>2.0% 14.0%</td></tr><tr><td/><td>14,000</td><td>1.76</td><td>36.0%</td><td>12,000</td><td>0.33</td><td>61.0%</td><td>160,000</td><td>4.27</td><td>34.0%</td></tr><tr><td>Guessing Smart</td><td>4,000 8,000</td><td>1.74 1.69</td><td>41.0% 42.0%</td><td>4,000 8,000</td><td>0.29 0.25</td><td>75.0% 80.0%</td><td>4,000 30,000</td><td>16.69 13.27</td><td>12.0% 12.0%</td></tr><tr><td/><td>14,000</td><td>1.68</td><td>43.0%</td><td>12,000</td><td>0.24</td><td>80.0%</td><td>160,000</td><td>12.88</td><td>12.0%</td></tr><tr><td>Sign-OPT attack</td><td>4,000 8,000</td><td>1.54 1.18</td><td>46.0% 84.0%</td><td>4,000 8,000</td><td>0.26 0.16</td><td>73.0% 90.0%</td><td>4,000 30,000</td><td>23.19 2.99</td><td>8.0% 50.0%</td></tr><tr><td/><td>14,000</td><td>1.09</td><td>94.0%</td><td>12,000</td><td>0.13</td><td>95.0%</td><td>160,000</td><td>1.21</td><td>90.0%</td></tr><tr><td>C&amp;W (white-box)</td><td>-</td><td>0.88</td><td>99.0%</td><td>-</td><td>0.25</td><td>85.0%</td><td>-</td><td>1.51</td><td>80.0%</td></tr></table>

Then, Sign-OPT attack with learning rate η t = O( 1 Proof of Theorem 1 From L-smoothness assumption we could haveg (θ t+1 ) ≤ g (θ t ) + ∇g (θ t ), θ t+1 -θ t + L 2 θ t+1 -θ t 2 2 = g (θ t ) -η k ∇g (θ t ), ĝt + )) l |Prob[sign((ḡ t ) l ) = sign((∇g (θ t )) l )],

Table content: <table><tr><td/><td colspan="2">L 2</td><td colspan="3">η 2 t ĝt</td><td>2 2</td></tr><tr><td colspan="4">= g (θ t ) -η t Ḡt ∇g (θ t ) 1 +</td><td colspan="2">dL 2</td><td>η 2 t</td><td>Ḡt</td><td>2</td></tr><tr><td>d</td><td/><td/><td/><td/></tr><tr><td>+ 2η t Ḡt</td><td>|(∇g (θ t</td><td/><td/><td/></tr><tr><td>l=1</td><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td>Q</td><td>√</td><td>dT ) and</td></tr><tr><td colspan="4">= O( 1 dT ) will give following bound on E[ ∇g(θ) 2 ]</td><td/></tr><tr><td colspan="2">E[ ∇g(θ) 2 ] = O(</td><td colspan="3">√ √ T d</td><td>+</td><td>d √ Q</td><td>)</td></tr></table>

∇g(θ t ; u q ) l . Continue the inequality,g (θ t ) -η t Ḡt ∇g (θ t ) 1 + (θ t )) l |Prob[sign((ḡ t ) l ) = sign((∇g (θ t )) l )] ≤ g (θ t ) -η t Ḡt ∇g (θ t ) 1 +where we define ηt := η t Ḡt . Sum up all inequalities for all ts and take expectation on both side, we will have Since • 2 ≤ • 1 and we could divide ∇g (θ t ) 2 ] ≤ g (θ 1 ) -g * + 2 L

Table content: <table><tr><td/><td/><td/><td/><td/><td colspan="7">T t=1 ηt on both side to get</td></tr><tr><td>T t=1</td><td>ηt T t=1 ηt</td><td colspan="5">E[ T t=1 ηt</td><td/><td>+</td><td colspan="2">dL 2</td><td>T t=1 ηt T t=1 ηt 2</td><td>+</td><td>T t=1</td><td>2 √ √ Q d</td><td>4(Q + 1)σ 2 + 2C(d, ).</td></tr><tr><td/><td/><td/><td>dL 2</td><td>η 2 t</td><td>Ḡt</td><td>2</td><td/><td/><td/><td/></tr><tr><td/><td/><td>d</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td colspan="2">+ 2η t Ḡt</td><td>l=1</td><td colspan="2">|(∇g dL 2</td><td>η 2 t</td><td>Ḡt</td><td colspan="5">2 + 2η t Ḡt</td><td>d l=1</td><td>δ l √ Q</td><td>by eq (8)</td></tr><tr><td/><td/><td/><td/><td>dL 2</td><td>η 2 t</td><td>Ḡt</td><td colspan="5">2 + 2η t Ḡt</td><td>√</td><td>d</td><td>√</td><td>δ l 2 2 Q</td></tr><tr><td colspan="5">= g (θ dL 2</td><td>η 2 t</td><td>Ḡt</td><td colspan="5">2 + 2η t Ḡt</td><td>√</td><td>d E (( ∇g(θ t ; u q ) -∇g (θ t ) ) 2 l ] √ Q</td><td>by eq (6).</td></tr><tr><td colspan="4">Thus we will have,</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td colspan="7">dL 2 2 + 2η dL η 2 t Ḡt 2 η 2 t Ḡt 2 + 2η dL 2 ηt 2 + 2 ηt √ d E (( ∇g(θ t ; u q ) -∇g (θ t ) ) 2 l ] √ Q</td><td>,</td></tr><tr><td>T t=1</td><td colspan="6">ηt E[ ∇g (θ t ) 1 ] ≤ E[g (θ 1 ) -g (θ T )] +</td><td>dL 2</td><td colspan="4">T t=1 d E (( ∇g(θ T ηt 2 + T t=1 2 ηt √ t=1 ηt 2 + T t=1 2 ηt √ d 4(Q + 1) Q σ 2 +</td><td>2 Q</td><td>C(d, )</td><td>by Lemma 1.</td></tr><tr><td colspan="8">Substitute Lemma 3 into above inequality, we get</td><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td>T t=1</td><td>ηt</td><td>2 +</td><td>T t=1</td><td>2 ηt</td><td>√</td><td>d</td><td>4(Q + 1) Q</td><td>σ 2 +</td><td>2 Q</td><td>C(d, ).</td></tr></table>

Peer review (iclr2020):
In this paper, the authors propose a new algorithm for evaluating adversarial robustness of black-box models. The aim of the proposed algorithm, SIGN-OPT is generating adversarial examples as close as possible to the decision boundary using as less queries of the black-box model as possible. The authors follow the approach of (Cheng et al 2019) by modeling the problem as an optimization problem, where the objective function is to find the direction with the shortest distance to the decision boundary. They propose a smart modification of the previous approach by evaluating the sign of the gradient rather than the gradient itself. The advantage is that the sign of the gradient can be evaluated using a single query while the estimation of the gradient needs many queries. The authors have analyzed the proposed algorithm. They showed that using SIGN-OPT, the expectation of the gradient tends to zero in , meaning that a (local) minimum is reached. The algorithm is favorably compared with the state-of-the-art on three image test sets (MNIST, CIFAR-10n ImageNet). This paper is technically sound, well-written and propose an interesting modification of a previous algorithm. I vote for acceptance. However, I have some concerns: - I think that the L-smoothness assumption should be discussed. Is it realistic for Deep Learning models? Does it hold for the three attacked CNN networks? - The analytical results of the previous algorithm RGF and the proposed algorithm SIGN-OPT are not compared and discussed. It is a pity.