Prompt-Driven Contrastive Learning for Transferable Adversarial Attacks

Hunmin Yang, Jongoh Jeong, Kuk-Jin Yoon

Introduction

Adversarial attacks—subtle, often imperceptible perturbations added to input data—pose a significant threat to the reliability of deep learning models. A persistent challenge in this field is "transferability": an attack optimized to fool a specific "surrogate" model often fails when applied to a different "victim" model, particularly if the victim model utilizes a different architecture or was trained on a different data distribution (e.g., sketches vs. natural photos).

Existing generative attacks offer speed but frequently overfit to the surrogate model's specific features. While recent attempts have integrated foundation models like CLIP to improve robustness, they often encounter "feature heterogeneity"—a conflict arising from the attempt to reconcile disparate feature spaces between standard convolutional networks and transformer-based vision-language models. This paper introduces PDCL-Attack (Prompt-Driven Contrastive Learning), a framework designed to overcome these hurdles by targeting the semantic understanding of images through learnable text prompts.

The PDCL-Attack Framework

PDCL-Attack shifts the focus from pixel-level manipulation to semantic disruption. By leveraging the CLIP embedding space, where text and images are aligned, the framework creates perturbations that are effective across various domains and architectures. The method consists of three primary phases:

1. Prompt Context Training

Rather than relying on static, manually engineered prompts (e.g., "a photo of a dog"), PDCL-Attack learns "context word vectors." These vectors are optimized to ensure that CLIP’s text encoder produces features that are highly robust to distribution shifts. This ensures that the semantic anchor used for the attack remains relevant whether the input is a high-resolution photograph or a stylized rendition.

2. Perturbation Generator Training

The core of the framework is a generator ($G_\theta$) trained using a novel Prompt-Driven Contrastive Loss ($\mathcal{L}_{PDCL}$). This loss function utilizes three components:

  • The Anchor: Features extracted from the perturbed (adversarial) image.
  • The Positive Sample: "Adversarial" text features derived from labels semantically distant from the original image.
  • The Negative Sample: Ground-truth text features.

By maximizing the similarity between the adversarial image and the "wrong" text while minimizing similarity to the "correct" text, the generator learns to destroy the model's semantic grasp of the image. Crucially, PDCL-Attack keeps the surrogate model's features and CLIP's features separate during optimization, avoiding the feature heterogeneity conflicts that plagued previous state-of-the-art (SOTA) methods.

3. Inference

Once trained, the generator is frozen. It can then instantly generate adversarial perturbations for new, unseen images across various domains without requiring further optimization or access to the victim model.

Experimental Evaluation

The researchers evaluated PDCL-Attack against several SOTA methods, including GAP, CDA, LTP, BIA, and GAMA. Training was conducted on ImageNet-1K, with evaluations spanning cross-domain datasets (CUB-201-2011, Stanford Cars, FGVC Aircraft) and robustness benchmarks (ImageNet-V2, Sketch, Adversarial, and Renditions).

Key Findings

  • Superior Transferability: In cross-domain evaluations, PDCL-Attack significantly outperformed competitors. It reduced the average accuracy of victim models to 43.91%, a notable improvement over the previous best (GAMA) at 48.56% (lower accuracy indicates a more successful attack).
  • Cross-Architecture Success: The framework demonstrated high efficacy when attacking models with architectures different from the surrogate (e.g., attacking a Vision Transformer using a VGG-16 surrogate). PDCL-Attack maintained an average victim accuracy of 38.60%, compared to GAMA's 40.91%.
  • Perceptual Quality: Interestingly, despite its higher success rate, PDCL-Attack produced adversarial images with higher perceptual quality. Metrics such as PSNR and SSIM were superior to older methods like BIA, suggesting that the semantic-focused perturbations are less noticeable to the human eye.

Discussion and Limitations

PDCL-Attack demonstrates that text can serve as a powerful semantic anchor for adversarial perturbations. By targeting the text-image alignment in CLIP, the attack becomes "domain-agnostic," treating a sketch and a photo of the same object as semantically identical targets.

However, the method is not without trade-offs. The training phase is computationally intensive; training the generator took approximately 33 hours on an NVIDIA RTX A6000, nearly triple the time required for the BIA method. Additionally, the training phase requires ground-truth class labels to generate the necessary text-driven guidance.

Conclusion

PDCL-Attack represents a significant step forward in creating portable and robust adversarial attacks. By resolving the conflict between surrogate and foundation model features and utilizing learnable prompts, it achieves state-of-the-art transferability. Future research may explore extending this semantic disruption approach to other computer vision tasks, such as object detection and image segmentation.

Summary updated

BibTeX
@inproceedings{yang2024prompt,
  author = {Hunmin Yang and Jongoh Jeong and Kuk-Jin Yoon},
  title = {{Prompt-Driven Contrastive Learning for Transferable Adversarial Attacks}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72775-7\_3},
}
Figure