Privacy Threats in Stable Diffusion Models

Thomas Cilloni, Charles Fleming, Charles WalterarXiv 2023

Abstract

This paper introduces a novel approach to membership inference attacks (MIA) targeting stable diffusion computer vision models, specifically focusing on the highly sophisticated Stable Diffusion V2 by StabilityAI. MIAs aim to extract sensitive information about a model's training data, posing significant privacy concerns. Despite its advancements in image synthesis, our research reveals privacy vulnerabilities in the stable diffusion models' outputs. Exploiting this information, we devise a black-box MIA that only needs to query the victim model repeatedly. Our methodology involves observing the output of a stable diffusion model at different generative epochs and training a classification model to distinguish when a series of intermediates originated from a training sample or not. The attack's efficacy is assessed using the ROC AUC method, demonstrating a 60% success rate in inferring membership information. This paper contributes to the growing body of research on privacy and security in machine learning, highlighting the need for robust defenses against MIAs.

Introduction

As generative AI becomes ubiquitous, a critical question arises: Does the model "memorize" its training data? If a model is trained on private medical records, copyrighted art, or personal photos, an adversary might perform a Membership Inference Attack (MIA) to confirm whether a specific individual's data was part of the training set.

While MIAs are well-studied for simple classification models, they are significantly harder to execute against complex diffusion models like Stable Diffusion. These models do not output simple probability scores; they generate high-dimensional images. This research tackles the challenge of performing MIAs on a state-of-the-art, industry-grade model in realistic black-box (API-only) and gray-box (access to intermediate steps) settings.

Methodology

The proposed attack pipeline consists of three modular components: an Informer, an Encoder, and a Classifier.

  1. The Informer: Defines the attacker's visibility. In a "One-shot" (black-box) scenario, the attacker only sees the final generated image. In a "Progressive/Complete" (gray-box) scenario, the attacker observes the image as it evolves through diffusion timesteps (e.g., at $T=0, 20, 40$).
  2. The Encoder: This core module measures the similarity between the generated output and the original target image. The fundamental insight is that if a model has seen an image during training, it tends to "pull" the noisy starting point toward that specific training sample more effectively than it does for unseen images. Metrics used include PSNR, RMSE, DSSIM, and Euclidean distance between feature vectors.
  3. The Classifier: A machine learning model (such as an SVM or Logistic Regression) is trained on these similarity scores to distinguish between "Member" and "Non-member" samples.

Experimental Setup

The study targets Stable Diffusion V2, trained on the LAION-5B dataset. To evaluate the attack, two subsets were curated:

  • Members ($D_{member}$): 1,000 images from LAION-5B with "Aesthetic Scores" between 4.5 and 5.0 (the range used during model training).
  • Non-members ($D_{non-member}$): 1,000 images with scores between 4.0 and 4.5, which are visually similar but statistically likely to have been excluded from the training set.

Reconstruction as a Privacy Signature

The most striking insight is visual: when a training image is fed into the diffusion process, the model often attempts to reconstruct the exact original. Unseen images, by contrast, result in outputs that are noticeably different in composition or detail.

Comparison of diffusion trajectories for member vs. non-member images across timesteps T.

As shown in the figure above, the "member" image (the onesie) shows a much clearer trajectory toward the original image compared to the "non-member" image (the earrings). This suggests that the model’s "memory" is encoded not just in the final pixels, but in the trajectory it takes during generation.

Key Results

  • 60% Accuracy: The best attack configurations achieved an AUC-ROC of ~0.60. While not a perfect prediction for every image, it is significantly better than random guessing (0.50) and represents a clear privacy leak.
  • High-Confidence Leaks: The researchers found they could identify a small subset of training images with near-perfect precision (1% recall at 0% false-positive rate). For a model trained on billions of images, even a 1% leak exposes millions of data points.
  • Metric Performance: PSNR and RMSE proved to be the most effective distance metrics for distinguishing members from non-members.

Limitations and Conclusion

A primary challenge is the "shadow model" problem; training a replica of Stable Diffusion to refine attacks is prohibitively expensive. However, this research demonstrates that even black-box access to commercial APIs poses a risk. Simple defenses, such as output smoothing (blurring), were found to decrease attack effectiveness, suggesting that limiting output resolution may be a viable safeguard.

This research serves as a wake-up call: as foundation models are trained on vast swaths of the internet, developers must implement enhanced security measures to ensure these models do not inadvertently become searchable databases of private information.

Summary updated

BibTeX
@misc{cilloni2023privacy,
  author = {Thomas Cilloni and Charles Fleming and Charles Walter},
  title = {{Privacy Threats in Stable Diffusion Models}},
  year = {2023},
  eprint = {2311.09355},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.09355},
}
Figure