Understanding and Mitigating Copying in Diffusion Models
Abstract
As text-to-image diffusion models see widespread adoption, concerns regarding the memorization and reproduction of training data have intensified. While data duplication is a known factor, this research demonstrates that text conditioning plays a crucial role in "retrieving" memorized content. By treating specific captions as unique keys, models inadvertently replicate training images. This paper explores the relationship between text similarity and visual copying, proposing mitigation strategies—such as diversifying training captions and introducing inference-time noise—that significantly reduce copying without compromising image quality.
What Problem Does This Paper Address?
The emergence of powerful diffusion models like Stable Diffusion has brought to light a significant challenge: the occasional generation of images that are near-exact replicas of training data. This phenomenon poses legal and ethical risks concerning copyright, data ownership, and privacy. While the prevailing assumption is that image duplication in training sets is the sole cause, this paper investigates the role of text-to-image conditioning as a retrieval mechanism for memorized data, even when duplication levels are low.
Methods
The researchers utilized a two-pronged approach involving analysis and mitigation:
- Analysis via SSCD: They employed Self-Supervised Copy Detection (SSCD) to scan generations against a 400-million image subset of the LAION training dataset.
- Controlled Fine-tuning: To isolate variables, they fine-tuned Stable Diffusion v2.1 on smaller datasets (LAION-10k and Imagenette) while varying the "Data Duplication Factor" and the type of text conditioning.
- Mitigation Strategies:
- Training-time (Multiple Captions - MC): Using BLIP to generate 20 diverse captions for every training image to prevent the model from anchoring an image to a single retrieval trigger.
- Inference-time: Testing "plug-and-play" methods like adding Gaussian noise to text embeddings or injecting random tokens into user prompts to disrupt memorization during generation.
Key Insights: Captions as Retrieval Keys
A central finding is that models do not just memorize images in isolation; they memorize the association between a specific text string and an image. Highly unique or specific captions act like primary keys in a database. When these "keys" are provided as prompts, the model "unlocks" and reproduces the training image.
Furthermore, the study identifies a "Simple Image Trap," where models are more likely to memorize images with low complexity (e.g., logos or simple textures) because they are easier for the neural network to represent perfectly. Interestingly, "partial duplication"—repeating an image but with different captions—actually reduces memorization rates by preventing a single text trigger from becoming dominant.
Key Results
The study found that approximately 1.2% of images generated from real-world user prompts (DiffusionDB) were duplicates of training data, a figure likely to be an underestimation. In controlled settings, the relationship between duplication and copying is stark.
The Multiple Captions (MC) strategy emerged as the most effective mitigation. By training with 20 diverse captions per image, researchers reduced dataset similarity scores significantly (e.g., from 0.663 to 0.470) without sacrificing image quality. For existing models, inference-time fixes like adding random tokens (RT) proved to be a viable "band-aid," successfully disrupting the retrieval of memorized images with minimal impact on prompt alignment.
Limitations and Future Work
While the proposed mitigation strategies are effective, they involve a slight trade-off, as diversifying captions can marginally increase the Frechet Inception Distance (FID). Additionally, current detection methods like SSCD may miss subtle or transformed copies. Future research should explore how these findings scale to "from-scratch" training on billions of images and investigate automated "rejection sampling" systems to prevent the output of copyrighted content in real-time.
Summary updated