StableGuard: Towards Unified Copyright Protection and Tamper Localization in Latent Diffusion Models

Haoxin Yang, Bangzhen Liu, Xuemiao Xu, Cheng Xu, Yuyang Yu, Zikai Huang, Yi Wang, Shengfeng He

TL;DR

StableGuard is an end-to-end framework for Latent Diffusion Models (LDMs) that embeds invisible watermarks directly during the image generation process. By integrating protection into the model's architecture, it enables both robust copyright verification and precise localization of tampered regions, outperforming traditional "post-hoc" methods in both security and image quality.

The Challenge: Post-hoc vs. Native Protection

As AI-generated content (AIGC) becomes indistinguishable from reality, two major challenges have emerged: copyright protection (proving who generated an image) and content authenticity (detecting if an image has been maliciously edited).

Existing solutions usually fall into two camps:

  1. Passive Forensics: Trying to find "glitches" or artifacts left by editing tools. These struggle to keep up with the latest AI editing techniques.
  2. Post-hoc Watermarking: Adding a digital watermark after the image is generated. This often degrades image quality and introduces a "detachment" where the watermark can be easily stripped or bypassed.
Comparison of traditional post-hoc watermarking versus StableGuard's native embedding approach.

The authors of StableGuard argue that for forensics to be truly reliable, the protection must be "diffusion-native"—baked into the generation process itself.

How StableGuard Works

StableGuard introduces two primary components that work in tandem to embed and detect these native watermarks:

The overall StableGuard framework, detailing the MPW-VAE and the MoE-GFN architectures.

1. Multiplexing Watermark VAE (MPW-VAE)

Instead of modifying the complex denoising process of a diffusion model, StableGuard targets the VAE (Variational Autoencoder) decoder. They add a lightweight "watermark adapter" that uses latent residuals to inject a binary watermark.

Crucially, this adapter features a "Multiplexing" trick: it can be toggled on or off. This allows the system to generate "paired" images—one watermarked and one clean—both originating from the exact same latent code. This pairing is essential for training the detection network.

2. Mixture-of-Experts Guided Forensic Network (MoE-GFN)

To detect tampering, the authors designed a forensic network that doesn't just look for one type of clue. It uses a Mixture-of-Forensic-Experts (MoFE) block consisting of three specialized modules:

  • Watermark Extraction Expert: Uses Transformers to model global correlations and recover the hidden bits.
  • Tampering Localization Expert: Uses sub-patch attention to find local inconsistencies where the watermark might be missing.
  • Boundary Enhancement Expert: Operates in the frequency domain (using Fourier Transforms) to detect the subtle high-frequency "edges" created when one image is spliced into another.

A Dynamic Soft Router then decides how much to trust each expert based on the specific image it’s analyzing, fusing their outputs for a final prediction.

Key Insights and Training Synergy

  • The "Missing Feature" Cue: The core insight is that a holistic, globally distributed watermark is actually a great tool for local detection. If a watermark is supposed to be everywhere, the absence of that watermark in a specific area is a definitive signal that the area has been tampered with.
  • Self-Supervised Synergy: Because the MPW-VAE generates perfectly aligned watermarked/clean pairs, the system can train itself. By randomly masking and splicing these pairs, the forensic network learns exactly what "tampering" looks like without needing human-annotated labels.
  • Reciprocal Training: The embedding and detection tasks are optimized jointly. This creates a "virtuous cycle" where the watermark is learned to be as imperceptible as possible while remaining highly detectable for the forensic experts.

Datasets and Key Results

The researchers evaluated StableGuard using standard datasets like COCO, a custom Text-to-Image (T2I) dataset generated via Stable Diffusion 2.1, and a newly introduced large-scale benchmark of 35,000 images edited using state-of-the-art tools (like Inpainting and ControlNet) to simulate realistic AI-driven forgeries.

  • High Fidelity: StableGuard maintains excellent image quality, achieving a PSNR of over 40dB, meaning the watermarked images are visually indistinguishable from the originals.
  • Near-Perfect Verification: It achieves nearly 100% bit accuracy for watermark retrieval, even when images are subjected to noise or compression.
  • Superior Localization: On the AIGC Tampering Dataset, StableGuard significantly outperformed previous state-of-the-art methods (like EditGuard and WAM), particularly in IoU (Intersection over Union) and F1 scores, proving it is much more precise at drawing boundaries around edited regions.
  • Robustness: The system remained effective against common image degradations, including JPEG compression, Gaussian noise, and brightness/contrast adjustments.

Limitations and Future Work

While highly robust, the authors acknowledge that extreme image corruption (like aggressive downsampling or heavy re-compression) can still reduce the accuracy of forensic localization. Furthermore, the current framework is designed for static images and is tied to the VAE architecture common in Latent Diffusion Models. Adapting these native watermarking techniques for video diffusion models or non-latent (pixel-space) diffusion models represents a logical and necessary next step for the field.

Summary updated

BibTeX
@inproceedings{yang2025stableguard,
  author = {Haoxin Yang and Bangzhen Liu and Xuemiao Xu and Cheng Xu and Yuyang Yu and Zikai Huang and Yi Wang and Shengfeng He},
  title = {{StableGuard: Towards Unified Copyright Protection and Tamper Localization in Latent Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=5KuiDLT0rm},
}
Figure