Training data attribution

Also known as: TDA

On this page 7

Training data attribution (TDA) is the family of methods that traces a model output back to the training examples that most influenced it, assigning each example a score for how much it pushed a given prediction up or down. Within Explainable AI, it answers a question that feature attribution cannot: not which input features mattered, but which training data taught the model to behave this way.

TDA treats the training set as the object of explanation. The ideal answer is counterfactual: how would this prediction change if a particular example had been removed and the model retrained? Because exact retraining is far too expensive for modern models, practical TDA methods are approximations of that leave-one-out effect, and their quality depends on how well they capture it.

How training data attribution estimates influence

Every TDA method produces an attribution score for each pair of a test example and a training example. A positive score means the training example supported the prediction, and a negative score means it opposed it. The scores are usually computed from gradients of the loss, from learned representations or from repeated training on data subsets.

The main method families differ in what they approximate and what they cost. The table below compares the approaches most often used in research and practice.

Method familyCore ideaRelative costTypical weakness
Leave-one-out retrainingRetrain without each example and compare outputsProhibitive at scaleNoisy for non-convex models
Influence functionsApproximate removal with gradients and the inverse HessianHighFragile in deep networks
Gradient tracing (TracIn)Sum gradient dot products across training checkpointsModerateNeeds stored checkpoints
TRAKProjects gradients randomly and uses a linearized modelModerateApproximation error on small ensembles
DatamodelsFit a linear predictor over many subset trainingsVery highThousands of training runs
Representation similarityRanks examples by embedding similarityLowMeasures likeness, not causation
Main families of training data attribution methods

Gradient-based methods share one assumption: that a small change in training weight produces a roughly linear change in the output. This holds well for convex models such as logistic regression, but only approximately for deep networks trained with stochastic optimization.

TDA is a data-centric explanation, whereas most interpretability methods are input-centric or model-centric. It is closely related to example-based explanation, but adds a causal claim about training, not just similarity.

The comparison below places training data attribution among neighboring concepts in the same field.

ConceptQuestion it answersUnit of explanation
Training data attributionWhich training examples caused this outputTraining examples
Feature attributionWhich input features drove this outputInput features
Example-based explanationWhich known cases look similarSimilar instances
Mechanistic interpretabilityWhich internal circuits compute the outputNeurons and circuits
Data valuationHow much an example helps overall performanceTraining examples, global
Training data attribution compared with neighboring concepts

The influence function is one specific technique inside TDA, so the two terms are not synonyms. Data valuation methods, such as Data Shapley, are closely related but usually assign a single global value per example rather than a score for each individual prediction.

Practical uses of training data attribution

TDA is most valuable when a team needs to act on the training data rather than on the model. Typical tasks include debugging, data cleaning, provenance analysis and auditing large language models.

Use caseWhat TDA revealsTypical action
Debugging wrong predictionsTraining examples that support the errorFix or remove those examples
Detecting mislabeled dataExamples with strong self-influenceSend for relabeling
Data poisoning forensicsInjected examples behind a backdoorPurge and retrain
Memorization analysisSources of verbatim outputs in LLMsDeduplicate or filter data
Copyright and provenanceCandidate sources of generated contentSupport licensing review
Common applications and what TDA contributes

A useful diagnostic is self-influence, the influence of a training example on its own prediction. Examples with unusually high self-influence are often mislabeled, rare or memorized, which makes the score an efficient ranking for manual data review.

Evaluating attribution quality

Attribution scores cannot be checked by inspection alone, so quality is measured with counterfactual tests. The most common is the linear datamodeling score (LDS), which measures how well attributions predict model outputs after retraining on random data subsets.

Another standard test removes the top-k most influential examples, retrains the model and checks whether the prediction flips or weakens. If removing high-ranked examples changes nothing, the method is not faithful to the real training dynamics, however plausible its rankings appear.

Evaluation itself is expensive and partly stochastic, because retraining a neural network with a different random seed already changes predictions. Careful studies therefore average over several seeds before attributing a change to the removed data.

Choosing a method is therefore a trade-off between faithfulness and cost. For small tabular or convex models, exact influence functions or even direct leave-one-out retraining are feasible and give the most trustworthy scores. For mid-sized vision and language models, TRAK or checkpoint-based tracing usually offers the best balance. For large language models, teams typically restrict attribution to a candidate subset of training documents, retrieved first by embedding search, and then compute gradient-based scores only on that subset. Whatever the method, reporting the evaluation metric alongside the rankings allows reviewers to judge how much the attributions can be trusted.

Limitations and open problems

Training data attribution remains an active research area with known weaknesses. The most important limitations for practitioners are listed below.

  • Scalability is the main barrier: storing per-example gradients for billions of tokens requires projection, sampling or approximation.
  • Influence functions can be poorly correlated with true leave-one-out effects in deep, non-convex networks.
  • Results depend on checkpoint, seed and hyperparameter choices, so rankings may be unstable between runs.
  • Many near-duplicate examples share influence, which hides the importance of the whole cluster.
  • High scores show correlation within the approximation, not proof of legal or causal responsibility.

For these reasons, attribution scores are best treated as ranked hypotheses for investigation, verified through targeted retraining or ablation when decisions carry real consequences.

A non-technical view

A model learns from many examples. Sometimes we want to know which examples taught it a particular answer. Training data attribution finds those examples.

Picture a student who gives a strange answer on a test. A teacher looks back through the homework and finds the exercise that taught the wrong idea. TDA does the same for a model. It points to the training examples most responsible for an answer, so people can fix bad data or understand the result.

A concrete example

A medical imaging team trains a classifier on 120,000 chest X-rays to flag pneumonia. In validation, it misclassifies several healthy scans from one hospital as positive. Feature attribution shows the model focusing on a corner of the image, but it does not explain why.

The team runs a gradient-tracing attribution method on 40 misclassified scans. The top-ranked training examples for nearly all of them are positive cases from a single ward whose scanner adds a small text marker in that corner. The model had learned the marker, not the disease. After cropping the markers and retraining, false positives from that hospital fall from 9% to under 2%, and the team adds a marker check to its data pipeline.