On the detection of synthetic images generated by diffusion models

Riccardo Corvi, Davide Cozzolino, Giada Zingarini, Giovanni Poggi, Koki Nagano, Luisa VerdolivaZenodo 2022 · DOI · OpenAlex

Introduction

As generative AI continues to evolve, the boundary between real and synthetic imagery has become increasingly blurred. While Generative Adversarial Networks (GANs) previously dominated the landscape, Diffusion Models (DMs)—such as DALL·E 2 and Stable Diffusion—have emerged as the new state-of-the-art, offering unprecedented photorealism and diversity. This shift presents a significant challenge for media forensics. This research, a collaboration between the University Federico II of Naples and NVIDIA, investigates whether the forensic tools developed for GANs remain effective against the unique architectural signatures of Diffusion Models.

The Forensic Challenge: GANs vs. Diffusion

For years, the forensics community relied on the fact that GANs leave distinct "artificial fingerprints." These mathematical artifacts are primarily created by the upsampling layers within the generator, resulting in periodic patterns that are easily detectable in the frequency domain.

Diffusion Models, however, operate on a fundamentally different principle. Instead of a single-pass generation, DMs iteratively remove noise to synthesize an image. This research addresses a critical gap: do these iterative processes leave similar detectable traces, and can our current detectors generalize across these diverse architectures? The core difficulty lies in generalization—the ability of a detector trained on one model to accurately identify fakes from an entirely different, unseen architecture.

Methodology

The study employed a multi-faceted approach to evaluate the detectability of DM-generated content:

  1. Artifact Analysis: To identify potential "fingerprints," researchers extracted noise residuals from 1,000 images per model using a denoising filter. By averaging these residuals and applying a Fourier Transform, they looked for spectral peaks—visual evidence of the periodic patterns inherent to the specific generation process.
  2. Detection Benchmarking: The team tested four high-performing CNN-based detectors (Spec, PatchForensics, Wang2020, and Grag2021). These were evaluated under two training regimes: one trained on a GAN (ProGAN) and one trained on a DM (Latent Diffusion).
  3. Robustness Testing: Recognizing that images are rarely shared in their original format, the researchers simulated social media conditions. They applied random cropping, resizing, and JPEG compression to determine if forensic traces could survive common post-processing steps.

Data Diversity

To ensure a comprehensive evaluation, the study utilized a wide array of synthetic and real data:

  • Generative Models: The suite included GANs (ProGAN, StyleGAN2, StyleGAN3, BigGAN, EG3D), Transformers (Taming Transformer, DALL·E Mini), and Diffusion Models (GLIDE, Latent Diffusion, Stable Diffusion, ADM, and DALL·E 2).
  • Baseline Data: Real images were sourced from the COCO, ImageNet, and UCID datasets.
  • Text-to-Image Prompts: For models requiring text input, prompts were derived from the COCO validation and training sets.

Key Insights

The Variability of Fingerprints

The research confirmed that DMs do leave fingerprints, but they are not uniform. While models like GLIDE and Stable Diffusion exhibit clear spectral peaks in the frequency domain, newer or more complex architectures like ADM and DALL·E 2 show much weaker traces. This suggests that as diffusion technology matures, the resulting images are becoming forensically "stealthier."

The Threshold and Calibration Problem

A significant finding was the discrepancy between ranking ability and classification accuracy. A detector might be excellent at ranking images (high Area Under the Curve, or AUC), yet fail at binary classification (low accuracy). This occurs because the "decision threshold" learned on one model (e.g., ProGAN) rarely translates to another (e.g., DALL·E 2). However, the authors found that "Platt scaling"—a method to calibrate output probabilities using a small number of examples from the target model—could drastically improve accuracy.

The Impact of Image Processing

Social media platforms act as a forensic "black hole." Resizing and JPEG compression effectively filter out the subtle high-frequency traces that detectors rely on. While detectors performed admirably on uncompressed PNG files, their reliability plummeted when faced with processed JPEGs, often approaching random chance for the most advanced models like DALL·E 2.

Results and Performance

  • Cross-Model Generalization: A detector trained on ProGAN (Grag2021) achieved a 92.8% AUC across various models on pristine data. However, this performance was not robust against compression.
  • DM-Specific Training: Training a detector specifically on Latent Diffusion yielded a 100% AUC when testing on Stable Diffusion. Yet, that same detector only achieved a 74.2% AUC on DALL·E 2, proving that forensic signatures vary significantly even within the family of diffusion models.
  • Fusion and Calibration: By combining multiple detectors and applying calibration with a few samples from the target model, the researchers were able to push accuracy from near-random levels to over 90% for several architectures.

Conclusion

This study highlights that while Diffusion Models are not perfectly "clean," their forensic signatures are more elusive than those of their GAN predecessors. The lack of a truly universal detector remains a primary hurdle in the fight against synthetic misinformation. As generative models continue to evolve, the forensic community must focus on developing more robust features that can survive heavy image processing and adapt rapidly to new architectures. The "arms race" between generative AI and media forensics is entering a new, more challenging phase.

Summary updated

Abstract

Over the past decade, there has been tremendous progress in creating synthetic media, mainly thanks to the development of powerful methods based on generative adversarial networks (GAN). Very recently, methods based on diffusion models (DM) have been gaining the spotlight. In addition to providing an impressive level of photorealism, they enable the creation of text-based visual content, opening up new and exciting opportunities in many different application fields, from arts to video games. On the other hand, this property is an additional asset in the hands of malicious users, who can generate and distribute fake media perfectly adapted to their attacks, posing new challenges to the media forensic community. With this work, we seek to understand how difficult it is to distinguish synthetic images generated by diffusion models from pristine ones and whether current state-of-the-art detectors<br> are suitable for the task. To this end, first we expose the forensics traces left by diffusion models, then study how current detectors, developed for GAN-generated images, perform on these new synthetic images, especially in challenging social-networks scenarios involving image compression and resizing. Datasets and code are available at github.com/grip-unina/DMimageDetection.
BibTeX
@inproceedings{corvi2022detection,
  author = {Riccardo Corvi and Davide Cozzolino and Giada Zingarini and Giovanni Poggi and Koki Nagano and Luisa Verdoliva},
  title = {{On the detection of synthetic images generated by diffusion models}},
  booktitle = {Zenodo},
  year = {2022},
  doi = {10.5281/zenodo.8316242},
}

Loading related content...

Figure