Attribution and Training-Data Transparency › Influence Estimation: From Documentation to Evidence
Language AI HandbookAll chapters Documentation tells us what data exists. Influence estimation asks how the model’s behavior would change if a training example were removed, downweighted, or added. Refitting on the changed data gives a direct comparison under a specified training protocol. At large model scales, repeating that refit for every training example can be prohibitively expensive. Some objectives admit exact deletion updates. In ridge least squares with a fixed positive penalty and the original sample divisor, the normal equations use the sum of feature outer products and the sum of features times their targets. Subtract the removed row’s contribution from each sum and solve the updated system with the same penalty. Guo et al. (2020), sections 3.1–3.2 derive a one-step Newton removal approximation for a convex linear-model loss with strongly convex L2 regularization. The step uses the remaining-data objective. Their gradient-residual bound also assumes a Lipschitz second derivative and bounded features and gradients.
The framing here is deliberately causal. Documentation is a statement about the contents of a dataset. Influence estimation is an attempt to answer a counterfactual question about the training process: what would have happened if this example had not been there? That question is well defined in principle and very expensive in practice. The rest of this section is about how far we can get with approximations, and what those approximations cost us.
The counterfactual question
Let the training set be , where each is an input-output pair or, for language modeling, a token sequence and its next-token targets. Define the empirical risk
where is the per-example loss and is an L2 regularization strength. Let
be the trained parameters. For a test example , define the test loss . The leave-one-out effect of training example is
where is the model retrained without example . A positive means removing the example increases test loss, so the example was helpful for this test point. A negative means removing the example decreases test loss, so the example was harmful for this test point.
It is worth dwelling on the direction of the inequality, because this is where most readers first get lost. The quantity compares two models: the model trained on the full data, and the same model retrained without example . If the test loss goes up when we remove the example, the full model was better at this test point because of that example, so we describe the example as helpful. If the test loss goes down when we remove the example, the example was actively hurting the full model at this test point, so we describe it as harmful. "Helpful" and "harmful" are always relative to a chosen test point and a chosen loss. The same example can be helpful for one test point and harmful for another, which is the target-specificity theme that runs through the whole chapter.
Directly evaluating by separate refits uses one optimization run per removed example. Influence functions approximate with gradients and a Hessian.
Repeated refits cost time, and training randomness can make their results hard to compare. Hold the training protocol fixed, pair the seeds where possible, and repeat the comparison if the target is an effect across training runs. Influence estimation uses a local linear approximation at the fitted model to estimate the effect of changing an example’s weight without another refit.
The influence function approximation
Set the weight of example to zero, leaving the original divisor and regularization strength fixed. This is the deletion convention used in the worked refits. Averaging over the remaining examples rescales the data term relative to the fixed penalty when ; if , the two objectives differ only by an overall positive scale.
At the trained parameters , the gradient of the full risk is zero:
Therefore the gradient of the leave-one-out risk at is
Let
be the Hessian of the regularized empirical risk at the optimum. Write , with the separate regularizer held fixed, and let be the stationary branch through at . Differentiating at zero gives there. The first-order response in , evaluated at , gives
In the approximation, removal displaces the parameters along the example gradient after preconditioning by the inverse Hessian. At a positive-definite optimum, gradient components along eigenvectors with small eigenvalues are amplified more.
The Hessian deserves an intuition, because it tends to appear as an opaque matrix. The Hessian describes curvature: how quickly the gradient changes as you move through parameter space. Along a Hessian eigenvector, the displacement needed to offset an added gradient component scales inversely with the corresponding positive eigenvalue. Small positive eigenvalues permit larger displacements for the same gradient component. Multiplying by is therefore a way of rescaling each gradient direction by how "stiff" the loss surface is there. In flat directions, the example's gradient has a lot of leverage. In stiff directions, it has little.
Now approximate the change in test loss:
The upweighting score differentiates the test loss along this stationary branch at , using the chain-rule construction from Koh and Liang (2017), section 2.1.
So
A positive predicts higher test loss under a sufficiently small upweighting of example . A negative value predicts lower test loss. The first-order removal estimate flips these signs. A finite deletion can move far enough that its direct refit has a different sign, even in a smooth convex example.
The reason this sign convention is so treacherous is that two natural questions point in opposite directions. "What happens to test loss if I remove this example?" and "What happens to test loss if I upweight this example?" point in opposite directions to first order. The size of the weight change is for removal from the objective above, so the derivative and estimated removal effect also differ by that factor. A table that lists "influence" without saying whether it is upweighting influence or leave-one-out effect is ambiguous to a reader who cannot see the code. The safest practice is to report the quantity you care about, state whether positive means helpful or harmful, and check the sign against a tiny worked case like the one later in this chapter.
The derivative assumes a smooth local branch near a stationary fit and a nonsingular Hessian there. Using it for deletion also assumes the local expansion stays accurate over the finite change. A smooth convex objective with a well-conditioned Hessian is a favorable setting. A nonconvex objective can have a suitable local minimum, but an SGD checkpoint may be far from stationary or have poorly conditioned curvature.
Practical approximations
Materializing a dense Hessian inverse is usually impractical for large models. For a model with parameters, a dense Hessian has entries. Practical methods avoid materializing it:
- Damping: replace with , where is a small positive scalar. For positive semidefinite , positive damping can improve conditioning. For indefinite , check the shifted spectrum before drawing that conclusion.
- Hessian-vector products: use automatic differentiation to compute without forming , then use an iterative linear solver. Use standard conjugate gradient for a fixed symmetric positive-definite system.
- Checkpoint gradients: TracInCP estimates influence using gradient dot products evaluated at saved model checkpoints.
- Random projections: project gradients into a lower-dimensional space before estimating influence. This is the strategy behind TRAK and related scalable methods.
- Model ensembles: train many models on different subsets and fit a surrogate from data inclusion to outputs. This is the datamodels approach.
- Retrieval and similarity: use embeddings, BM25, or exact matching to locate training examples that resemble the output. Use these matches to choose items for closer inspection.
Adding shifts every eigenvalue by . With an indefinite Hessian, a small shift can bring a negative eigenvalue closer to zero, making the inverse more sensitive. A shift larger than the magnitude of the most negative eigenvalue makes the matrix positive definite. Damping changes the inverse used by the estimator, and its signed dot products may increase or decrease in magnitude or change rank.
When the operator is symmetric positive definite, conjugate gradient approximates the solution of with one operator application per ordinary iteration. Automatic differentiation can compute each Hessian-vector product without storing the dense Hessian. A full-risk product may still require accumulating contributions from many batches. Keep the checkpoint, damping, and data defining the operator fixed across iterations, including when using a fixed subset to approximate the full-risk curvature. Changing the sampled batch can change the operator even when every batch Hessian is positive definite. When reporting a solve cost, specify the batches, differentiation implementation, operator conditioning, and residual tolerance.
TracInCP uses saved model parameters from the training trajectory. At each checkpoint, it computes the training-example and test-example loss gradients, takes their dot product, and weights it by the learning rate for the interval ending at that checkpoint. The sum approximates the training example’s contribution to reducing the test loss along the trajectory. In the original derivation, each example is visited once per interval and the learning rate is constant within the interval. The checkpoint approximation can also serve as a heuristic when those conditions fail. It uses first derivatives. Pruthi et al. (2020), section 3.3
TRAK projects model-output gradients into a smaller space before using them in its kernel calculation. With a suitable projection dimension, the sketch approximately preserves gradient inner products with high probability. Approximation error can change the order of scores that are close together. Park et al. (2023), section 3
A datamodel uses predictions from models trained on many subsets of a fixed dataset. It fits a surrogate that predicts the model’s output on a chosen target using only which examples the subset contains. You can use it to estimate the effect of adding a candidate from that fixed dataset to a subset or removing one from it. Accuracy depends on which subsets were sampled, how many fits were available, and the choice of surrogate. Ilyas et al. (2022), sections 2 and 3
Retrieval scores similarity. Given a model output, retrieve the most similar training documents and use the matches to prioritize inspection. An influence method estimates how a specified change to the training data affects a target. A causal attribution claim needs evidence from a training-data intervention.
Each approximation answers a slightly different question. Influence functions estimate a local parameter effect. TracIn estimates a path-dependent gradient alignment. Datamodels use many trained models to predict outcomes under different choices of training examples. Retrieval estimates similarity. Name the method and target in the report.
Variants and tradeoffs
| Method | What it estimates | Main cost | Strengths | Important limits |
|---|---|---|---|---|
| Influence functions | Local effect of upweighting an example on a target | Hessian-vector products | Grounded in a clear counterfactual | Requires suitable local curvature near a stationary fit; finite refits can disagree |
| TracIn | Gradient alignment across training checkpoints | Checkpoint storage and gradient computation | Uses training trajectory; no Hessian | Path-dependent; sensitive to checkpoint choice |
| Datamodels | Predicted effect of changing which examples from a fixed dataset are included in training | Many trained models | Can score subsets that were not among the surrogate’s training inputs | Expensive, and the surrogate’s accuracy can vary across interventions |
| TRAK | Scalable approximation to influence | Random projections and trained models | Designed for large models | Approximate; assumptions about model and target |
| Data Shapley | Fair credit allocation among training examples | Exponential exact cost; sampling approximations | Axiomatic fairness properties | Utility function choice changes the answer |
| Similarity search | Nearest training examples by embedding or lexical match | Building and querying an index | Retrieves candidates for inspection | Measures similarity |
| Ablation and retraining | Target change under the specified data intervention | Separate refits, which can be costly | Compare fits under the same training protocol | Repeat stochastic fits to estimate an average effect |
| Memorization and extraction tests | Whether an output reproduces training text | Prompt generation and matching | Direct evidence of overlap | Does not measure general influence |
Use the question to choose a method. Similarity search can give you candidates to inspect. A controlled ablation can measure what changes under a specified intervention.
Two rows deserve special comment because they are often confused. Data Shapley is appealing because it comes with fairness axioms: it credits examples according to their marginal contribution to a chosen utility function, and it satisfies properties like symmetry and additivity. The catch is that the utility function is a modeling choice. Two teams can run Data Shapley on the same corpus and get different rankings because they defined "utility" differently, and neither is wrong. A Shapley attribution is always an attribution with respect to a stated utility, not an attribution in the abstract.
Memorization tests ask whether a model can reproduce training text, for example when prompted with a prefix. Use the resulting match to report overlap. To measure an effect on wider behavior, choose a target for that behavior and run an intervention. A training example can affect a target without being memorized verbatim.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!