TL;DR
When a neural network makes a surprising prediction, training data attribution (TDA) methods try to point to the exact training examples responsible. Until now, evaluating and comparing these methods has been a messy, non-reproducible affair scattered across incompatible codebases. quanda fixes this by providing an open-source PyTorch toolkit with a standardized interface, 11 evaluation metrics, and ready-to-use benchmarks across vision, text, and language modeling—revealing that no single TDA method wins everywhere.
What Problem Does This Paper Address?
If you want to know why a model predicted "panda," feature attribution methods highlight pixels in the test image. Training data attribution (TDA) takes a different approach: it traces the prediction back to the training set, asking which training examples pushed the model toward that decision. This is useful for debugging mislabeled data, spotting spurious shortcuts, and tracing facts in large language models.
The catch? Evaluating whether a TDA method actually works is notoriously difficult. Ideally, you would compute "ground truth" by removing a training point, retraining the model from scratch, and measuring the change—a process called Leave-One-Out (LOO) retraining. At deep learning scales, that is computationally brutal and noisy. Researchers have therefore invented cheaper proxies: downstream tasks (like catching mislabeled examples) and sanity-check heuristics.
Because each paper implements its own evaluation quirks, results are rarely comparable. Existing libraries like dattri or DATE-LM cover only a handful of metrics or a single modality, and none make it easy to plug in a brand-new TDA method.
Methods
quanda (built for PyTorch and available via PyPI) unifies TDA evaluation around three modular base classes:
Explainer: Wraps TDA methods—including existing implementations from Captum, TRAK, Kronfluence, dattri, and Representer Points—behind a uniformexplain()andself_influence()interface.Metric: Uses a statefulupdate()andcompute()design so users can evaluate attributions incrementally on batches.Benchmark: Bundles a model, datasets, and a metric into a reproducible package. Pre-configured benchmarks can be loaded directly from Hugging Face viaload_pretrained(), or built from scratch via YAML configs.
To capture different facets of attribution quality, quanda implements 11 metrics across three families:
- Ground-Truth: Linear Datamodeling Score (LDS), which measures how well attribution scores predict actual model outputs when trained on random subsets of data.
- Downstream-Task Evaluators: Class Detection, Subclass Detection, Mislabeling Detection, Shortcut Detection, and Fact Tracing (using MRR, Recall@k, and Tail-Patch).
- Heuristics: Mixed Datasets Separation, Model Randomization (checking if attributions actually depend on trained weights rather than just input similarity), and Top-k Cardinality (checking if a method lazily assigns high scores to the same few training points).
Datasets
The authors showcase quanda's ready-made benchmarks across three modalities and model families:
- Image Classification: Animals with Attributes 2 (AwA2) using a ResNet-50.
- Text Classification: QNLI (from GLUE) using a fine-tuned BERT.
- Language Modeling (Fact Tracing): T-REx using GPT-2 small.
(The library also includes pre-built benchmarks for MNIST/LeNet-5 and CIFAR-10/ResNet-9.)
Key Insights and Ideas
- No method rules them all: Across every setting, method rankings shift dramatically depending on what you measure. A method that excels at approximating counterfactual retraining (LDS) can flop on downstream debugging tasks, and vice versa.
- Cheap similarity beats fancy gradients on similarity tasks: On both image and text classification, a simple representation-space similarity baseline (
RepSim) dominates tasks like Class, Subclass, and Shortcut Detection. That makes intuitive sense—those tasks reward finding training examples that look like the test sample. However,RepSimcompletely collapses (scoring a trivial 0.5) on Mislabeling Detection. - Trajectory matters, but isn't a silver bullet:
TracInCP, which aggregates gradient information across training checkpoints, posts strong overall numbers on AwA2, yet still performs near-random on Subclass and Shortcut Detection.
Key Results
- Image & Text Classification (AwA2 & QNLI): Counterfactual-oriented gradient methods (
TRAK-1andEK-FAC) substantially outperformRepSimon LDS in text classification, though LDS scores on AwA2 remain uniformly low across all methods.ReprPointsdelivers near-random performance on most tasks outside Class Detection, likely due to its sensitivity to model convergence.
- Language Modeling Fact Tracing (T-REx / GPT-2): Influence-function approximations take the lead here.
EK-FACranks first across all three fact-tracing metrics (MRR, Recall@3, and Tail-Patch), followed byDataInf, whileRepSimandTRAK-1trail behind. Still, absolute scores are low enough that reliably retrieving fact-supporting training examples remains largely out of reach.
Limitations and Future Work
The authors are upfront about current boundaries:
- Single-model focus: quanda currently attributes decisions of a single trained model, without support for ensembled TDA variants like full TRAK.
- LLM training scale: Language modeling is currently limited to fact tracing; training custom benchmarks from scratch for LLMs isn't supported yet due to pretraining costs.
- Metric caveats: Controlled tasks (like Shortcut or Mislabeling Detection) aren't general-purpose quality estimators, heuristics only flag failure modes rather than proving quality, and absolute metric scores can shift noticeably with hyperparameter changes.
Future releases aim to add ensemble support, expand TDA wrappers, and grow the benchmark suite with community contributions.
Summary updated