Latent Watermark: Inject and Detect Watermarks in Latent Diffusion Space

Zheling Meng, Bo Peng, Jing Dong

TL;DR

Researchers have developed "Latent Watermark" (LW), a method that injects and detects digital signatures directly within the latent space of diffusion models. By moving away from traditional pixel-space perturbations, LW achieves superior image quality and significantly higher resistance to common image attacks like blurring, JPEG compression, and AI-driven reconstruction.

What Problem Does This Paper Address?

As Latent Diffusion Models (LDMs) like Stable Diffusion become mainstream, the need to identify and attribute AI-generated content has become a security priority. Watermarking is the primary tool for this, but existing methods suffer from a frustrating "dilemma":

  1. The Quality Gap: To make a watermark robust enough to survive editing or compression, you often have to perturb pixels so much that the image looks "off" or loses high-fidelity detail.
  2. The Robustness Gap: If you prioritize image quality and keep perturbations subtle, the watermark is easily erased by simple attacks like Gaussian blurring or re-saving as a low-quality JPEG.

The authors argue this dilemma exists because most methods operate in pixel space. They rely on slight color or texture changes that are easily destroyed by image processing. The challenge is to create a watermark that is "baked into" the generative process itself without degrading the final output.

Methods

The authors propose Latent Watermark (LW), which operates entirely within the latent space of the LDM. Instead of modifying the final image, they modify the compressed representation (the latent) that the model uses to build the image.

The Architecture

LW introduces four specialized modules:

  • Message Encoder: Converts a bit-string (the watermark) into a latent representation.
  • Message Coupler: Fuses the watermark latent with the image latent (specifically targeting the first channel, $z_{(0)}$).
  • Message Decoupler: Extracts the watermark latent from a generated (and potentially attacked) image.
  • Message Decoder: Converts the extracted latent back into the original bit-string.

Progressive Training Strategy

Training these modules is difficult because the LDM’s own encoder and decoder are frozen and highly complex. To solve this, the authors use a three-step "divide and conquer" strategy:

  1. Self-Supervised Pre-training: The message encoder and decoder are trained to talk to each other directly to ensure bits can be recovered perfectly.
  2. Identity Mapping: The coupler is pre-trained to act as an "identity" function, ensuring that, initially, it doesn't change the image at all.
  3. Formal Training: All modules are trained together using a combination of latent distance loss, visual similarity loss (LPIPS), and message accuracy loss.

Datasets

  • Training: 50,000 images randomly sampled from the LAION-Aesthetics-5+ dataset.
  • Evaluation: 5,000 captions each from MS-COCO 2017 and Flickr30k to generate test images.
  • Attacks: The models were tested against 10 different attacks, including destructive (JPEG, noise), constructive (denoising), and reconstructive (running the image through another AI model to "clean" it).

Key Insights and Ideas

  • Latent Space is the "Sweet Spot": By injecting watermarks into the latent space, the method leverages the LDM's own decoder to "hide" the watermark within the natural textures of the image. This weakens the direct link between quality degradation and robustness.
  • Channel Sensitivity: The authors found that injecting the watermark into the first channel of the latent space ($z_{(0)}$) resulted in the least amount of color shifting compared to other channels.
  • Resisting AI Reconstruction: One of the hardest attacks to beat is "reconstructive" attack, where an attacker uses another AI (like a VAE) to regenerate the image, effectively stripping away pixel-level noise. Because LW is embedded in the latent structure, it survives these "clean-up" attempts much better than pixel-based methods.

Key Results

LW was compared against six state-of-the-art baselines, including StableSignature and StegaStamp.

  • Robustness: On MS-COCO, LW achieved an average Bit Accuracy of ~95% across all attacks, outperforming the next best method (StegaStamp) by over 5%.
  • Detection: In terms of the "True Positive Rate" (identifying if an image is watermarked at a very low false-alarm rate), LW reached 98-99%, while many competitors struggled to stay above 80% under heavy attack.
  • Image Quality: LW maintained lower FID scores (meaning the images looked more "real") and higher SSIM scores than robust pixel-based competitors. Qualitatively, it avoided the "shadowy" artifacts often seen in StegaStamp.

Limitations and Future Work

The primary limitation acknowledged by the authors is rotation invariance. While LW is highly robust to blurring, cropping, and compression, it struggles if the image is rotated by more than a few degrees. The authors suggest that exploring rotation-invariant latent representations is a key direction for future research. Additionally, while the method is fast (ranking second in inference time), there is always room to optimize the overhead added by the extra U-Net modules used in the coupling process.

Summary updated

BibTeX
@article{meng2025latent,
  author = {Zheling Meng and Bo Peng and Jing Dong},
  title = {{Latent Watermark: Inject and Detect Watermarks in Latent Diffusion Space}},
  journal = {IEEE Trans. Multimedia},
  year = {2025},
  doi = {10.1109/tmm.2025.3535300},
}
Figure