Title: QUERY-EFFICIENT HARD-LABEL BLACK-BOX ATTACK: AN OPTIMIZATION-BASED APPROACH

Abstract: We study the problem of attacking machine learning models in the hard-label black-box setting, where no model information is revealed except that the attacker can make queries to probe the corresponding hard-label decisions. This is a very challenging problem since the direct extension of state-of-the-art white-box attacks (e.g., C&W or PGD) to the hard-label black-box setting will require minimizing a non-continuous step function, which is combinatorial and cannot be solved by a gradient-based optimizer. The only two current approaches are based on random walk on the boundary (Brendel et al., 2017) and random trials to evaluate the loss function (Ilyas et al., 2018) , which require lots of queries and lacks convergence guarantees. We propose a novel way to formulate the hard-label black-box attack as a real-valued optimization problem which is usually continuous and can be solved by any zeroth order optimization algorithm, such as randomized gradientfree method (Nesterov & Spokoiny, 2017) . We demonstrate that our proposed method outperforms the previous stochastic approaches to attacking convolutional neural networks on MNIST, CIFAR, and ImageNet datasets. More interestingly, the proposed algorithm can also be used to attack other discrete and non-continuous machine learning models, such as Gradient Boosting Decision Trees.

1. INTRODUCTION:

It has been observed recently that machine learning algorithms, especially deep neural networks, are vulnerable to adversarial examples (Goodfellow et al., 2014; Szegedy et al., 2013; Moosavi-Dezfooli et al.; Moosavi Dezfooli et al., 2016; Chen et al., 2018a; Cheng et al., 2018) . For example, in image classification problems, attack algorithms (Carlini & Wagner, 2017; Goodfellow et al., 2014; Chen et al., 2017) can find adversarial examples for almost every image with very small humanimperceptible perturbation. The problem of finding an adversarial example can be posed as solving an optimization problem-within a small neighbourhood around the original example, find a point to optimize the cost function measuring the "successfulness" of an attack. Solving this objective function with gradient-based optimizer leads to state-of-the-art attacks (Carlini & Wagner, 2017; Goodfellow et al., 2014; Chen et al., 2017; Szegedy et al., 2013; Madry et al., 2018) .

Most current attacks (Goodfellow et al., 2014; Carlini & Wagner, 2017; Szegedy et al., 2013; Chen et al., 2018b) consider the "white-box" setting, where the machine learning model is fully exposed to the attacker. In this setting, the gradient of an attacking objective function can be computed by back-propagation, so attacks can be done very easily. This white-box setting is clearly unrealistic when the model parameters are unknown to an attacker. Instead, several recent works consider the "score-based black-box" setting, where the machine learning model is unknown to the attacker, but it is possible to make queries to obtain the corresponding probability outputs of the model (Chen et al., 2017; Ilyas et al., 2018) . However, in many cases real-world models will not provide probability outputs to users. Instead, only the final decision (e.g., top-1 predicted class) can be observed. It is therefore interesting to show whether machine learning model is vulnerable in this setting. Furthermore, existing gradient-based attacks cannot be applied to some non-continuous machine learning models which involve discrete decisions. For example, the robustness of decision-tree based models (random forest and gradient boosting decision trees (GBDT)) cannot be evaluated using gradient-based approaches, since the gradient of these functions may not exist.

In this paper, we develop an optimization-based framework for attacking machine learning models in a more realistic and general "hard-label black-box" setting. We assume that the model is not revealed and the attacker can only make queries to acquire the corresponding hard-label decision instead of the probability outputs (also known as soft labels).

We make hard-label black-box attacks query-efficient by reformulating the attack as a novel realvalued optimization problem, which is usually continuous and much easier to solve. Although the objective function of this reformulation cannot be written in an analytical form, we show how to use (hard-label) model queries to evaluate its function value and thus any zeroth order optimization algorithm can be applied to solve it. In the experiments, we show our algorithm can be successfully used to attack hard-label black-box CNN models on MNIST, CIFAR, and ImageNet with far less number of queries compared to the state-of-art algorithm both in L 2 and L ∞ metric.

Moreover, since our algorithm does not depend on the gradient of the classifier, we can apply it to attack other non-differentiable classifiers besides neural networks. We show an interesting application in attacking Gradient Boosting Decision Tree, which cannot be attacked by all the existing gradientbased methods even in the white-box setting. Our method can successfully find adversarial examples with imperceptible perturbations for a GBDT within 30,000 queries.

2. BACKGROUND AND RELATED WORK:

We will first introduce our problem setting and give a brief literature review to highlight the difficulty of attacking hard-label black-box models. Problem Setting For simplicity, we consider attacking a K-way multi-class classification model in this paper. Given the classification model f : R d → {1, . . . , K} and an original example x 0 , the goal is to generate an adversarial example x such that x is close to x 0 and f (x) = f (x 0 ) (i.e., x is misclassified by model f .)

(1)

White-box attacks Most attack algorithms in the literature consider the white-box setting, where the classifier f is exposed to the attacker. For neural networks, under this assumption, backpropagation can be conducted on the target model because both network structure and weights are known by the attacker. For classification models in neural networks, it is usually assumed that f (x) = argmax i (Z(x) i ), where Z(x) ∈ R K is the final (logit) layer output, and Z(x) i is the prediction score for the i-th class. The objectives in (1) can then be naturally formulated as the following optimization problem:

EQUATION

where Dis(•, •) is some distance measurement (e.g.,

L 2 , L 1 or L ∞ norm in Euclidean space), L(•)

is the loss function corresponding to the goal of the attack, and c is a balancing parameter. For untargeted attack, where the goal is to make the target classifier misclassify, the loss function can be defined as

EQUATION

where y 0 is the original label predicted by the classifier, κ is the margin (usually set to be 1 or 0) of the hinge loss. For targeted attack, where the goal is to turn it into a specific target class t, the loss function can also be defined accordingly.

Therefore, attacking a machine learning model can be posed as solving this optimization problem (Carlini & Wagner, 2017; Chen et al., 2018b) , which is also known as the C&W attack or the EAD attack depending on the choice of the distance measurement. To solve (2), one can apply any gradient-based optimization algorithm such as SGD or Adam, since the gradient of L(Z(x)) can be computed via back-propagation.

The ability of computing gradient also enables many different attacks in the white-box setting. For example, eq (2) can also be turned into a constrained optimization problem, which can then be solved by projected gradient descent (PGD) (Madry et al., 2018) . FGSM (Goodfellow et al., 2014) is the special case of one step PGD with L ∞ norm distance. Other algorithms such as Deepfool (Moosavi Dezfooli et al., 2016) also solve similar optimization problems to construct adversarial examples.

Previous work on black-box attack In real-world systems, usually the underlying machine learning model will not be revealed and thus white-box attacks cannot be applied. This motivates the study of attacking machine learning models in the black-box setting, where attackers do not have any information about the function f . And the only valid operation is to make queries to the model and acquire the corresponding output f (x). The first approach for black-box attack is using transfer attack (Papernot et al., 2017) -instead of attacking the original model f , attackers try to construct a substitute model f to mimic f and then attack f using white-box attack methods. This approach has been well studied and analyzed in (Liu et al., 2017; Bhagoji et al., 2017) . However, recent papers have shown that attacking the substitute model usually leads to much larger distortion and low success rate (Chen et al., 2017) . Therefore, instead, (Chen et al., 2017) considers the score-based black-box setting, where attackers can use x to query the softmax layer output in addition to the final classification result. In this case, they can reconstruct the loss function (3) and evaluate it as long as the objective function h(x) exists for any x. Thus a zeroth order optimization approach can be directly applied to minimize h(x). (Tu et al., 2018) further improves the query complexity of (Chen et al., 2017) by introducing an autoencoder-based approach to reduce query counts and an adaptive random gradient estimation to balance query counts and distortion.

Difficulty of hard-label black-box attacks Throughout this paper, the hard-label black-box setting refers to cases where real-world ML systems only provide limited prediction results of an input query. Specifically, only the final decision (top-1 predicted label) instead of probability outputs is known to an attacker.

Attacking in this setting is indeed very challenging. In Figure 1a , we show a simple 3-layer neural network's decision boundary. Note that the L(Z(x)) term is continuous as in Figure 1b because the logit layer output is real-valued functions. However, in the hard-label black-box setting, only f (•) is available instead of Z(•). Since f (•) can only be a one-hot vector, if we plug-in f into the loss function, L(f (x)) (as shown in Figure 1c ) will be discontinuous and with discrete outputs.

(a) Decision boundary of f (x) Optimizing this function will require combinatorial optimization or search algorithms, which is challenging given the high dimensionality of the problem. The only two current approaches (Brendel et al., 2017; Ilyas et al., 2018) are based on random-walk on the boundary and random trails on the loss function. Although these "Boundary attack" and "Limited attack" can find adversarial examples with comparable distortion with white-box attacks, they need lots of queries to explore the high-dimensional space and lack convergence guarantees. We show that our optimization-based algorithm can significantly reduce the number of queries, and has guaranteed convergence in the number of iterations (queries) when the objective function is lipschitz smooth.

(b) L(Z(x)) (c) L(f (x)) (d) g(θ)

3. ALGORITHMS:

Now we introduce a novel way to re-formulate hard-label black-box attack as another optimization problem, show how to evaluate the function value using hard-label queries, and then apply a zeroth order optimization algorithm to solve it.

3.1. A BOUNDARY-BASED RE-FORMULATION:

For a given example x 0 , true label y 0 and the hard-label black-box function f : R d → {1, . . . , K}, we define our objective function g : R d → R depending on the type of attack:

Untargeted attack: g(θ) = min λ>0 λ s.t f (x 0 + λ θ ||θ|| ) = y 0 (4) Targeted attack (given target t): g(θ) = min λ>0 λ s.t f (x 0 + λ θ ||θ|| ) = t (5)

In this formulation, θ represents the search direction and g(θ) is the distance from x 0 to the nearest adversarial example along the direction θ. The difference between ( 4) and ( 5) corresponds to the different definitions of "successfulness" in untargeted and targeted attack, where the former one aims to turn the prediction into any incorrect label and the later one aims to turn the prediction into the target label. For untargeted attack, g(θ) also corresponds to the distance to the decision boundary along the direction θ. In image problems the input domain of f is bounded, so we will impose corresponding upper/lower bounds in the definition of ( 4) and ( 5). (6) Finally, the adversarial example can be found by

x * = x 0 + g(θ * ) θ * θ *

, where θ * is the optimal solution of ( 6). Note that unlike the C&W or PGD objective functions, which are discontinuous step functions in the hard-label setting (see Section 2), g(θ) maps input direction to real-valued output (distance to decision boundary), which is usually continuous -a small change of θ usually leads to a small change of g(θ), as can be seen from Figure 2 . Moreover, we give three examples of f (x) defined in two dimension input space and their corresponding g(θ). In Figure 3a , we have a continuous classification function defined as follows

f (x) = 1, if x 2 2 ≥ 0.4 0, otherwise.

In this case, as shown in Figure 3c , g(θ) is continuous. Moreover, in Figure 3b and Figure 1a , we show decision boundaries generated by GBDT and neural network classifier, which are not continuous. However, as showed in Figure 3d and Figure 1d , even if the classifier function is not continuous, g(θ) is still continuous. This makes it easy to apply zeroth order method to solve (6). Compute g(θ) up to certain accuracy. We are not able to evaluate the gradient of g, but we can evaluate the function value of g using the hard-label queries to the original function f . For simplicity, we focus on untargeted attack here, but the same procedure can be applied to targeted attack as well.

First, we discuss how to compute g(θ) directly without additional information. This is used in the initialization step of our algorithm. For a given normalized θ, we do a coarse-grained search and then a binary search. In coarse-grained search, we query the points {x 0 + αθ, x 0 + 2αθ, . . . } one by one until we find f (x + iαθ) = y 0 . This means the boundary lies between [x 0 + (i -1)αθ, x 0 + iαθ].

We then enter the second phase and conduct a binary search to find the solution within this region (same with line 11-17 in Algorithm 1). Note that there is an upper bound of the first stage if we choose θ by the direction of xx 0 with some x from another class. This procedure is used to find the initial θ 0 and corresponding g(θ 0 ) in our optimization algorithm. We omit the detailed algorithm for this part since it is similar to Algorithm 1.

Next, we discuss how to compute g(θ) when we know the solution is very close to a reference point v. This is used in all the function evaluations in our optimization algorithm, since the current solution is usually close to the previous solution, and when we estimate the gradient using (7), the queried direction will only be a slight modification of the previous one. In this case, we first increase or decrease v in the local region to find the interval that contains the nearby boundary (e.g, f (x 0 + vθ) = y 0 and f (x 0 + v θ) = y 0 ), then conduct a binary search to find the final value of g.

Our procedure for computing the g value is presented in Algorithm 1.

Algorithm 1 Compute g(θ) locally 1: Input: Hard-label model f , original image x 0 , query direction θ, previous solution v, increase/decrease ratio α = 0.01, stopping tolerance (maximum tolerance of computed error) Although we could let θ = θ ∞ in (4) and (5) directly, g(θ) will be harder to optimize in practice because of introducing the max term in • ∞ . Instead, with an L ∞ constraint ε , we design a smooth approximation loss as follows:

2: θ ← θ/||θ|| 3: if f (x 0 + vθ) = y 0 then 4: v lef t ← v, v right ← (1 + α)v 5: while f (x 0 + v right θ) = y 0 do 6: v right ← (1 + α)v right 7: else 8: v right ← v, v lef t ← (1 -α)v 9: while f (x 0 + v lef t θ) = y 0 do 10: v lef t ← (1 -α)v lef t 11: ## Binary Search within [v lef t , v right ] 12: while v right -v lef t > do 13: v mid ← (v right + v lef t )/2 14: if f (x 0 + v mid θ) = y 0 then 15: v lef t ← v mid 16:

Untargeted attack: g(θ) = min λ { d i=1 (max{λ |θ i | θ ∞ -ε, 0}) 2 } s.t f (x 0 + λ θ θ ∞ ) = y 0 Targeted attack: g(θ) = min λ { d i=1 (max{λ |θ i | θ ∞ -ε, 0}) 2 } s.t f (x 0 + λ θ θ ∞ ) = t.

Here θ i is the i-th coordinate of θ. Notably, when λ ≤ ε, we have g(θ) = 0. That's to say, we have obtained a legitimate θ to make a valid adversarial example x 0 + λ * θ θ ∞ .

3.3. ZEROTH ORDER OPTIMIZATION:

To solve the optimization problem (6) for which we can only evaluate function value instead of gradient, zeroth order optimization algorithms can be naturally applied. In fact, after the reformulation, the problem can be potentially solved by any zeroth order optimization algorithm, like zeroth order gradient descent, genetic algorithm (Alzantot et al., 2018) or coordinate descent (see Conn et al. (2009) for a comprehensive survey).

Here we propose to solve (1) using Randomized Gradient-Free (RGF) method proposed in (Nesterov & Spokoiny, 2017; Ghadimi & Lan, 2013) . In practice, we found it outperforms zeroth-order coordinate descent. At each iteration, the gradient is estimated by

ĝ = g(θ + βu) -g(θ) β • u (7)

Algorithm 2 RGF for hard-label black-box attack 1: Input: Hard-label model f , original image x 0 , initial θ 0 . 2: for t = 0, 1, 2, . . . , T do 3:

Randomly choose u t from a zero-mean Gaussian distribution 4:

Evaluate g(θ t ) and g(θ t + βu) using Algorithm 1

5: Compute ĝ = g(θ t + βu) -g(θ t ) β • u 6: Update θ t+1 = θ t -η t ĝ 7: return x 0 + g(θ T )θ T

where u is a random Gaussian vector, and β > 0 is a smoothing parameter (we set β = 0.005 in all our experiments). The solution is then updated by θ ← θ -ηĝ with a step size η. The procedure is summarized in Algorithm 2. Also, if g(θ) is Lipschitz-smooth, we are able to bound the number of iterations needed with O( d δ 2 ) for our algorithm to achieve stationary points. See the appendix for details.

3.3.1. IMPLEMENTATION DETAILS:

There are several implementation details when we apply this algorithm. First, for high-dimensional problems, we found the estimation in ( 7) is very noisy. Therefore, instead of using one vector, we sample q vectors from Gaussian distribution and average their estimators to get ĝ. We set q = 20 in all the experiments. Second, instead of using a fixed step size (suggested in theory), we use a backtracking line-search approach to find step size at each step. This leads to additional query counts, but makes the algorithm more stable and eliminates the need to hand-tuning the step size. Third, instead of using a random direction θ as initialization, we sample t vectors from Gaussian distribution and choose the one with smallest g(θ) as our initialization. It helps us to find a good initialization direction and thus get a smaller distortion in the end with limited number of additional queries. We set t = 100 in all the experiments.

4. EXPERIMENTAL RESULTS:

We test the performance of our hard-label black-box attack algorithm on convolutional neural network (CNN) models and compare with Boundary attack (Brendel et al., 2017) , Limited attack (Ilyas et al., 2018) and a random trail baseline. Furthermore, we show our method can be applied to attack Gradient Boosting Decision Tree (GBDT) and present some interesting findings.

4.1. ATTACKING CNN IMAGE CLASSIFICATION MODELS:

We use three standard datasets: MNIST (LeCun et al., 1998) , CIFAR-10 (Krizhevsky, 2009) and ImageNet-1000 (Deng et al., 2009) . To have a fair comparison with previous work, we adopt the same networks used in both Carlini & Wagner (2017) and Brendel et al. (2017) . In detail, both MNIST and CIFAR use the same network structure with four convolution layers, two max-pooling layers and two fully-connected layers. Using the parameters provided by Carlini & Wagner (2017) , we could achieve 99.5% test accuracy on MNIST and 82.5% test accuracy on CIFAR-10, which is similar to accuracy reported in Carlini & Wagner (2017) . For Imagenet-1000, we use the pretrained network Resnet-50 (He et al., 2016) and Inception-V3 (Szegedy et al., 2016) provided by torchvision1 , which could achieve 76.15% and 77.45 % top-1 test accuracy respectively. For simplicity, all images are normalized into [0, 1] d scale. All models are trained using Pytorch and our source code is publicly available2 .

We include the following algorithms for comparisons in attacking performance:

• Opt-based black-box attack (Opt-attack): our proposed algorithm.

• Boundary black-box attack (Brendel et al., 2017) • Limited black-box attack (Ilyas et al., 2018) (Limited-attack): previous work on targeted blackbox attack in L ∞ distance constraint in the hard-label setting. We use the authors' implementation and the parameters provided in Github4 . • C&W white-box attack (Carlini & Wagner, 2017) : one of the current state-of-the-art attacking algorithm in the white-box setting. We do binary search on parameter c per image to achieve the best performance. Attacking in the white-box setting is a much easier problem, so we include C&W attack just for reference and indicate the best performance we can possibly achieve. • Random distortion: we use 300,000 and 480,000 i.i.d random directions as the baseline. We note that while all other methods could achieve 100 % attack success rate (ASR), the ASR of random distortion appears to be quite low.

For all the cases except Limited-attack, we conduct adversarial attacks for randomly sampled N = 100 images from validation sets. Note that all three attacks (Opt-attack, Boundary-attack, C&W attack) have 100% successful rates, and we report the average L 2 distortion, defined by

1 N N i=1 x (i) -x (i) 0 2

, where x (i) is the adversarial example constructed by an attack algorithm and x (i) 0 is the original i-th example. For black-box attack algorithms, we also report average and median number of queries for comparison. To compare with Limited-attack, we randomly sampled 50 images and report targeted ASR with average and median number of queries when limiting L ∞ distortion to be 0.3 and 0.15 for ImageNet dataset. We also restrict the maximum number of queries to be 1,000,000 for all attacks.

4.1.1. UNTARGETED ATTACK:

For untargeted attack, the goal is to turn a correctly classified image into any other label. The results are presented in Table 1 . Note that for both Opt-attack and Boundary-attack, by changing the stopping conditions we can attain different distortions by varying the number of queries.

First, we compare Boundary-attack and the proposed Opt-attack in Table 1 and Table 5 in appendix. Our algorithm consistently achieves smaller distortion with less number of queries than Boundaryattack. For example, on MNIST data, we are able to reduce the number of queries by 3-4 folds, and Boundary-attack converges to worse solutions in all the 3 datasets. In addition, we include the average L2 norm distortion plot with different query budgets in Figure 5 (a) in appendix. And our method consistently outperforms the Boundary-attack and achieves nearly 2x speedup on both datasets.

Compared with C&W attack, we found black-box attacks attain slightly worse distortion on MNIST and CIFAR. This is reasonable because white-box attack has much more information than black-box attack and is strictly easier. We note that the experiments in Brendel et al. (2017) conclude that C&W and Boundary-attack have similar performance because they only run C&W attack with a single regularization parameter c, without doing binary search to obtain the optimal parameter. For ImageNet, since we constraint the number of queries, the distortion of black-box attacks is much worse than C&W attack. The gap can be reduced by increasing the number of queries as showed in Figure 5 (b) in appendix.

4.1.2. TARGETED ATTACK:

The results for targeted attack is presented in Table 2 and Table 5 in appendix. Following the experiments in Brendel et al. (2017) , for each randomly sampled image with label i we set target label t = (i + 1) module 10. On MNIST, we found our algorithm is more than 4 times faster (in terms of number of queries) than Boundary-attack and converges to a better solution. On CIFAR, our algorithm has similar efficiency with Boundary-attack at the first 60,000 queries, but converges to a slightly worse solution. Also, we show an example quality comparison from the same starting point to the original sample in Figure 4 . And we also include some adversarial example in Figure 4 .

For attacks in L ∞ norm constraint, we conduct experimental comparisons with Limited-attack5 . the results are shown in Table 3 . In the cases of an L ∞ constraint ∈ {0.15, 0.3}, our Opt-attack roughly halves the average number of queiries relative to Limited-attack. In addition, our ASR is 40% higher than Limited-attack when = 0.15. To evaluate our method's ability to attack models with discrete decision functions, we conduct our untargeted attack on gradient booting decision tree (GBDT). In this experiment, we use two standard datasets: HIGGS (Baldi et al., 2014) for binary classification and MNIST (LeCun et al., 1998) for multi-class classification. We use popular LightGBM framework to train the GBDT models and use suggested parameters in https://github.com/Koziev/MNIST_Boosting. To be more specific, for MNIST model, it has 100 trees and the max number of leaves in each tree is 100. For Higgs model, it has 255 trees and the max number of leaves in each tree is 500. And we don't limit the max depth on both models. We could achieve 0.8457 AUC for HIGGS and 98.09% accuracy for MNIST. The results of untargeted attack on GBDT are given in Table 4 .

As shown in Table 4 , by using around 30K queries, we could get a small distortion on both datasets, which firstly uncovers the vulnerability of GBDT models. Tree-based methods are well-known for its good interpretability. And because of that, they are widely used in the industry. However, we show that even with good interpretability and a similar prediction accuracy with convolution neural network, the GBDT models are vulnerable under our Opt-attack. This result raises a question about tree-based models' robustness, which will be an interesting direction in the future.

5. CONCLUSION:

In this paper, we propose a generic and optimization-based hard-label black-box attack algorithm, which can be applied to discrete and non-continuous models other than neural networks, such as the gradient boosting decision tree. Our method enjoys query-efficiency and has a theoretical convergence guarantee on the attack performance under mild assumptions. Moreover, our attack achieves smaller or similar distortion using 3-4 times less queries compared with the state-of-the-art algorithms.

ACKNOWLEDGEMENT:

We acknowledge the support by NSF IIS1719097, Intel faculty award, Google Cloud and AITRICS.

6. APPENDIX:

6.1 MEDIAN RESULT 

6.4. THEORETICAL ANALYSIS:

If g(θ) can be computed exactly, it has been proved in Nesterov & Spokoiny (2017) that RGF in Algorithm 2 requires at most O( d δ 2 ) iterations to converge to a point with ∇g(θ) 2 ≤ δ 2 . However, in our algorithm the function value g(θ) cannot be computed exactly; instead, we compute it up to -precision, and this precision can be controlled by binary threshold in Algorithm 1. We thus extend the proof in Nesterov & Spokoiny (2017) to include the case of approximate function value evaluation, as described in the following theorem.

Theorem 1 In Algorithm 2, suppose g has Lipschitz-continuous gradient with constant L 1 (g) and g * (optimal value) is finite. If the error of function value evaluation is controlled by = O(βδ 2 ) and β ≤ δ dL1(g) , then in order to obtain 1

N +1 N k=0 E U k ( ∇g(θ k ) 2 ) ≤ δ 2 , the upper bound of total number of iterations is O( d δ 2 ).

Note that the binary search procedure could obtain the desired function value precision in O(log δ) steps. By using the same idea with Theorem 1 and following the proof in Nesterov & Spokoiny (2017) , we could also achieve O( d 2 δ 3 ) complexity when g(θ) is non-smooth but Lipschitz continuous. Because there is a stopping criterion in Algorithm 1, we couldn't achieve the exact g(θ). Instead, we could get g with error, i.e., g(θ) -≤ g(θ) ≤ g(θ) + . Also, we define ĝ(θ) = g(θ+βu)-g(θ) β • u to be the noise gradient estimator.

Following Nesterov (2011) , we define the Guassian smoothing approximation over g(θ), i.e,

EQUATION

Also, we have the upper bounds for the moments

EQUATION

6.5 PROOF OF THEOREM 1 Suppose f has a lipschitz-continuous gradient with constant L 1 (g), then

|g(y) -g(x) -∇g(x), y -x | ≤ 1 2 L 1 (g)||x -y|| 2 (11) We could bound E u (||ĝ(θ)|| 2 ) as follows, Since (g(θ + βu) -g(θ)) 2 = [g(θ + βu) -g(θ) -β ∇g(θ), u + β ∇g(θ), u ] 2 ≤ 2(g(θ + βu) -g(θ) + θ+βu -θ -β ∇g(θ), u ) 2 + 2β 2 ∇g(θ), u 2 (12) Because | θ+βu -θ | ≤ 2 , [g(θ + βu) -g(θ)] 2 ≤ 2( β 2 2 L 1 (g)||u|| 2 ) 2 + 4β 2 L 1 (g)||u|| 2 + 8 2 + 2β 2 ∇g(θ), u 2 (13)

Take expectation over u, and with Theorem 3 in Nesterov (2011), which is Therefore, since g β (θ) has Lipshcitz-continuous gradient:

E u (||g (θ, u) • u|| 2 ) ≤ (d + 4)||∇g(θ)|| 2 E u (||ĝ(θ)|| 2 ) ≤ β 2 2 L 2 1 (g)E u (||u|| 6 ) + 2E u (

|g β (θ k+1 ) -g β (θ k ) + α ∇g β (θ k ), ĝβ (θ k ) | ≤ 1 2 α 2 L 1 (g β )||ĝ β (θ k )|| 2 (18) So that g β (θ k+1 ) ≤ g β (θ k ) -α ∇g β (θ k ), ĝβ (θ k ) + 1 2 α 2 L 1 (g β )||ĝ β (θ k )|| 2 (19) Since E u (ĝ(θ k )) = 1 κ E g(θ + βu) -g(θ) + θ+βu -θ β ue -1 2 ||u|| 2 du = ∇g β (θ k ) + 1 κ E θ+βu -θ β ue -1 2 ||u|| 2 du ≤ ∇g β (θ k ) + 2 β n 1/2 • 1 (20)

where 1 is a all-one vector. Taking the expectation in u k , we obtain (22) Since (d + 5) 3 ≤ (d + 8)(d + 4) 2 , taking expectation over U k , where U k = {u 1 , u 2 , . . . , u k }, we get

E u k (g β (θ k+1 )) ≤ g β (θ k ) -α k ||∇g β (θ k )|| 2 + α k ∇g β (θ k ), 2 β d 1/2 • 1 + 1 2 α 2 k L 1 (g β )E u k ||ĝ β (θ k )|| 2 E u k (g β (θ k+1 )) ≤ g β (θ k ) -α k ||∇g β (θ k )|| 2 + α k 2 β n 1/

φ k+1 ≤ φ k - 1 2 αE U k (||∇g β (θ k )|| 2 )+ 3β 2 (d + 8) 64 L 1 (g)+ β 8 δ 2 + d 4(d + 4) 2 L 1 (g) δ 4 +αd 1/2 E U k (||∇g β (θ k )||)δ 2

(23) Where φ k = E U k-1 (g(θ k )) , k ≥ 1 and φ 0 = g(θ 0 ).

Assuming g(x) ≥ g * , summing over k and divided by N+1, we get 

1 N + 1 N k=0 E U k (||∇g β (θ k )|| 2 ) ≤ 8(d + 4)L 1 (g)[ g(x 0 ) -g * N + 1 + 3β 2 (d + 8) 16 L 1 (g) + β 8 δ 2 + d 4(d + 4) 2 L 1 (g) δ 4 + 1 N + 1 N k=0 E U k (||∇g β (θ k )||)δ 2 ] (24) Clearly, 1 N +1 N k=0 E U k (||∇g β (θ k )||) ≤ δ 2 . Since ϑ 2 k = E U k (||∇g(θ k )|| 2 ) ≤ 2E U k (||∇g β (θ k )|| 2 ) + β 2 (d+4) 2 2 L 2 1 (g),

:

https://github.com/pytorch/vision/tree/master/torchvision

https://github.com/LeMinhThong/blackbox-attack

https://github.com/bethgelab/foolbox

https://github.com/labsix/limited-blackbox-attacks

Note that there's a bug in the original version of(Ilyas et al., 2018) for counting number of queries, which makes the reported number of queries less than they actually used. We use their modified version in our experiments, which has fixed this bug.

Figures and Tables:

Figure 1: (a) A neural network classifier. (b) illustrates the loss function of C&W attack, which is continuous and hence can be easily optimized. (c) is the C&W loss function in the hard-label setting, which is discrete and discontinuous. (d) our proposed attack objective g(θ) for this problem, which is continuous and easier to optimize. See detailed discussions in Section 3.

Figure 2: Illustration

Figure 3: Examples of decision boundary of classification function f (x) and corresponding g(θ).

right ← v mid 18: return v right 3.2 HARD-LABEL BLACK-BOX ATTACKS WITH L ∞ NORM CONSTRAINT

Figure 4: (a)(b): Example quality comparison between targeted Opt-attack and Boundary-attack . Opt-attack can achieve a better result with less queries. (c)(d): Some adversarial examples generated by Opt-attack . From initialization image (left), through several number of model queries, we could generate a adversarial example very close to original image (right).

Figure 5: Left:Log distortion comparison of Boundary-attack (solid curves) vs Opt-attack (dotted curves) over number of queries for 6 different images. Right: Average L2-distortion versus number of queries plot.

Results for (L 2 -norm based) untargeted attacks. ASR stands for Attack Success Rate.

Table content: <table><tr><td/><td colspan="2">MNIST</td><td>CIFAR10</td><td/><td colspan="2">Imagenet (ResNet-50)</td></tr><tr><td/><td>Avg L 2</td><td># queries</td><td>Avg L 2</td><td># queries</td><td>Avg L 2</td><td># queries</td></tr><tr><td>Boundary-attack</td><td>1.1222 1.1087</td><td>60,293 143,357</td><td>0.1575 0.1501</td><td>123,879 220,144</td><td>5.9791 3.7725</td><td>123,407 260,797</td></tr><tr><td>Opt-attack</td><td>1.188 1.049</td><td>22,940 51,683</td><td>0.2050 0.1625</td><td>40,941 77,327</td><td>6.9796 4.7100</td><td>71,100 127,086</td></tr><tr><td/><td>1.011</td><td>126,486</td><td>0.1451</td><td>133,662</td><td>3.1120</td><td>237,342</td></tr><tr><td>C&amp;W (white-box)</td><td>0.9921</td><td>-</td><td>0.1012</td><td>-</td><td>1.9365</td><td>-</td></tr><tr><td colspan="7">Random distortion 1.0(2% ASR) 300,000 0.15(10% ASR) 300,000 3.11(0% ASR) 480,000</td></tr></table>

Results of (L 2 -norm based) targeted attack.

Table content: <table><tr><td/><td colspan="2">MNIST</td><td colspan="2">CIFAR10</td></tr><tr><td/><td colspan="4">Avg L 2 # queries Avg L 2 # queries</td></tr><tr><td/><td>2.3158</td><td>30,103</td><td>0.2850</td><td>55,552</td></tr><tr><td>Boundary-attack (black-box)</td><td>2.0052</td><td>58,508</td><td>0.2213</td><td>140,572</td></tr><tr><td/><td>1.8668</td><td>192,018</td><td>0.2122</td><td>316,791</td></tr><tr><td/><td>1.8522</td><td>46,248</td><td>0.2758</td><td>61,869</td></tr><tr><td>Opt-attack (black-box)</td><td>1.7744</td><td>57,741</td><td>0.2369</td><td>141,437</td></tr><tr><td/><td>1.7114</td><td>73,293</td><td>0.2300</td><td>186,753</td></tr><tr><td>C&amp;W (white-box)</td><td>1.4178</td><td>-</td><td>0.1901</td><td>-</td></tr></table>

Results of targeted attacks in L ∞ constraint. ASR stands for Attack Success Rate.

Table content: <table><tr><td/><td/><td colspan="2">ImageNet (Inception V3)</td></tr><tr><td/><td>ASR</td><td colspan="2">Avg queries Median queries</td></tr><tr><td>Opt-attack</td><td>0.30 100 % 0.15 90%</td><td>167,080 310,952</td><td>119,925 183,217</td></tr><tr><td>Limited-attack</td><td>0.30 100 % 0.15 50%</td><td>436,561 896,558</td><td>295,918 981,272</td></tr></table>

Results of (L 2 -norm based) untargeted attack on gradient boosting decision tree.

Table content: <table><tr><td/><td colspan="2">HIGGS</td><td colspan="2">MNIST</td></tr><tr><td/><td colspan="4">Avg L 2 # queries Avg L 2 # queries</td></tr><tr><td/><td>0.3458</td><td>4,229</td><td>0.6113</td><td>5,125</td></tr><tr><td>Opt-attack</td><td>0.2179</td><td>11,139</td><td>0.5576</td><td>11,858</td></tr><tr><td/><td>0.1704</td><td>29,598</td><td>0.5505</td><td>32,230</td></tr></table>

Results of median L2 distortion on different attack methods.

Table content: <table><tr><td/><td>Type</td><td colspan="6">MNIST Median L 2 # queries Median L 2 # queries Median L 2 # queries CIFAR10 Imagenet (ResNet-50)</td></tr><tr><td>Boundary-attack</td><td>Untargeted Targeted</td><td>1.0832 1.8004</td><td>142,686 171,151</td><td>0.1359 0.1962</td><td>235,285 314,839</td><td>2.7879 -</td><td>261,258 -</td></tr><tr><td>Opt-attack</td><td>Untargeted Targeted</td><td>1.0206 1.7375</td><td>127,077 72,318</td><td>0.1344 0.2020</td><td>159,276 158,438</td><td>2.0687 -</td><td>246,755 -</td></tr><tr><td colspan="6">6.2 RESULTS ON DIFFERENT NUMBER OF SAMPLE DIRECTIONS u t</td><td/><td/></tr></table>

Results of average L2 distortion on different number of sample directions ut. MNIST # of directions u t Average L 2 Average # queries Median L 2 Median # queries

Table content: <table><tr><td>Opt-attack</td><td>1 5</td><td>2.0525 1.0550</td><td>9,820 59,901</td><td>2.0188 1.0639</td><td>8,093 56,890</td></tr><tr><td/><td>10</td><td>1.0345</td><td>63,652</td><td>1.0420</td><td>62,209</td></tr><tr><td/><td>15</td><td>1.0257</td><td>71,045</td><td>1.0256</td><td>73,227</td></tr><tr><td/><td>20</td><td>1.0112</td><td>126,486</td><td>1.0206</td><td>127,077</td></tr><tr><td/><td>25</td><td>1.0098</td><td>146,516</td><td>1.0117</td><td>145,862</td></tr><tr><td>6.3 L</td><td/><td/><td/><td/><td/></tr></table>

||g (θ, u) • u|| 2 ) + 4L 1 (g) E u (||u|| 4 ) + 8 O(δ 2 β), we could bound E u (||g(θ)|| 2 ) E u (||ĝ(θ)|| 2 ) ≤ β 2 2 L 2 1 (g)(d + 6) 3 + 2(d + 4)||∇g(θ)|| 2 + 4βL 1 (g)(d + 4) 2 δ 2 + 8dδ 4 (15) And with ||∇g(θ)|| 2 ≤ 2||∇g β (θ)|| 2 + Which is proved in Nesterov (2011) Lemma 4.Therefore, since (n + 6) 3 + 2(n + 4) 3 ≤ 3(n + 5) 3 , we could getE u (||ĝ(θ)|| 2 ) ≤ β 2 2 L 2 1 (g)(d + 6) 3 + 2(d + 4)||∇g(θ)|| 2 + 2(d + 4)||∇g(θ)|| 2 + 4βL 1 (g)(d + 4) 2 δ 2 + 8dδ 4

Table content: <table><tr><td/><td>≤</td><td colspan="2">β 2 2</td><td colspan="3">L 2 1 (g)(d + 6) 3 + 2(d + 4)(2||∇g β (θ)|| 2 +</td><td>β 2 2</td><td>L 2 1 (g)(d + 4) 2 )</td><td>(17)</td></tr><tr><td/><td colspan="5">+ 4βL 1 (g)(d + 4) 2 δ 2 + 8dδ 4</td></tr><tr><td/><td colspan="4">≤ 4(d + 4)||∇g β (x)|| 2 +</td><td>3β 2 2</td><td>L 2 1 (g)(d + 5) 3 + 4βL 1 (g)(d + 4) 2 δ 2 + 8dδ 4</td></tr><tr><td/><td/><td/><td/><td/><td/><td>2</td></tr><tr><td/><td/><td/><td/><td/><td/><td>β 2 E u (||u|| 2 )</td></tr><tr><td>≤</td><td colspan="2">β 2 2</td><td colspan="4">L 2 1 (g)(d + 6) 3 + 2(d + 4)||∇g(θ)|| 2 + 4 L 1 (g)(d + 4) 2 + 8</td><td>2 β 2 d</td></tr><tr><td/><td/><td/><td/><td/><td/><td>(14)</td></tr><tr><td colspan="7">With = β 2 2</td><td>L 2 1 (g)(d + 4) 2</td><td>(16)</td></tr></table>

2 ||∇g β (θ k )|| , we obtain E u k (g β (θ k + 1)) ≤ g β (θ k ) -

Table content: <table><tr><td>+ Choosing α k = α = 1 2</td><td colspan="5">α 2 k L 1 (g)(4(d + 4)||∇g β (θ k )|| 2 + 1 4(d+4)L1(g) 1 2 α||∇g β (θ k )|| 2 + α 2 3β 2 2 β d 1/2 ||∇g β (θ k )|| + L 2 1 (g)(d + 5) 3 + 4βL 1 (g)(d + 4) 2 δ 2 + 8dδ 4 ) (21) 3β 2 64 (d + 5) 3 L 1 (g) (d + 4) 2</td></tr><tr><td colspan="2">+</td><td>β 8</td><td>δ 2 +</td><td>d 4(d + 4) 2 L 1 (g)</td><td>δ 4</td></tr></table>

ϑ 2 k is in the same order of E U k (||∇g β (θ k )|| 2 ).In order to get 1

Table content: <table><tr><td>N +1</td><td>N k=0</td><td>ϑ 2 k ≤ δ 2 , we need to choose β ≤</td><td>δ dL1(g) , then N is</td></tr><tr><td>bounded by O( d δ 2 )</td><td/><td/><td/></tr></table>

Peer review (iclr2019):
 This paper proposed a reformulation of objective function to solve the hard-label black-box attack problem. The idea is interesting and the performance of the proposed method seem to be capable of finding adversarial examples with smaller distortions and less queries compared with other hard-label attack algorithms. This paper is well-written and clear. ============================================================================================== Questions A. Can it be proved the g(theta) is continuous? Also, the theoretical analysis assume the property of Lipschitz-smooth and thus obtain the complexity of number of queries. Does this assumption truly hold for g(theta), when f is a neural network classifiers? If so, how to obtain the Lipschitz constant of g that is used in the analysis sec 6.3? B. What is the random distortion in Table 1? What initialization technique is used for the query direction in the experiments? C. The GBDT result on MNIST dataset is interesting. The authors should provide tree models description in 4.1.3. However, on larger dataset, say imagenet, are the tree models performance truly comparable to ImageNet? If the test accuracy is low, then it seems less meaningful to compare the adversarial distortion with that of imagenet neural network classifiers. Please explain. D. For sec 3.2, it is not clear why the approximation is needed. Because the gradient of g with respect to theta is using equation (7) and theta is already given (from sampling); thus the Linf norm of theta is a constant. Why do we need the approximation? Given that, will there be any problems on the L2 norm case?