Switching Gradient Directions for Query-Efficient Black-Box Adversarial Attacks

Chen Ma, Shuyu Cheng, Li Chen, Junhai YongarXiv 2020

Introduction

Generating adversarial examples against black-box AI models typically requires thousands of queries to estimate gradients, making them impractical for real-world systems with strict rate limits. This paper introduces SWITCH, a remarkably simple yet effective attack strategy. By leveraging the gradient of a local "surrogate" model and simply flipping its direction when it fails to increase the attack loss, SWITCH achieves state-of-the-art success rates with unprecedented query efficiency.

The Challenge of Black-Box Attacks

In a black-box scenario, attackers lack access to the target model's internal weights and must rely solely on output scores. Existing approaches generally fall into three categories:

  1. Gradient Estimation: Methods like Random Gradient-Free (RGF) query the model thousands of times to estimate gradients, which is slow and easily detected.
  2. Random Search: These are query-efficient but ignore structural information, leading to slow optimization.
  3. Transfer-based Attacks: These use a local surrogate model's gradient. While query-free, they often fail because the surrogate's gradient may not align with the target model's loss landscape.

The authors address a core question: How can we exploit surrogate gradients, correct them when they are misaligned, and minimize target model queries to an absolute minimum?

The SWITCH Algorithm

The core of the proposed method is the assumption that Deep Neural Networks (DNNs) are locally approximately linear. If moving in the direction of a surrogate gradient $\hat{g}$ decreases the loss, moving in the opposite direction $-\hat{g}$ is likely to increase it.

Base SWITCH

In each iteration, the attacker takes a step along the surrogate gradient $\hat{g}$. If the target model's loss increases, the step is accepted. If not, the algorithm "switches" to the exact opposite direction $-\hat{g}$. This logic ensures a maximum of only 2 queries per iteration.

SWITCH$_{RGF}$ Extension

To prevent the attack from stalling when both $\hat{g}$ and $-\hat{g}$ fail, the authors introduce a fallback mechanism. If neither direction works, the algorithm employs a batch of queries to perform a standard RGF estimation, ensuring the optimization continues toward a successful adversarial example.

The SWITCH and SWITCH_RGF attack pipeline, illustrating the decision logic for gradient direction selection and the fallback RGF mechanism.

Experimental Evaluation

The authors evaluated SWITCH on CIFAR-10, CIFAR-100, and TinyImageNet against seven state-of-the-art query-based attacks, including Bandits, SignHunter, and Square Attack.

Key Results

  • Unmatched Efficiency: In untargeted $L_2$ attacks on CIFAR-10, the base SWITCH algorithm achieved a >90% success rate with a median of just 14 to 67 queries—orders of magnitude fewer than competing methods.
  • Dominance in Low-Budget Scenarios: SWITCH significantly outperforms other methods when the query budget is restricted (e.g., < 1,000 queries), making it particularly dangerous for API-based models with rate limits.
  • Robustness Against Defenses: Interestingly, the base SWITCH algorithm often outperformed its RGF-augmented version against defensive models like ComDefend, as RGF is more susceptible to "obfuscated gradients" introduced by such defenses.
Attack success rate vs. maximum query number threshold for various methods on the PyramidNet-272 model (CIFAR-10). SWITCH variants show rapid initial convergence compared to traditional estimation methods.

Conclusion

SWITCH demonstrates that complex gradient estimation isn't always necessary for effective black-box attacks. By simply checking a surrogate gradient and its negation, attackers can achieve high success rates with minimal queries. While the base algorithm can plateau if it gets stuck, the SWITCH$_{RGF}$ variant provides a robust path to near 100% success. This work sets a new, simple, and strong baseline for future research into query-efficient adversarial attacks.

Summary updated

BibTeX
@misc{ma2020switching,
  author = {Chen Ma and Shuyu Cheng and Li Chen and Junhai Yong},
  title = {{Switching Gradient Directions for Query-Efficient Black-Box Adversarial Attacks}},
  year = {2020},
  eprint = {2009.07191},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.07191},
}
Figure