Abstract
State-of-the-art diffusion models are capable of generating high-fidelity images, yet they are prone to "memorization"—the unintended replication of specific training samples. This phenomenon poses significant risks to data privacy and copyright integrity. This paper introduces a novel geometric framework for detecting memorized content by analyzing the learned score function of diffusion models. By applying the $p$-Laplace operator, we can quantify the "outward flux" of probability density around an image. Our findings reveal that the 1-Laplace operator, which relies on the direction rather than the magnitude of the score function, is exceptionally robust. Notably, our method maintains high detection accuracy (AUC 0.913) even when the original text prompts are unavailable, a scenario where traditional detection methods typically fail.
1. Introduction
As diffusion models become the standard for generative AI, understanding their tendency to memorize training data has become a critical research priority. Memorization occurs when a model assigns an unnaturally high probability mass to a sparse training sample, creating a local maximum or "bump" in the learned probability landscape. Detecting these bumps is challenging because diffusion models do not provide direct access to the probability density function; instead, they estimate the score function (the gradient of the log-probability).
This paper addresses the challenge of identifying these memorized samples by leveraging higher-order geometric features of the score function. We propose using the $p$-Laplace operator to identify the sharp inward-pointing gradients characteristic of memorized data points.
2. Methodology: The $p$-Laplace Framework
The $p$-Laplace is a differential operator used to measure the flux of a vector field. In the context of diffusion models, we use it to measure the flux of the probability density around a specific point in the latent space. Around a memorized "bump," the gradient vectors point sharply inward toward the local maximum, resulting in a highly negative flux value.
2.1 Numerical Estimators
Since the true data distribution is unknown, we developed two Monte Carlo approximation methods to estimate the $p$-Laplace using the model's score function:
- Volume Integral: This method samples points within a small neighborhood ball around the target image.
- Boundary Integral: This method samples points specifically on the surface (boundary) of that neighborhood ball.
Theoretical analysis and empirical testing demonstrated that the Boundary Integral formulation provides significantly lower variance and higher reliability than the Volume Integral.
2.2 The Significance of $p=1$
A key insight of this research is that diffusion models are often more accurate at predicting the direction of the score function than its magnitude. Standard Laplace operators ($p=2$) are sensitive to magnitude errors, leading to noisy results. By utilizing the 1-Laplace operator, we normalize the gradients, relying solely on the directional information. This choice makes the detection mechanism far more resilient to the inherent approximation errors of the diffusion model.
3. Experimental Setup
3.1 Synthetic Validation
We first validated the framework using 2-dimensional Gaussian Mixture Models (GMMs). To simulate memorization, we trained a model on 1,000 standard samples and 250 duplicates of a single point. The 1-Laplace boundary estimator successfully isolated the memorized point, assigning it the lowest percentile flux value and validating our theoretical error bounds.
3.2 Real-World Application
We tested the method on Stable Diffusion v1.4 (trained on LAION-5B). The evaluation benchmark consisted of:
- Memorized Set: ~3,000 images generated from 500 known memorized prompts.
- Control Set: Images generated from 500 non-memorized prompts created by a Large Language Model (LLM).
4. Key Results
The $p$-Laplace method demonstrates state-of-the-art performance across different detection regimes:
- Prompt-Aware Detection: When the conditioning text prompt is known, the 1-Laplace method achieved an AUC of 0.958, matching the performance of existing specialized baselines.
- Promptless (Post-Generation) Detection: In the more difficult scenario where the text prompt is unknown, existing methods fail, dropping to a near-random AUC of 0.502. In contrast, our 1-Laplace method maintained an AUC of 0.913, representing a 61% improvement over the baseline.
5. Discussion and Limitations
While the $p$-Laplace analysis is highly effective, it introduces some computational overhead. Approximating the boundary integral requires multiple score evaluations (e.g., 64 samples per image), which is more intensive than a single forward pass. Additionally, because high-resolution analysis is performed in the VAE latent space, potential artifacts from VAE reconstruction must be considered, though our results suggest the method remains robust to these factors.
6. Conclusion
By shifting the focus from prompt-based analysis to the intrinsic geometry of the learned score function, we provide a powerful new tool for auditing diffusion models. The 1-Laplace operator offers a mathematically grounded and empirically robust way to detect memorization, even in the absence of original metadata. This work opens new avenues for studying the geometric properties of generative models throughout the denoising process.
Summary updated