SDiFL: Stable Diffusion-Driven Framework for Image Forgery Localization

Yang Su, Shunquan Tan, Jiwu HuangarXiv 2025

TL;DR

SDiFL is a novel image forensics framework that repurposes the generative power and rich visual priors of Stable Diffusion (SD3) for image forgery localization. By reframing localization as a generative task and injecting high-frequency forensic residuals as a distinct latent modality, it achieves state-of-the-art detection accuracy and robust generalization to unseen, real-world manipulations.

What Problem Does This Paper Address?

As generative AI and advanced photo editing tools evolve, creating hyper-realistic image forgeries has become trivial. Unfortunately, detecting these manipulations (image forensics) remains incredibly difficult. Existing forgery localization methods typically act as pixel-level discriminators, which require massive, labor-intensive annotated datasets and struggle to generalize to novel manipulation techniques.

Furthermore, modern forensic methods that try to leverage Latent Diffusion Models (LDMs) face a fundamental mathematical bottleneck: compressing an image into a low-dimensional latent space inherently discards high-frequency details due to downsampling and aliasing. This is a massive issue for forensics because subtle forgery artifacts—like texture inconsistencies, compression discrepancies, and edge anomalies—live almost entirely in those high-frequency bands.

Methods

The authors flip the standard paradigm on its head: instead of treating forgery localization as a classification task, they treat it as a generative task. SDiFL aims to synthesize a clean forgery localization mask conditioned on the forged image and its high-frequency manipulation traces.

Built upon the multi-modal framework of Stable Diffusion V3 (SD3), the architecture keeps the pre-trained VAE encoder and decoder frozen to preserve its massive, zero-shot image-understanding capabilities. To compensate for the high-frequency information lost during latent compression, the authors introduce a dual-pathway mapping approach:

  1. Latent Mapping Model (LMM): Processes the standard image latent features to preserve global semantic structures and object contours.
  2. Forgery Latent Mapping Model (FLMM): Extracts high-frequency residual signals using Spatially Rich Model (SRM) filters. These residuals are processed through a fine-tuned Vision Transformer (leveraging pre-trained weights from the Segment Anything Model, or SAM) to act as an explicit "forensic modality"—effectively replacing the text prompt modality typically used in SD3.
Fig. 2. The concrete implementation of our proposed framework for forgery image localization.

These two latent streams are concatenated and fed into the pre-trained SD3 decoder to reconstruct the final predicted mask. The network is optimized using a combination of a latent space matching loss ($\mathcal{L}_{lm}$) and an image-space soft Dice loss ($\mathcal{L}_{loc}$).

Datasets

The model was trained on a massive combined dataset of approximately 830,000 images from tampCOCO, IMD2020, and CASIA2, which include copy-move, splicing, and inpainting operations.

To test generalization and robustness, the authors evaluated SDiFL across a wide array of benchmarks:

  • Traditional Forgeries: NIST16, Coverage, CASIA1, Columbia, and MISD.
  • Diffusion-Based Forgeries: CocoGlide and GRE (datasets specifically containing AI-generated/edited regions).
  • Social Media Robustness: OSNs (images subjected to real-world compression and resizing on Facebook, Weibo, WeChat, and WhatsApp).
  • Real-World/Unseen Domains: ACDTamp (natural scenes edited via ACDSee), PS-boundary, and PS-arbitrary (Photoshop-manipulated book covers).

Key Insights and Ideas

  • Generative Forensics: Large-scale text-to-image models like Stable Diffusion possess deep internal representations of what "natural" images look like. By swapping out text prompts for explicit forensic features, we can guide these models to inherently "generate" error maps.
  • The Aliasing Antidote: The authors provide an information-theoretic proof showing that explicitly introducing high-frequency residuals ($F$) reduces conditional entropy ($H(M|Z,F) \le H(M|Z)$). This mathematically guarantees that the latent space retains more relevant information to accurately localize boundaries.
  • Prior Exploitation: Instead of training a model from scratch to recognize fakes, leveraging a frozen, highly optimized VAE (like SD3's) grants the framework immediate, robust zero-shot generalization to entirely unseen image domains (e.g., book covers).

Key Results

SDiFL consistently outperformed existing state-of-the-art models (such as TruFor and CoDE) across nearly all benchmarks, demonstrating up to a 12% performance improvement.

  • Traditional Benchmarks: On the Coverage dataset, SDiFL achieved an F1-score of 0.586, significantly outperforming TruFor (0.525) and CoDE (0.464). On Columbia, it reached a dominant IoU of 0.851.
  • AI-Generated Fakes: On the challenging diffusion-forgery dataset CocoGlide, SDiFL achieved an IoU of 0.500 and an F1-score of 0.597, leaving baseline models far behind.
  • Social Media Resilience: SDiFL proved remarkably resilient against aggressive post-processing. Even when images were subjected to heavy WhatsApp or Facebook compression, or degraded by severe Gaussian noise, SDiFL maintained stable F1-scores while competing methods collapsed.
Fig. 5. Example of traditional forgery localization visual results.

Limitations and Future Work

Despite its impressive accuracy, SDiFL inherits the computational weight of large-scale foundation models. Running inference with components of SD3 and Vision Transformers introduces significant computational overhead, making it difficult to deploy in real-time or resource-constrained environments.

The authors note that future work will focus on developing computationally efficient variants using knowledge distillation. Additionally, they plan to explore integrating the actual iterative noise-adding and denoising diffusion processes of Stable Diffusion, rather than relying primarily on the VAE latent space, to further refine the localization boundaries.

Summary updated

BibTeX
@misc{su2025sdifl,
  author = {Yang Su and Shunquan Tan and Jiwu Huang},
  title = {{SDiFL: Stable Diffusion-Driven Framework for Image Forgery Localization}},
  year = {2025},
  eprint = {2508.20182},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.20182},
}
Figure