Semantic-Aware Reconstruction Error for Detecting AI-Generated Images

Ju Yeon Kang, Jaehong Park, Semin Kim, Ji Won Yoon, Nam Soo Kim

TL;DR

Existing AI-generated image detectors often fail when encountering images from new, unseen generators because they overfit to low-level, model-specific artifacts. This paper introduces Semantic-Aware Reconstruction Error (SARE), a novel method that detects fake images by measuring how much their meaning changes during caption-guided reconstruction. Because real images contain complex details that captions cannot fully capture, they undergo a massive semantic shift when reconstructed, whereas fake images remain largely unchanged.

What Problem Does This Paper Address?

As generative models (GANs, Diffusion Models, Autoregressive models) rapidly evolve, distinguishing real images from AI-generated ones has become a high-stakes game of cat-and-mouse. Most current detectors train a binary classifier on a specific set of real and fake images. While they perform well on the models they were trained on, their accuracy plummets when faced with out-of-distribution (OOD) images from new, unseen generators.

This drop occurs because detectors typically overfit to low-level visual artifacts or frequency anomalies unique to specific training architectures. To build a future-proof detector, we need to move away from fragile pixel-level traces and instead leverage fundamental, high-level differences between how real and fake images relate to natural language.

Methods

The authors propose a pipeline called Semantic-Aware Reconstruction Error (SARE), which consists of three main steps:

  1. Image Captioning: An input image $x$ is passed through a pre-trained captioning model (like BLIP or LLaVA-NeXT) to generate a descriptive text caption $C$.
  2. Caption-Guided Image Reconstruction: Using the generated caption $C$ as a text prompt, a pre-trained diffusion model (Stable Diffusion v1) reconstructs the image. Crucially, the authors apply Classifier-Free Guidance (CFG) during the reverse diffusion process to explicitly force the reconstruction to align with the text prompt, intentionally driving a semantic shift.
  3. SARE Extraction & Fusion: The raw SARE feature map is computed as the pixel-wise absolute difference between the original and reconstructed image: $\text{SARE}(x, \hat{x}) = |x - \hat{x}|$.

To integrate this error map into a final classification decision, the authors design a Fusion Module. A semantic encoder extracts features from the SARE map, which then interact with the backbone detector's image features via a cross-attention mechanism. The original image features serve as queries ($Q$), while the SARE features act as keys ($K$) and values ($V$), allowing the network to adaptively prioritize semantic discrepancies.

Fig. 3: Overview of the SARE framework. Our method reconstructs the input image conditioned on its caption using the Stable Diffusion model [46] with classifier-free guidance. SARE is computed as the difference between the input and reconstructed image, and is incorporated into the detection process through a cross-attention module that leverages image features as queries and SARE features as keys and values. The pixel values of the SARE are scaled by 2 for clearer visualization.

Datasets

The method was rigorously evaluated on two major benchmarks:

  • GenImage: A large-scale dataset featuring real images from ImageNet and fake images spanning 8 diverse generators: Midjourney, Stable Diffusion (v1.4, v1.5), ADM, GLIDE, Wukong, VQDM, and BigGAN.
  • ForenSynths: Used exclusively for cross-dataset evaluation to test out-of-distribution generalization. It includes 11 subsets from distinct architectures like ProGAN, StyleGAN, StyleGAN2, CycleGAN, and GauGAN.

Key Insights and Ideas

  • The "Caption Gap" Hypothesis: Real-world images are incredibly rich and contain fine-grained, chaotic details that a short text caption simply cannot capture. If you caption a real photo of a dog and reconstruct it from that text, the diffusion model will generate a completely different dog (high semantic shift). Fake images, however, are inherently born from text prompts; their visual complexity is bounded by language, meaning they align tightly with their captions and change very little upon reconstruction.
Fig. 1: Comparison of caption-guided reconstructions for real and fake images. Real images, whose captions often fail to fully capture their complex visual content, undergo noticeable semantic shifts during caption-guided reconstruction. In contrast, fake im- ages, which align closely with their captions, tend to exhibit minimal semantic changes.
  • Why Pure Reconstruction Fails: Prior methods like DIRE assumed fake images always yield smaller reconstruction errors than real images. However, the authors demonstrate that when evaluating OOD models (like BigGAN), pure reconstruction error actually spikes for fake images, causing standard detectors to fail. SARE circumvents this by using caption guidance to focus strictly on semantic drift rather than raw pixel distribution mismatches.
Fig. 2: Examples from the GenImage dataset [61] and their corresponding DIREs [54], and SAREs. Images are reconstructed using Stable Diffusion v1 [46]. DIRE may pro- duce larger errors for OOD fake images than for real images, contradicting its under- lying assumption. In contrast, SARE consistently yields higher values for real images than for fake images. For clearer visualization, the pixel values of the error maps are scaled by 2.

Key Results

The models were trained solely on the Stable Diffusion v1.4 subset of GenImage and evaluated across all other unseen generators.

  • GenImage Benchmark: SARE achieved a state-of-the-art average accuracy of 93.17% and an average AUC of 98.15%, outperforming competitive baselines like DRCT and DIRE. It showed massive improvements on difficult OOD subsets like BigGAN (jumping to 97.51% AUC compared to DIRE's 61.12%).
Table 2: AUC (%) comparisons of different detectors on the GenImage dataset [61]. Models are trained on the SDv1.4 subset and evaluated across 8 subsets. The best and second-best results are indicated in bold and underlined, respectively.
  • Cross-Dataset Generalization: When evaluated on the entirely unseen ForenSynths dataset (mostly GANs), SARE maintained an average AUC of 84.24%, proving that a semantic-shift approach generalizes incredibly well across completely different generative paradigms.
  • Robustness: SARE demonstrated strong resilience against common post-processing perturbations, outperforming baselines under various levels of JPEG compression and image resizing.

Limitations and Future Work

The primary bottleneck of SARE is its computational overhead. Running both an image captioning model and a multi-step diffusion model for every single inference is expensive.

To address this, the authors experimented with replacing Stable Diffusion with SwiftEdit, a single-step text-guided editing model. This optimization cut the average inference time in half (from 1.60 seconds down to 0.80 seconds per image) while only suffering a minor dip in accuracy (91.50%). The authors note that exploring even faster, more lightweight reconstruction models remains an important direction for real-time deployment.

Summary updated

BibTeX
@misc{kang2025semantic,
  author = {Ju Yeon Kang and Jaehong Park and Semin Kim and Ji Won Yoon and Nam Soo Kim},
  title = {{Semantic-Aware Reconstruction Error for Detecting AI-Generated Images}},
  year = {2025},
  eprint = {2508.09487},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.09487},
}
Figure