Why adversarial reprogramming works, when it fails, and how to tell the difference

Yang Zheng, Xiaoyi Feng, Zhaoqiang Xia, Xiaoyue Jiang, Ambra Demontis, Maura Pintor, Battista Biggio, Fabio Roli

TL;DR

This paper introduces a first-order linear model to explain why adversarial reprogramming works or fails, showing its success hinges on the average input gradient's size, which is influenced by gradient alignment and input dimensionality. The authors provide extensive experimental validation, offering insights into how to select models and tasks for effective reprogramming.

What Problem Does This Paper Address?

Adversarial reprogramming allows repurposing a pre-trained machine learning model for a new task without retraining. While this has potential for beneficial applications like transfer learning, especially with limited data, the underlying mechanisms driving its success or failure have remained largely unexplained. This lack of understanding makes it difficult to predict when reprogramming will work, when it will fail, and how to distinguish between these scenarios. The paper aims to bridge this gap by developing a theoretical framework and conducting empirical studies to elucidate the factors governing adversarial reprogramming.

Methods

The core of this work is a first-order linear model of adversarial reprogramming. The authors formalize reprogramming as a loss minimization problem and then linearize the loss function. This linearization reveals that the success of reprogramming is primarily determined by the average input gradient. Specifically, a larger average input gradient leads to better reprogramming. This gradient size, in turn, is influenced by two key factors:

  • Gradient Alignment: How aligned the gradients are across different target-domain samples. More aligned gradients lead to a larger average input gradient.
  • Input Dimensionality: Higher dimensional inputs also contribute to a larger average input gradient.

To validate their model, the authors employ an extensive empirical analysis using three different neural network architectures and four datasets, resulting in fourteen distinct reprogramming tasks. They also adapt a Projected Gradient Descent (PGD) algorithm for optimizing the adversarial program.

Datasets

The experimental analysis utilizes the following datasets:

  • ImageNet: A large-scale object recognition dataset, used as a source domain.
  • CIFAR-10: A ten-class image classification dataset.
  • MNIST: A ten-class dataset of handwritten Arabic digits.
  • HCL2000: A large-scale handwritten Chinese character database.

Key Insights and Ideas

  • Gradient Alignment is Crucial: The study strongly suggests that the alignment of input gradients is a primary driver of successful adversarial reprogramming. When gradients are aligned, a single universal perturbation can effectively steer the model's predictions.
  • Domain Alignment is Less Important: Counter-intuitively, the alignment between the source and target domains (i.e., how similar the tasks are) appears to have a minimal impact on reprogramming accuracy. Reprogramming can succeed even when domains are quite different.
  • Dimensionality Matters: Higher input dimensionality generally favors successful reprogramming, as it contributes to a larger average input gradient.
  • Mask Size is Secondary: While larger reprogramming masks can facilitate reprogramming, their impact is more marginal compared to gradient alignment. Small mask sizes are often sufficient.
  • Model Complexity and Task Simplicity: Reprogramming tends to work better when the task is simple (e.g., digit classification) and the target model is complex (trained on a large, diverse dataset). Conversely, it struggles with complex tasks or when the target model is small or trained on limited data.

Key Results

The paper reports on 14 reprogramming tasks, showing a wide range of reprogramming accuracy (RA) from very high (≥ 90%) to complete failure (≤ 30%).

  • Gradient Alignment Correlation: A strong and statistically significant positive correlation (Pearson coefficient of 0.98) was found between gradient alignment after reprogramming and reprogramming accuracy.
  • Mask Size Impact: Experiments with varying mask sizes showed that mask size can have a relevant impact, with differences of up to 15% in accuracy observed between the smallest and largest mask sizes considered in one case.
  • Domain Alignment (DA): The accuracy of the classifier on the target-domain dataset before reprogramming (DA) was generally low (around 10%), indicating that the initial state of the model on the target data is not a strong predictor of reprogramming success.

Limitations and Future Work

The authors acknowledge two main limitations:

  • Impact of Class Number: The current analysis does not clearly elucidate the extent to which the number of source and target domain classes affects reprogramming performance. This warrants further empirical investigation.
  • l∞-norm Constraint: The study primarily focused on adversarial programs optimized within an l∞-norm constraint. While the analysis can be extended to other lp-norm perturbation models, this remains an area for future exploration.

Future work could include:

  • Developing guidelines for practitioners to select machine-learning models that are easier to repurpose.
  • Investigating the impact of the number of classes on reprogramming.
  • Extending the analysis to other perturbation norms and to attacks where perturbations are averaged over different input samples (e.g., universal adversarial perturbations, robust physical-world adversarial examples).

Summary updated

BibTeX
@article{zheng2023why,
  author = {Yang Zheng and Xiaoyi Feng and Zhaoqiang Xia and Xiaoyue Jiang and Ambra Demontis and Maura Pintor and Battista Biggio and Fabio Roli},
  title = {{Why adversarial reprogramming works, when it fails, and how to tell the difference}},
  journal = {Information Sciences},
  year = {2023},
  doi = {10.1016/j.ins.2023.02.086},
}
Figure