Gaussian Shading: Provable Performance-Lossless Image Watermarking for Diffusion Models

Zijin Yang, Kai Zeng, Kejiang Chen, Han Fang, Wei Ming Zhang, Nenghai Yu

Introduction

As diffusion models like Stable Diffusion become mainstream, ethical challenges regarding copyright infringement and "deepfake" proliferation have intensified. Traditional watermarking solutions often force a trade-off between image quality, computational cost, and robustness. Post-processing methods can degrade quality, while fine-tuning is computationally expensive. Latent-based methods, such as Tree-Ring, often distort the initial noise distribution, leading to semantic inconsistencies in the generated output.

Comparison of watermarking methods showing the performance-lossless nature of Gaussian Shading.

Gaussian Shading addresses these issues by providing a training-free, "plug-and-play" watermarking technique that embeds high-capacity data (up to 256 bits) without any loss in image quality. By ensuring that watermarked latents are statistically indistinguishable from natural ones, the method provides a provably performance-lossless way to track copyright and trace AI-generated content.

Methodology

The core innovation of Gaussian Shading is its "Distribution-Preserving Sampling" mechanism. Unlike previous methods that modify the latent space in ways that shift the underlying statistics, Gaussian Shading ensures that watermarked latents remain statistically indistinguishable from natural ones.

1. Watermark Diffusion and Encryption

The process begins by spreading watermark bits across the latent space dimensions. To maintain security and ensure the watermark appears as white noise, a stream key (ChaCha20) is used for encryption, preventing the watermark from creating visible artifacts or patterns.

2. Distribution-Preserving Sampling

Standard diffusion models sample initial noise $z_T$ from a standard Gaussian distribution $\mathcal{N}(0, I)$. Gaussian Shading partitions the Gaussian probability density function into $2^l$ equal-probability intervals. Depending on the watermark bit (0 or 1), the system samples from specific sets of these intervals. Because each interval represents an equal "slice" of the total probability, the aggregate distribution remains a perfect standard Gaussian. To the diffusion model, the starting noise looks exactly like what it expects, resulting in performance-lossless generation.

The complete pipeline for watermark embedding and extraction using Gaussian Shading.

3. Extraction via DDIM Inversion

Watermark extraction utilizes DDIM inversion to map the final generated image back to its original starting noise. This process essentially "runs the movie in reverse," taking the final image and mathematically mapping it back to its initial latent state. By checking which probability intervals the reconstructed noise values fall into, the original watermark bits can be accurately recovered.

Experimental Results

The authors evaluated the method using Stable Diffusion (V1.4, V2.0, V2.1) on datasets including MS-COCO 2017 and ImageNet2014.

  • Performance Preservation: T-tests on FID (image quality) and CLIP-Scores (text-image alignment) confirmed no statistically significant impact on model performance compared to non-watermarked models.
  • High Capacity and Traceability: The method supports up to 256 bits, enabling precise traceability. Simulations with 1 million users demonstrated near-perfect accuracy in identifying the source of an image.
  • Robustness: The watermark remains resilient against common image manipulations. Even under heavy JPEG compression, Gaussian noise, or 60% area cropping, the True Positive Rate (TPR) remained above 0.99, and bit accuracy stayed above 0.97.

Conclusion

Gaussian Shading offers a theoretically sound and practically efficient solution for watermarking diffusion models. By hiding information within the sampling intervals of a standard distribution, it achieves high-capacity data embedding without compromising the creative integrity of the generative model. Future work will focus on extending the method to stochastic samplers and improving key management security.

Summary updated

BibTeX
@inproceedings{yang2024gaussian,
  author = {Zijin Yang and Kai Zeng and Kejiang Chen and Han Fang and Wei Ming Zhang and Nenghai Yu},
  title = {{Gaussian Shading: Provable Performance-Lossless Image Watermarking for Diffusion Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure