Detecting Discrepancies Between AI-Generated and Natural Images Using Uncertainty

Jun Nie, Yonggang Zhang, Tongliang Liu, Yiu-ming Cheung, Bo Han, Xinmei Tian · OpenReview

Abstract

AI-generated images are becoming increasingly indistinguishable from natural ones, posing significant risks of misuse. This paper introduces a novel detection approach based on predictive uncertainty. By leveraging the distributional discrepancy between natural and AI-generated images, we propose the Weight Perturbation (WePe) framework. Using large-scale vision models pre-trained on natural data, we identify AI-generated images as those that induce high uncertainty (low stability) when model weights are slightly perturbed. Our method demonstrates superior generalization and robustness across multiple benchmarks without requiring extensive training on fake image datasets.

Introduction

The rapid advancement of generative models like Stable Diffusion and Midjourney has made detecting synthetic content increasingly difficult. Traditional supervised detectors often fail to generalize to new, unseen generative architectures because they rely on learning specific "fingerprints" or artifacts. This research shifts the focus: instead of learning what is "fake," we define what is "natural."

The core hypothesis is that AI-generated images represent a distribution shift relative to the natural world. Even if visually perfect, their statistical properties differ. We treat AI-generated image detection as an Out-of-Distribution (OOD) detection problem.

Visual comparison and t-SNE visualization show that while AI-generated images (bottom) look similar to natural ones (top), they occupy distinct regions in the feature space.

Methodology: The WePe Framework

The proposed framework, Weight Perturbation (WePe), utilizes the concept of epistemic uncertainty—the uncertainty stemming from a model's lack of knowledge about a specific data distribution.

  1. Foundation: The method uses DINOv2, a vision transformer pre-trained on a massive dataset of natural images. DINOv2 acts as a proxy for the "natural image distribution."
  2. Weight Perturbation: Rather than using an expensive ensemble, WePe injects small Gaussian noise into the model's weights.
  3. Stability Test: The system measures the cosine similarity between features generated by the original model and the perturbed model. Natural images, residing in "flat minima" of the loss landscape, exhibit high stability. AI-generated images, falling into "curved" regions, show significant feature shifts.
The density plot of cosine similarity reveals that natural images maintain high stability (near 1.0) under perturbation, whereas AI-generated images exhibit a broader, lower similarity distribution.

For further performance, a "sharpened" version (WePe*) uses Low-Rank Adaptation (LoRA) on a small dataset to further widen this uncertainty gap.

Key Results and Discussion

WePe was evaluated against benchmarks like ImageNet, GenImage, and DRCT-2M.

  • Superior Generalization: WePe achieved an average AUROC of 95.57%* on ImageNet, significantly outperforming state-of-the-art supervised detectors which struggle with unseen generators.
  • Robustness: The method remains effective under common image degradations such as JPEG compression and Gaussian blurring, which often baffle artifact-based detectors.
  • Efficiency: By requiring only two forward passes, WePe offers a high-speed solution suitable for real-world deployment.

Conclusion

By reframing AI-generated image detection as an uncertainty-based OOD problem, WePe provides a robust and generalizable solution. Future work will address the potential narrowing of the distribution gap as generative models improve and the challenge of "natural OOD" images that might trigger false positives.

Summary updated

BibTeX
@inproceedings{nie2025detecting,
  author = {Jun Nie and Yonggang Zhang and Tongliang Liu and Yiu-ming Cheung and Bo Han and Xinmei Tian},
  title = {{Detecting Discrepancies Between AI-Generated and Natural Images Using Uncertainty}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=5SqbLPaBww},
}
Figure