Abstract
Data attribution methods aim to quantify the influence of individual training samples on the prediction of artificial intelligence (AI) models. As training data plays an increasingly crucial role in the modern development of large-scale AI models, data attribution has found broad applications in improving AI performance and safety. However, despite a surge of new data attribution methods being developed recently, there lacks a comprehensive library that facilitates the development, benchmarking, and deployment of different data attribution methods. In this work, we introduce dattri, an open-source data attribution library that addresses the above needs. Specifically, dattri highlights three novel design features: a unified and easy-to-use API, modularized low-level utility functions, and a comprehensive benchmark framework with pre-trained models and ground truth annotations.
Introduction
As AI models scale, the quality of training data has become as critical as the model architecture itself. Data attribution helps answer fundamental questions about model behavior, such as identifying which training samples caused a specific misclassification or influenced a generative model's response. These insights are vital for detecting noisy labels, improving data selection, and addressing copyright concerns.
However, implementing state-of-the-art attribution methods like Influence Functions (IF) or TRAK is often a "reimplementation nightmare." These methods are mathematically complex, requiring sophisticated operations like Hessian-vector products (HVP) and internal gradient extractions. Furthermore, benchmarking these methods is computationally prohibitive, as establishing "ground truth" typically requires retraining models thousands of times (Leave-One-Out training). dattri solves these challenges by providing a standardized, efficient infrastructure for the PyTorch ecosystem.
Methods and Design
The dattri library is built upon three core pillars designed to streamline both research and deployment:
- Unified API: The library introduces an
AttributionTaskobject that encapsulates the model, loss function, and checkpoints. This abstraction allows users to switch between different attribution algorithms (e.g., fromTracIntoTRAK) with minimal code changes. - Modular Low-Level Utilities: Many attribution methods rely on shared mathematical operations.
dattrimodularizes these into reusable functions, such as HVP, Inverse-HVP (IHVP), and random projections. This modularity allows researchers to develop new methods without reinventing foundational components. - Minimal Code Invasion: Unlike previous tools that required significant modifications to training loops,
dattriutilizes helper decorators to extract necessary information, such as gradients or hidden representations, directly from standard PyTorch pipelines.
Benchmark Framework and Datasets
To facilitate fair comparison, dattri includes a comprehensive benchmark suite covering diverse tasks:
- Image Classification: MNIST-10 (using Logistic Regression and MLP) and CIFAR-2/CIFAR-10 (using ResNet-9).
- Generative AI: Music generation with a Music Transformer on the MAESTRO dataset, and text generation with NanoGPT on the Shakespeare dataset.
A key contribution of dattri is the provision of pre-trained model checkpoints (over 5,000 for MNIST) and ground truth annotations. This allows the community to evaluate new attribution methods without the massive computational cost of model retraining.
Results and Analysis
Using dattri, the authors performed a comprehensive benchmark across four major families of attribution methods: IF, TracIn, RPS, and TRAK.
- Model Complexity: Influence Functions (IF) perform exceptionally well on linear models like Logistic Regression but struggle as models become non-linear and non-convex, such as ResNets.
- Robustness of Ensembling: TRAK-50 (which ensembles 50 models) emerged as the most robust method for modern neural networks, consistently achieving high Linear Datamodeling Scores (LDS).
- Efficiency: Representer Point Selection (RPS) was identified as the most computationally efficient method, as it focuses solely on the parameters of the final layer.
Conclusion and Future Work
dattri provides a much-needed standard for the data attribution community. While the current version covers a wide range of efficient methods, future updates aim to include game-theoretic methods like Data Shapley and optimize the library for billion-parameter scale models. By lowering the barrier to entry, dattri enables more rigorous and accessible research into model influence and data quality.
The source code is available at https://github.com/TRAIS-Lab/dattri.
Summary updated