NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Query-Efficient Hard-label Black-box Attack: An Optimization-based Approach

Minhao Cheng, Thong Le, Pin-Yu Chen, Huan Zhang, Jinfeng Yi, Cho-Jui Hsieh

Introduction

In the landscape of adversarial machine learning, attacks typically assume either complete knowledge of the model (white-box) or access to continuous probability scores (score-based black-box). However, real-world machine learning APIs often restrict outputs to provide only the final predicted class (e.g., "This is a cat").

This paper introduces Opt-attack, a highly query-efficient method for generating adversarial examples in this challenging "hard-label" black-box setting. By reformulating the attack as a continuous, real-valued optimization problem based on the distance to the decision boundary, the authors enable the use of zeroth-order optimization techniques. This approach achieves 3-4x better query efficiency than previous state-of-the-art methods.

The Challenge of Hard-Label Attacks

Attacking hard-label models is notoriously difficult because the standard objective function becomes a non-continuous step function—the attack either succeeds in changing the label, or it doesn't.

Because you cannot calculate a gradient on a step function, traditional optimization techniques fail. Previous attempts to solve this relied on random walks along the decision boundary. These random-walk methods are incredibly slow, require a massive number of queries to the target model, and lack mathematical convergence guarantees.

Comparison of loss landscapes: continuous score-based loss, discontinuous hard-label step function, and the reformulated continuous objective.

Methods: A Boundary-Based Reformulation

The core innovation of Opt-attack is a boundary-based reformulation of the problem. Instead of trying to optimize the image pixels directly to cause a misclassification, the authors optimize the direction of the adversarial perturbation.

Visualizing the distance from the original image to the decision boundary.
  1. The Objective Function ($g(\theta)$): The authors define a function $g(\theta)$ that represents the distance from the original image $x_0$ to the nearest decision boundary in a specific search direction $\theta$.
  2. Restoring Continuity: While the model's output labels are discrete, the distance to the boundary in a given direction is usually continuous. A small change in the direction $\theta$ typically results in a correspondingly small change in the distance to the boundary.
  3. Zeroth-Order Optimization: Because $g(\theta)$ is continuous, the authors can employ a Randomized Gradient-Free (RGF) method. They estimate the gradient by sampling several random directions around the current direction and evaluating how the distance to the boundary changes.
  4. Binary Search: To calculate the actual value of $g(\theta)$ (the distance) using only hard labels, the algorithm uses a coarse-grained search followed by a fine-grained binary search to pinpoint exactly where the model changes its prediction.

Key Insights and Performance

Shifting the search space from "pixel values" to "directions toward the boundary" is the key insight that turns a discrete, intractable problem into a continuous one solvable with standard optimization tools. By averaging multiple random gradient estimates, the algorithm remains stable even in high-dimensional spaces where a single random direction would be too noisy.

The authors evaluated Opt-attack across several standard benchmarks, including MNIST, CIFAR-10, and ImageNet (using ResNet-50 and Inception-V3), yielding impressive results:

  • Query Efficiency: On MNIST, Opt-attack reduced the number of queries required by 3-4x compared to the previous state-of-the-art "Boundary-attack," while simultaneously achieving lower distortion (making the adversarial changes more imperceptible).
  • ImageNet Scalability: The method successfully attacked large-scale models like ResNet-50 on ImageNet within a reasonable query budget. In contrast, previous random-trial methods often failed to converge entirely or required millions of queries.
  • Universal Applicability: Because the attack does not rely on gradients or the internal structure of the model, it is highly versatile. The authors demonstrated this by successfully attacking Gradient Boosting Decision Trees (GBDTs) on the HIGGS dataset. GBDTs are often thought to be robust because they lack gradients for traditional attacks to exploit, yet Opt-attack found adversarial examples within just 30,000 queries.

Limitations and Future Work

While Opt-attack is vastly more efficient than previous black-box attacks, "query-efficient" remains a relative term. The method still requires tens of thousands of queries per image, a volume of traffic that might be flagged by real-world security systems monitoring for unusual API usage.

Additionally, the theoretical convergence guarantees of the algorithm rely on the objective function being "Lipschitz-smooth." While the authors demonstrate this holds true in practice for many models, there may be edge cases in highly complex model landscapes where this assumption breaks down. Finally, the surprising vulnerability of non-continuous models like GBDTs to this optimization-based approach opens a compelling new direction for research into the robustness of tree-based architectures.

Summary updated

BibTeX
@inproceedings{cheng2019query,
  author = {Minhao Cheng and Thong Le and Pin-Yu Chen and Huan Zhang and Jinfeng Yi and Cho-Jui Hsieh},
  title = {{Query-Efficient Hard-label Black-box Attack: An Optimization-based Approach}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
  url = {https://openreview.net/forum?id=9BqgyGV2Eg},
}
Figure