Data Attribution for Diffusion Models: Timestep-induced Bias in Influence Estimation

Tong Xie, Haoyu Li, Andrew Bai, Cho-Jui Hsieh

Abstract

Data attribution methods trace model behavior back to its training dataset, offering an effective approach to better understand "black-box" neural networks. While prior research established quantifiable links between model output and training data in diverse settings, interpreting diffusion model outputs in relation to training samples remains underexplored. In particular, diffusion models operate over a sequence of timesteps instead of instantaneous input-output relationships, posing a significant challenge to extend existing frameworks directly. We present Diffusion-TracIn, which incorporates these temporal dynamics, and observe that samples' loss gradient norms are highly dependent on the timestep. This trend leads to a prominent bias in influence estimation, particularly for samples trained on large-norm-inducing timesteps, causing them to be "generally influential." To mitigate this bias, we introduce Diffusion-ReTrac, a re-normalized adaptation that retrieves training samples targeted to the test sample of interest, enabling localized influence measurement and more intuitive visualization. We demonstrate the efficacy of our approach through various evaluation metrics, outperforming existing methods in attribution specificity by over 60%.

The Challenge of Data Attribution in Diffusion

Data attribution serves as the "detective work" of machine learning, aiming to identify which specific training images caused a model to generate a particular output. This is crucial for interpretability, debugging, and ensuring fair credit for artists. While tools exist for simple classification tasks, diffusion models present a unique challenge. Unlike standard networks that make one-shot predictions, diffusion is a temporal process that iteratively transforms noise into an image over hundreds of timesteps.

Existing attribution methods, such as TracIn, often fail in this context because they are "blinded" by training dynamics. Specifically, the gradients—the mathematical signals used to measure influence—are significantly larger at certain timesteps than others. This creates a bias where a training sample processed at a "high-norm" timestep appears universally influential to every generated image, regardless of visual similarity.

Identifying Timestep-induced Bias

The core discovery of this research is the "timestep-induced bias." The authors found that a training sample's gradient norm is primarily a function of the timestep at which it was processed, rather than its specific content.

Figure 2: Gradient norms plotted against training timesteps for Artbench-2 at checkpoint 100, showing how norms systematically increase at later timesteps.

As shown in Figure 2, there is a clear upward trend in gradient norms as timesteps increase. This means samples trained at later stages of denoising naturally exert more "influence" in standard calculations simply due to their larger gradient magnitudes. This leads to the "generally influential" trap, where a few samples appear to be the source of almost every generated image.

Figure 1: Norm Ranking vs. Distance to Argmax, illustrating the linear relationship between gradient magnitude and general influence.

Figure 1 provides striking evidence for this phenomenon, showing a strong correlation between a sample's norm ranking and its perceived influence across the dataset. The researchers found these samples weren't actually special; they just happened to be trained at timesteps where the gradient norms were naturally high.

Proposed Solutions: Diffusion-TracIn and Diffusion-ReTrac

To address these challenges, the researchers introduced two primary frameworks:

  1. Diffusion-TracIn: An extension of the TracIn method that calculates influence by measuring the alignment between training and test sample gradients across different noise levels and timesteps using Monte Carlo sampling.
  2. Diffusion-ReTrac: The proposed "fix" for timestep bias. ReTrac re-normalizes gradients by dividing vectors by their own magnitude (norm). This ensures influence is measured by the direction of the update (alignment) rather than the size of the update, effectively neutralizing the timestep-induced bias.

To maintain computational efficiency, the authors also developed Timestep Sparse Sampling, demonstrating that accurate influence estimates can be obtained using only a small subset of evenly spaced timesteps (e.g., 50 out of 1000), resulting in a 20-fold speedup.

Experimental Results

The methods were evaluated across diverse datasets including Artbench-2, CIFAR-10, MNIST, Tiny ImageNet, and CelebA.

  • Superior Specificity: Diffusion-ReTrac outperformed Diffusion-TracIn in "targetedness" by over 60% on CelebA and Artbench-2. It retrieved a more diverse and relevant set of training samples that shared actual visual or semantic features with the generated output.
  • Accurate Image Tracing: In a controlled experiment with a model trained on both airplanes and MNIST digits, ReTrac perfectly attributed generated digits to the MNIST training set. In contrast, standard TracIn incorrectly identified airplanes as the primary influence due to the norm bias.

Conclusion and Future Work

While Diffusion-ReTrac significantly improves data attribution for diffusion models, some limitations remain. The method currently requires access to training checkpoints and specific timesteps, which may not be available for "closed" proprietary models. Future work includes extending this framework to Latent Diffusion Models (like Stable Diffusion) and developing a deeper theoretical understanding of why specific timesteps induce larger gradient norms.

Summary updated

BibTeX
@article{xie2024data,
  author = {Tong Xie and Haoyu Li and Andrew Bai and Cho-Jui Hsieh},
  title = {{Data Attribution for Diffusion Models: Timestep-induced Bias in Influence Estimation}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=P3Lyun7CZs},
}
Figure