Meta-Learning the Search Distribution of Black-Box Random Search Based Adversarial Attacks

Maksym Yatsura, Jan Hendrik Metzen, Matthias Hein

Adversarial attacks are the primary tool for stress-testing the robustness of neural networks. While white-box attacks (which have full access to model gradients) are powerful, they are often thwarted by "gradient obfuscation"—defenses that break the gradient signal without actually removing adversarial vulnerabilities. This has led to the rise of black-box random search attacks, like the popular Square Attack, which rely on sampling perturbations rather than calculating gradients.

However, these random search attacks typically rely on manually tuned, fixed schedules for their search parameters. In their NeurIPS 2021 paper, Yatsura et al. propose Meta Square Attack (MSA), a framework that uses meta-learning to replace these heuristics with learned, adaptive controllers.

TL;DR

Meta Square Attack (MSA) replaces the manual heuristics of black-box adversarial attacks with learned controllers that adapt the search distribution online. By meta-training on a single white-box model, the authors create an attack that generalizes across different architectures and datasets, improving robustness evaluation by up to 20% in query-limited settings.

What Problem Does This Paper Address?

The effectiveness of random search attacks like Square Attack (SA) depends heavily on two factors: the update size (how large the square perturbation is) and the color sampling (which color the square takes).

Existing methods use fixed, hand-designed schedules for these parameters. For example, the original Square Attack halves the update size at specific percentages of the total query budget. These schedules are "blind"—they don't adapt to the specific image being attacked or the feedback from previous queries. If a specific query budget is small, or if a model is particularly resistant to large updates, these fixed schedules become highly suboptimal.

Methods

The authors frame the optimization of the attack's search distribution as a meta-learning problem. Instead of a fixed schedule, they use small Multi-Layer Perceptrons (MLPs) to act as controllers for the update size and color distribution.

The Controllers

  • Update Size Controller ($\pi^s$): Takes the current query count and the recent success rate of the attack as input to predict the optimal square size for the next step.
  • Color Controller ($\pi^c$): Learns a categorical distribution over the corners of the RGB cube, favoring colors that have historically led to higher loss increases.

Meta-Training

To train these controllers, the authors use a gradient-based end-to-end approach. Because the standard Square Attack involves discrete sampling (which is non-differentiable), they introduce two key relaxations:

  1. Square Relaxation: A differentiable interpolation method for squares with non-integer sizes (illustrated in Figure 6).
  2. Gumbel-Softmax: Used to differentiate through the categorical color selection.
Illustration of the differentiable square relaxation used during meta-training.

Crucially, they use a "greedy" meta-objective: the controllers are trained to maximize the immediate increase in loss at the next step, which avoids the vanishing gradient problems common in long attack trajectories.

Datasets

  • Training: The controllers were meta-trained using only 1,000 images from the CIFAR10 training set on a single robust ResNet-18 model.
  • Evaluation: The learned controllers were tested on a wide variety of models from the RobustBench zoo, as well as the CIFAR100 and ImageNet datasets to test generalization.

Key Insights and Ideas

  • Online Adaptation is Key: Unlike fixed schedules, MSA looks at the "success frequency" of recent queries. If the attack is stalling, the controller can dynamically shrink the update size to find finer-grained adversarial features.
  • Universal Search Principles: A major "aha" moment is that a controller trained on a tiny ResNet-18 on CIFAR10 transfers almost perfectly to massive WideResNet models and even entirely different datasets like ImageNet. This suggests that the logic of how to efficiently search for adversarial examples is somewhat universal across vision models.
  • Non-Uniform Color Preference: While standard attacks sample colors uniformly, the learned controller discovered a clear preference for sampling black and white corners more frequently, which significantly boosted efficiency.

Key Results

The authors compared MSA against the original Square Attack (SA) and the version used in AutoAttack (AA).

  • Significant Gains: MSA consistently outperformed the baselines, especially in low-query regimes (500–1000 queries), where it improved the robust accuracy estimate by up to 20%.
  • Superior Loss Maximization: As shown in Figure 1, MSA reaches much higher loss values faster than the baselines, indicating a more efficient search path.
Comparison of update size schedules and loss maximization. MSA (green) adapts its size per-image and achieves higher loss than fixed baselines.
  • Generalization: The attack remained effective when transferred to CIFAR100 and ImageNet, and even when switched from untargeted to targeted attack settings.

Limitations and Future Work

  • White-Box Requirement for Training: While the final attack is black-box, the meta-training phase requires white-box access to at least one representative model to compute gradients for the controllers.
  • Fixed Positions: Currently, the controllers only manage size and color. The authors suggest that meta-learning the spatial distribution (where to place the squares) could further improve performance.
  • Geometric Primitives: The attack is still restricted to "squares." Future work could explore learning more complex geometric primitives for the perturbations.

Overall, this work demonstrates that even "random" search can benefit immensely from the adaptive intelligence provided by meta-learning.

Summary updated

BibTeX
@inproceedings{yatsura2021meta,
  author = {Maksym Yatsura and Jan Hendrik Metzen and Matthias Hein},
  title = {{Meta-Learning the Search Distribution of Black-Box Random Search Based Adversarial Attacks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=a9WXj5XV5mK},
}
Figure