Enhancing Adversarial Transferability Through Neighborhood Conditional Sampling

Chunlin Qiu, Yiheng Duan, Lingchen Zhao, Qian Wang · OpenReview

Abstract

Transfer-based attacks craft adversarial examples utilizing a white-box surrogate model to compromise various black-box target models, posing significant threats to many real-world applications. However, existing transfer attacks suffer from either weak transferability or expensive computation. To bridge the gap, we propose a novel sample-based attack, named neighborhood conditional sampling (NCS), which enjoys high transferability with lightweight computation. Inspired by the observation that flat maxima result in better transferability, NCS is formulated as a max-min bi-level optimization problem to seek adversarial regions with high expected adversarial loss and small standard deviations. Specifically, due to the inner minimization problem being computationally intensive to resolve, and affecting the overall transferability, we propose a momentum-based previous gradient inversion approximation (PGIA) method to effectively solve the inner problem without any computation cost. In addition, we prove that two newly proposed attacks, which achieve flat maxima for better transferability, are actually specific cases of NCS under particular conditions. Extensive experiments demonstrate that NCS efficiently generates highly transferable adversarial examples, surpassing the current best method in transferability while requiring only 50% of the computational cost. Additionally, NCS can be seamlessly integrated with other methods to further enhance transferability.

Introduction: The Challenge of Adversarial Transferability

Adversarial attacks involve making imperceptible perturbations to an image to deceive machine learning models. In real-world "black-box" scenarios, attackers lack access to the target model's architecture and weights. Instead, they rely on transfer-based attacks: they craft perturbations on a known "surrogate" model and hope they remain effective against the target.

A key discovery in this field is the correlation between the flatness of the loss landscape and transferability. If an adversarial example resides in a "flat" region—where small shifts in the input do not drastically change the model's loss—it is more likely to transfer successfully to other models. Conversely, "sharp" maxima often represent overfitted features specific to the surrogate model, which do not generalize well.

Geometric interpretation showing how flat maxima reduce the Adversarial Transferability Gap (ATG) compared to sharp maxima.

Existing flatness-enhanced attacks often struggle with fragmented definitions of flatness or optimization imbalances, leading to high computational costs or suboptimal performance.

Methodology: The Maximin Expected Flatness (MEF) Framework

To address these issues, we introduce the Maximin Expected Flatness (MEF) framework. This approach seeks a "sweet spot" by balancing high adversarial loss with local smoothness through a hierarchical objective.

Neighborhood Conditional Sampling (NCS)

The core of this framework is Neighborhood Conditional Sampling (NCS). Formulated as a max-min bi-level optimization problem, NCS identifies the "worst-case" neighborhood (the maximin component) while optimizing for the average loss within that region. This ensures the attack finds regions that are both high-loss and consistently smooth across the neighborhood.

The workflow of MEF optimization, detailing the random initialization, inner minimization (NCS), and outer maximization steps.

Gradient Balancing Optimization (GBO)

To mitigate the "computational tax" associated with complex neighborhood searches, we employ Gradient Balancing Optimization (GBO). By reusing gradients across different optimization stages, GBO allows the attack to converge faster and more reliably, cutting computational costs in half compared to previous state-of-the-art methods like PGN.

Experimental Evaluation

We evaluated the MEF/NCS framework across a diverse suite of 33 models, including CNNs (ResNet, Inception), Vision Transformers (ViT), and MLP-Mixers, using an ImageNet-compatible dataset. The attack was also tested against:

  • Commercial APIs: Real-world testing against Google Cloud Vision, Amazon Rekognition, and Azure AI Vision.
  • Multimodal LLMs: Testing transferability to vision-language models like LLaVA and Qwen2.5-VL.
  • Robust Models: Evaluation against models specifically trained to defend against attacks (e.g., RobustBench).

Key Insights and Results

  • Superior Performance: MEF outperformed the previous state-of-the-art (PGN) by 4% in attack success rate (ASR) with half the computational budget. With an equal budget, the improvement rose to 8%.
  • Real-World Impact: The attack successfully compromised commercial APIs. For instance, it tricked Google Cloud Vision into misclassifying a "Dog" as a "Calf" and a "Squirrel" as "Linens" with high confidence.
  • MLLM Hallucinations: When applied to Multimodal Large Language Models, MEF induced "semantic hallucinations," causing models to describe a bagel as a "wooden spoon" or a turtle as a "person sitting on a couch."
  • Optimization Stability: While "worst-case" methods like PGN suffer from oscillatory trajectories due to local spikes, and "average-case" methods like FEM converge prematurely, MEF's maximin structure provides a stable middle ground.
  • Architecture Agnosticism: By targeting flat regions, the attack extracts features inherent to the task rather than the surrogate architecture, facilitating transfer from CNNs to Transformers.

Conclusion

The MEF framework and NCS technique provide a mathematically grounded and computationally efficient path to high adversarial transferability. By bridging the gap between exploration and exploitation in the loss landscape, this research highlights significant vulnerabilities in both standard and robust machine learning models across diverse architectures and commercial applications.

Summary updated

BibTeX
@misc{qiu2024enhancing,
  author = {Chunlin Qiu and Yiheng Duan and Lingchen Zhao and Qian Wang},
  title = {{Enhancing Adversarial Transferability Through Neighborhood Conditional Sampling}},
  year = {2024},
  eprint = {2405.16181},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.16181},
}
Figure