Improving Black-box Adversarial Attacks with a Transfer-based Prior

Shuyu Cheng, Yinpeng Dong, Tianyu Pang, Hang Su, Jun Zhu

TL;DR

Zeroth-order black-box adversarial attacks require thousands of queries to estimate gradients, while transfer-based attacks from surrogate models often fail to achieve high success rates. This paper introduces Prior-Guided Random Gradient-Free (P-RGF), a framework that analytically fuses surrogate model gradients with query feedback. By deriving an optimal, closed-form weighting factor between prior knowledge and random sampling, P-RGF cuts query costs significantly while boosting attack success rates on both standard and defended models.

What Problem Does This Paper Address?

Deep neural networks are vulnerable to adversarial perturbations—subtle input changes that cause misclassification. In real-world "black-box" threat models, attackers cannot access the model’s internal parameters or analytical gradients:

  1. Transfer-based attacks craft perturbations on a local surrogate model and hope they transfer to the target. These require zero target queries but often suffer from mediocre attack success rates.
  2. Query-based attacks numerically estimate gradients by perturbing inputs and measuring changes in the target model's output loss. In high-dimensional spaces (like ImageNet, where $D \approx 270,000$), standard zeroth-order estimators require thousands of queries to find an adversarial example.

The authors tackle the challenge of combining the high accuracy of query-based attacks with the "free" prior directional guidance provided by transfer-based attacks.

Methods

The paper introduces the Prior-Guided Random Gradient-Free (P-RGF) method:

  • Direction-Focused Loss Objective: Instead of standard squared error on gradient magnitudes, the authors define an objective invariant to scalar magnitude, optimizing purely for gradient direction alignment (crucial for normalized projected gradient descent).
  • Prior-Biased Sampling: In standard Random Gradient-Free (RGF) methods, search directions $u_i$ are sampled uniformly over a unit hypersphere. P-RGF constructs a covariance matrix $C$ that biases random search vectors toward the normalized surrogate gradient $v$ using a mixture parameter $\lambda \in [0, 1]$.
  • Analytically Optimal Weight ($\lambda^*$): Rather than tuning $\lambda$ as an arbitrary hyperparameter, the authors theoretically derive a closed-form solution for the optimal $\lambda^*$ based on the cosine similarity $\alpha$ between the surrogate gradient and the true gradient, the query budget per iteration $q$, and the input dimension $D$.
  • Online Cosine Similarity Estimation: To compute $\lambda^*$ on the fly, P-RGF estimates the gradient norm using finite differences across a small auxiliary set of random vectors ($S=10$), updating only once every 10 iterations to conserve queries.
  • Combining Priors: The framework naturally accommodates other structural priors, such as data-dependent priors (restricting search vectors to low-frequency image subspaces via downsampling/upsampling).
Surrogate Gradient (v) ──┐
                         ├──> Compute optimal λ* ──> Biased Direction Sampling (u_i) ──> Query-Efficient Attack
Target Loss Queries   ──┘

Datasets

  • Evaluation Benchmark: 1,000 randomly sampled validation images from the ImageNet classification dataset ($299 \times 299 \times 3$ input resolution).
  • Models Evaluated: Standard architectures including Inception-v3, VGG-16, and ResNet-50 (with ResNet-152 serving as the surrogate model).
  • Defended Models: Target models protected by JPEG compression, input randomization, and high-level representation guided denoisers.
  • No new datasets were introduced.

Key Insights and Ideas

  • Dynamic Prior Decay: Early in an attack, the surrogate gradient aligns relatively well with the target model gradient (high $\alpha$), so $\lambda^*$ is large and query budgets are saved. As the adversarial image moves away from the natural data manifold, surrogate alignment diminishes, and the algorithm automatically decays $\lambda^*$ to rely more heavily on zeroth-order random sampling.
  • Zero-Query Shortcut: If the theoretical condition $\alpha^2 \ge \frac{2q-1}{D+2q-2}$ holds, the optimal $\lambda^* = 1$. The algorithm skips zeroth-order sampling entirely and directly takes a step along the surrogate gradient, saving $q$ queries in that step.
  • Orthogonality of Priors: Transfer-based priors (knowing roughly which global direction to move) and data-dependent priors (knowing that natural image perturbations live in a lower-dimensional subspace) complement each other without interference. Combining both yields the highest efficiency.

Key Results

  • Standard Models ($\ell_2$ norm): On Inception-v3, baseline RGF requires 1,309 queries for a 97.7% attack success rate (ASR). P-RGF reduces queries to 745 (98.1% ASR). Combining transfer priors with data-dependent priors ($\text{P-RGF}_\text{D}$) further drops queries to 649 (99.1% ASR).
  • Outperforming State-of-the-Art: On ResNet-50, $\text{P-RGF}_\text{D}$ needed only 352 queries (99.6% ASR), outperforming NES (969 queries, 98.4% ASR) and AutoZoom (2,065 queries, 94.8% ASR).
  • Defended Models: Against randomized input defense, P-RGF achieved 60.4% ASR with 2,153 queries, compared to standard RGF’s 19.5% ASR with 3,259 queries. Combining with subspace priors ($\text{P-RGF}_\text{D}$) pushed defense success rates to 81–89%, representing a 20% to 40% margin over existing baselines.

Limitations and Future Work

  • Score-Based Requirement: The method requires access to continuous loss/probability outputs from the target model. It is not directly applicable to hard-label (decision-only) black-box settings without adaptation.
  • Surrogate Dependency: The efficiency gains heavily depend on having a surrogate model with non-trivial feature alignment ($\alpha > 0$). If the surrogate gradient is completely orthogonal or adversarial to the true gradient, $\lambda^*$ collapses to near-zero, falling back to standard RGF.
  • Future Directions: Extending optimal prior-guided sampling to decision-based (label-only) black-box attacks and exploring domain-specific priors for non-vision modalities (e.g., text and audio).

Summary updated

BibTeX
@inproceedings{cheng2019improving,
  author = {Shuyu Cheng and Yinpeng Dong and Tianyu Pang and Hang Su and Jun Zhu},
  title = {{Improving Black-box Adversarial Attacks with a Transfer-based Prior}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=aXHT62dgSf9},
}
Figure