DMin: Scalable Training Data Influence Estimation for Diffusion Models

Huawei Lin, Yingjie Lao, Weijie Zhao

TL;DR

DMin (Diffusion Model influence) is the first scalable framework capable of tracking training data influence for billion-parameter diffusion models like Stable Diffusion 3. By combining a first-order gradient approximation with a novel 4-step gradient compression technique and KNN indexing, DMin slashes storage requirements from hundreds of terabytes to mere megabytes and retrieves the most influential training samples in under a second.

What Problem Does This Paper Address?

Diffusion models (DMs) generate stunning imagery, but because they are trained on massive, uncurated datasets scraped from the internet, they can inadvertently replicate biases, copyright infringements, or harmful content. To understand and debug these models, researchers use influence estimation—a technique that answers the question: Which specific training images most heavily influenced this newly generated image?

Existing influence estimation methods (like DataInf or D-TRAK) are computationally bottlenecked. They either require calculating second-order Hessian matrix inversions or storing massive random projection matrices. For a modern, full-precision model like Stable Diffusion 3 Medium (with billions of parameters), storing uncompressed gradients across multiple timesteps for thousands of training images requires hundreds of terabytes (TBs) of storage. This makes data tracing completely impractical for large-scale production models.

Methods

DMin tackles the scalability wall through three core innovations: first-order approximation, a matrix-free gradient compression pipeline, and fast approximate nearest neighbor search.

Overview of the DMin framework showing gradient computation, compression, and KNN index construction.
  1. First-Order Formulation: To bypass the impossible cost of computing and inverting a Hessian matrix, DMin utilizes a first-order Taylor expansion of the loss function across sampled timesteps, tracking how the loss changes relative to the training samples.
  2. 4-Step Gradient Compression: Standard random projection requires multiplying gradients by a massive projection matrix, which itself can take up terabytes of space. DMin introduces a clever, matrix-free alternative:
  3. Padding: Appends zeros to the gradient vector to reach a target length.
  4. Permutation: Randomly shuffles the vector to break up inherent structures.
  5. Binary Projection: Performs element-wise multiplication with a simple binary vector ($\pm1$), which takes only 1 bit per element to store.
  6. Group Addition: Divides the vector into groups and sums the elements within each group to output a highly compressed vector of dimension $v$.
  7. L2 Normalization: Deep architectures suffer from gradient instability, where unusually large gradient magnitudes can dominate and ruin the influence calculation. DMin applies L2 normalization to the gradient vectors before compression to ensure stability.
  8. KNN Index Construction: Once compressed, the training gradients are concatenated across timesteps and loaded into a Hierarchical Navigable Small World (HNSW) graph index. Finding the most influential images for a new generation becomes a fast vector search query rather than an exhaustive dataset scan.

Datasets

The authors evaluated DMin across both conditional (text-to-image) and unconditional generation tasks:

  • Conditional Text-to-Image: A combined dataset of six Hugging Face repositories totaling 9,288 image-prompt pairs. The authors specifically tracked retrieval accuracy from three distinct sub-domains: Flowers (162 pairs), Lego Sets (40 pairs), and Magic Cards (1,541 pairs).
  • Unconditional Generation: Standard benchmarks using MNIST and CIFAR-10 modeled via Denoising Diffusion Probabilistic Models (DDPM).

Key Insights and Ideas

  • The Necessity of Normalization: A key "aha" moment in the paper highlights that influence estimation in exceptionally deep models (like Diffusion Transformers) is incredibly fragile. Without L2 normalization, a few exploding gradient values completely break the inner product calculations, leading to incorrect data attribution.
  • KNN as a Regularizer: Surprisingly, using an approximate K-Nearest Neighbors (KNN) search often outperformed exact inner product matching in detection rates. The authors suggest that the graph-based approximation acts as a smoothing mechanism, capturing a broader and more semantically representative neighborhood of influential samples.
  • Bypassing the Matrix Bottleneck: By replacing traditional matrix multiplication with a combination of random permutation and group addition, DMin completely eliminates the need to store or dynamically generate massive projection matrices.

Key Results

Drastic Storage Reductions

For the full-parameter Stable Diffusion 3 Medium model, caching uncompressed gradients requires an impossible 339.39 TB. DMin ($v=2^{12}$) compresses this entire footprint down to just 726 MB—representing a staggering compression ratio of 0.00017%.

Sub-Second Retrieval Speeds

While classic second-order methods like LiSSA or DataInf take anywhere from 7 to 17 hours to run an influence query across the dataset, DMin with KNN index retrieval handles the task on-the-fly:

  • Top-5 retrieval: 0.009 seconds
  • Top-100 retrieval: 0.131 seconds

Superior Detection Accuracy

DMin consistently outperformed baselines (including CLIP similarity and alternative influence frameworks like Journey-TRAK and D-TRAK) at identifying the correct source domain of a generated image. On the unconditional MNIST dataset, DMin achieved a Top-5 detection rate of 0.8006, compared to Journey-TRAK's 0.2560 and D-TRAK's 0.1264.

Figure 3. Examples of generated images alongside the most and least influential samples (from left to right) as estimated by DMin for unconditional DDPM models on the MNIST and CIFAR-10 datasets.

Limitations and Future Work

While DMin achieves remarkable scalability, a few limitations remain:

  • First-Order Simplification: To remain scalable, DMin omits second-order cross-timestep dependencies. While the empirical results are strong, some nuanced training dynamics that span across different timesteps might be missed.
  • One-Time Offline Cost: Computing the initial gradients for the training dataset is still computationally heavy before compression occurs (e.g., requiring 330 GPU hours for the full Stable Diffusion 3 model). However, this is a one-time preprocessing step.

Summary updated

BibTeX
@inproceedings{lin2026dmin,
  author = {Huawei Lin and Yingjie Lao and Weijie Zhao},
  title = {{DMin: Scalable Training Data Influence Estimation for Diffusion Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=9iEPo0CSJo},
}
Figure