TL;DR
Detecting AI-generated images—especially those subtly altered via inpainting—is a cat-and-mouse game where detectors trained on today’s models often fail on tomorrow’s. DualSight solves this by splitting its vision into two parallel streams: one that understands what is in the image (semantics) and another that hunts for how it was made (low-level generation artifacts). By fusing these two perspectives, DualSight beats the previous state-of-the-art on the OpenSDI benchmark by over 10% in mean F1 score, trains in a fraction of the time, and still hits over 80% accuracy with just 5% of the training data.
What Problem Does This Paper Address?
Latent Diffusion Models (LDMs) like Stable Diffusion 3 and Flux can generate photorealistic images from a simple text prompt. Even trickier to catch are inpainted images, where only a small region of a real photo is modified, leaving most pixels untouched.
Earlier deepfake detectors—originally built for GANs—struggle to generalize to these newer diffusion models. The authors hypothesize that this happens because existing detectors rely on a single representation. They either focus too heavily on high-level RGB semantics (ignoring subtle pixel-level traces) or look only at low-level frequency/noise artifacts (throwing away useful semantic context). To generalize to unseen diffusion models, a detector needs both, kept cleanly separated until it’s time to make a decision.
Methods
DualSight is a dual-encoder architecture with a progressive fusion decoder, trained using both classification and image-text contrastive learning.
- Semantic Encoder: Uses a pretrained CLIP Vision Transformer (ViT-L/14) fine-tuned with Low-Rank Adaptation (LoRA) on its query, key, and value projections. LoRA keeps the rich pretrained embedding space intact—preventing catastrophic forgetting—while adapting it to spot fakes. An auxiliary classifier provides direct training signals to this branch.
- Artifact Encoder: First strips away color and semantic content using Content-Agnostic Filters (CAF)—specifically, a non-trainable Sobel filter followed by a randomly initialized $1 \times 1$ convolution. A trainable ResNet101 then extracts hierarchical artifact features at $M=3$ spatial levels from a high-resolution ($512^2$ px) version of this filtered image.
- Progressive Fusion Decoder: Instead of simply concatenating features at the end, a transformer-based decoder uses cross-attention to progressively refine the global semantic vector using the local-to-global artifact features.
- Training Objective: The model is trained with a combination of binary cross-entropy loss, the auxiliary semantic loss, and a contrastive loss that aligns the fused image features with text prompts (e.g.,
"FAKE - Stable Diffusion generated: <caption >").
Datasets
The authors train and evaluate on OpenSDI, a recent benchmark designed to test real-world generalization. Unlike older datasets, OpenSDI includes both full-image generation and inpainting, covers diverse user prompts, and features the latest LDMs.
- Training: Stable Diffusion 1.5 (SD1.5) training set (200k real/generated images).
- Evaluation: Five separate test sets—SD1.5, SD2.1, SDXL, SD3, and Flux (20k real/generated images each)—testing how well a model trained only on SD1.5 generalizes to unseen generators.
Key Insights and Ideas
- High-resolution artifacts matter most: Increasing the artifact encoder's input resolution from $224^2$ px to $512^2$ px yielded the single largest performance jump in ablation studies, boosting mean F1 by over 12%. Fine-grained generation anomalies simply get lost at lower resolutions.
- ResNets beat Transformers for artifact hunting: Surprisingly, a standard ResNet101 outperformed transformer-based artifact encoders (like Swin and PLG-ViT) on unseen diffusion models, and ImageNet pretraining offered no consistent advantage on filtered images.
- LoRA enables extreme data efficiency: Because LoRA gently aligns CLIP's existing knowledge rather than rewriting it, DualSight doesn't overfit to the training generator—allowing it to learn effectively even when training data is scarce.
Key Results
On the OpenSDI benchmark, DualSight (using ViT-L/14 at $336^2$ px) sets a new state-of-the-art:
- Generalization: Achieves 88.57% mean F1 and 89.13% mean accuracy, outperforming the previous best method (MaskCLIP: 77.79% F1, 81.98% Acc) by over 10% absolute mean F1. It is the only model to surpass 90% F1 on unseen SD2.1 (93.41%), SDXL (92.02%), and SD3 (92.64%), and reaches 79.30% F1 on Flux.
- Speed: Converges in just 3.5 GPU-hours on a single Nvidia H100, compared to ~44 GPU-hours for MaskCLIP.
- Limited Data: Reaches over 80% accuracy using only 5% of the training data.
- Robustness: Maintains much steadier performance than MaskCLIP under Gaussian blur and JPEG compression.
Limitations and Future Work
While DualSight handles blur well, its accuracy drops noticeably around 80% JPEG quality on Stable Diffusion test sets. The authors speculate that JPEG's 8x8 block artifacts mimic the subtle traces left by Stable Diffusion inpainting, confusing the detector. Future work will focus on overcoming this JPEG vulnerability, improving general robustness for inpainting detection, and swapping out CLIP for newer vision foundation models.
Summary updated