Prompt2Perturb (P2P): Text-Guided Diffusion-Based Adversarial Attack on Breast Ultrasound Images

Yasamin Medghalchi, Moein Heidari, Clayton Allard, Leonid Sigal, Ilker HacihalilogluCVPR 2025

Introduction

Deep Neural Networks (DNNs) have become integral tools in medical imaging, particularly in assisting radiologists with breast cancer diagnosis from ultrasound images. Despite their high performance, these models are susceptible to adversarial attacks—carefully crafted, subtle perturbations that can lead to catastrophic misclassifications, such as labeling a malignant tumor as benign.

Traditional adversarial attack methods, such as Projected Gradient Descent (PGD), often introduce "static-like" noise that is easily detectable by clinical experts. Furthermore, recent diffusion-based attacks typically require extensive fine-tuning on domain-specific datasets, which are often limited in the medical field due to privacy concerns and data scarcity. To address these challenges, the authors introduce Prompt2Perturb (P2P), a framework designed to generate stealthy, clinically realistic adversarial examples without the need for model retraining.

Methodology: The P2P Pipeline

The Prompt2Perturb framework shifts the focus from pixel-level manipulation to the optimization of text embeddings within a pre-trained Stable Diffusion model.

The P2P pipeline optimizes text embeddings to generate adversarial images using a frozen Stable Diffusion model.

The P2P process involves several key technical strategies:

  • Text Embedding Optimization: Both the diffusion model (G) and the target image classifier (F) are frozen. The attack optimizes only the text embeddings (C) to find a prompt representation that induces misclassification while maintaining visual fidelity to the original image.
  • Early Diffusion Timesteps: The optimization focuses on the first 50 timesteps of the diffusion process. These early stages primarily influence high-frequency details like edges and textures—where ultrasound artifacts naturally occur—rather than altering the underlying anatomical structure.
  • Dual Loss Function: The optimization objective combines Cross-Entropy loss (to drive misclassification) and MSE loss (to ensure the generated noise follows the expected distribution of the diffusion model), preventing the creation of unnatural visual artifacts.

Experimental Setup

The effectiveness of P2P was evaluated across three diverse breast ultrasound datasets:

  1. BUSI (Breast Ultrasound Images): 780 images categorized as normal, benign, or malignant.
  2. BUS-BRA: A larger dataset of 1,875 anonymized images from 1,064 patients.
  3. UDIAT: A high-quality dataset of 163 images.

The attacks were tested against three widely used medical imaging architectures: ResNet34, SqueezeNet1.1, and DenseNet121.

Results and Analysis

P2P demonstrates a superior balance between attack success and image quality compared to existing state-of-the-art methods.

Qualitative comparison showing original ultrasound images and their P2P-perturbed counterparts. The attack successfully flips classifications (e.g., Malignant to Benign) with minimal perceptible changes.

Key Performance Metrics

  • Attack Success Rate: P2P consistently achieved success rates exceeding 95% across various models and datasets, matching the potency of more visible attack methods like Diff-PGD.
  • Visual Fidelity: On the BUSI dataset with a DenseNet121 classifier, P2P achieved a Fréchet Inception Distance (FID) of 45.84, significantly lower than Diff-PGD’s 111.03. Lower FID scores indicate that P2P-generated images are much closer to the distribution of real ultrasound data.
  • Perceptual Similarity: P2P yielded much lower LPIPS scores (e.g., 0.13 vs. 0.30), confirming that the adversarial changes are nearly imperceptible to the human eye.

Stealth and Realism

Analysis using t-SNE visualizations revealed that P2P-attacked images cluster closely with clean data, whereas traditional attacks form isolated, easily detectable clusters. By leveraging language-guided models, the perturbations mimic real-world ultrasound variations—such as changes in transducer frequency—rather than mathematical noise.

Conclusion and Future Work

Prompt2Perturb highlights a significant security vulnerability in medical AI by generating highly effective and stealthy adversarial attacks. By optimizing text embeddings rather than pixels, the method achieves clinical realism without requiring large-scale medical training data.

Future research directions include developing defense strategies through adversarial training on P2P-generated examples and evaluating the applicability of text-guided diffusion attacks on other medical imaging modalities, such as MRI and CT scans.

Summary updated

BibTeX
@inproceedings{medghalchi2025prompt,
  author = {Yasamin Medghalchi and Moein Heidari and Clayton Allard and Leonid Sigal and Ilker Hacihaliloglu},
  title = {{Prompt2Perturb (P2P): Text-Guided Diffusion-Based Adversarial Attack on Breast Ultrasound Images}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02660},
}
Figure