| Training and influence | |
|---|---|
| training set of examples | |
| training example : input and label | |
| target example whose output is attributed | |
| the model's weights | |
| loss on example , regularizer included | |
| empirical risk | |
| trained weights, the minimizer of | |
| loss gradients of , , and at | |
| Hessian of at | |
| extra weight given to one example | |
| minimizer of | |
| influence of upweighting on the target's loss | |
| Gauss-Newton Hessian, used in place of for language models | |
| damping added to or as | |
| Datamodels and TRAK | |
| a subset of the training set | |
| weights from training on ; | |
| model output being attributed (margin, log-odds or log-probability) | |
| 0/1 vector marking the examples in | |
| datamodel weights and intercept; the paper writes | |
| fraction of the training set in each random subset | |
| number of networks trained to fit a datamodel | |
| attribution score of training example | |
| Spearman rank correlation over subsets | |
| probability of the correct label, for the target and for | |
| random Gaussian projection with columns | |
| projected gradient of ; the matrix of them | |
| diagonal matrix of | |
| number of models TRAK averages over | |
| LESS | |
| warm-up checkpoint | |
| average learning rate in warm-up epoch | |
| Adam update direction for example | |
| mean gradient of the target task's few examples | |
| Paper symbols | |
| what Ilyas et al. and Park et al. write for , | |
Context. Saying that bursty sequencestraining sequences in which a class recurs several times; with many rare classes they made a small transformer learn in context (Chan et al., 2022). Reading note: Data properties behind in-context learning and factual recall produce in-context learning, or that code teaches arithmetic, is a counterfactual claim. It says the model would behave differently under different training data. The direct test removes the data and retrains from scratch, which demands a fresh run for every candidate set. Data attribution avoids that cost by scoring how much each training example shifts a target prediction. Koh and Liang (2017) brought influence functionsthe derivative of an estimator with respect to the weight on one observation, approximating leave-one-out deletion (Hampel, 1974) from robust statistics into deep learning.
Data attribution methods estimate how a target output changes when the training set changes, differing in how much retraining they spend. Influence functions do no retraining. They take one Newton step from the trained weights, matching leave-one-out retraining on convex models but predicting from-scratch retraining poorly on deep networks. Datamodels sit at the other extreme. They retrain on thousands of random subsets, fit the output linearly in which examples were included, and accurately predict removing chosen sets. TRAK applies the Newton step to a linearized network averaged over a few models. It matches datamodels' retraining accuracy at a fiftieth to a hundredth of their compute. At large language-model scale, only single-model influence is affordable. Validation there checks a local stand-in rather than full retraining; retraining checks cover only fine-tuning sets, and pretraining conclusions remain untested by retraining.
Setting. A training set holds input-label pairs . Training returns weights that minimize the empirical risk , with any regularizer folded into the loss . To differentiate with respect to the data, Koh and Liang assume is twice differentiable and strictly convex, with a positive definite Hessian at its minimizer why: then the minimizer is unique and, by the implicit function theorem, moves smoothly as an example's weight changes; strict convexity alone allows a singular Hessian, and deep networks have neither property. Give one example an extra weight , so training minimizes at . Write , the loss gradient of example at the trained weights; is the gradient for for its loss gradient at and , the parameter-by-parameter Hessian of the empirical risk at for the risk Hessian at . Linearizing the optimality condition around , where , givesUpweighting by shifts the minimizer to first order by , one Newton step from on the reweighted risk.
To measure how that shift affects a target example , write for its loss gradient at . The chain rule gives the influence of upweighting on the target's loss,Deleting a training point from sets , predicting a target loss change of . A large positive value means removing raises test loss, so helped the prediction. Any differentiable model output can replace the loss on the target side.
Binary logistic regression shows how influence departs from plain input similarity . With labels and logistic function , each training gradient is . Poorly fit points carry a large error weight , giving misfit points and outliers strong leverage. Meanwhile, amplifies gradients along low-curvature directions, where moving the weights barely disturbs the rest of the training set. In Koh and Liang's 1-versus-7 MNIST model, dropping makes every training 7 look helpful to a test 7 because nonnegative pixels force . Restoring reveals many training 7s that raise the test 7's loss. In practice is never formed. Koh and Liang solve for once per target using conjugate gradient or LiSSAa stochastic recursion for (Agarwal et al., 2017): with the Hessian of one sampled training example, a truncated Neumann series once the loss is scaled so , then take its dot product with each training gradient . Both solvers need only Hessian-vector productsproducts computed without forming , at roughly the cost of one gradient, by differentiating (Pearlmutter, 1994).
On convex 10-class MNIST logistic regression, predicted loss changes closely match exact leave-one-out retraining. Deep networks violate every assumption behind the derivation. Training stops before convergence, is indefinite, and many distinct weight vectors fit the data equally well, leaving the minimizer's response to undefined. For an unconverged convolutional network of 2,616 parameters, Koh and Liang add damping with to , equivalent to an penalty around . Across the 100 most influential points, predicted and actual loss changes reach a Pearson correlation of 0.86. Those retraining runs resumed from for 30,000 steps, so they checked only a local response. Against retraining from scratch, influence estimates for deep networks are poor (Basu et al., 2021). Their practical value is diagnostic. In a hospital-readmission model whose training set was altered so that 3 of its 4 children were readmitted, influence scores on a misclassified test child singled out those 4 training children. Each was 30 to 40 times as influential as the next example, even though the learned coefficients did not flag the child indicator.
Rather than linearize around one solution, Ilyas et al. (2022) estimate the retraining counterfactual directly. Fix a target example and a training recipe, including random initialization. For any subset , write for the weights trained from scratch on , and let indicate which examples belong to . Write the scalar model output being attributed: correct-class margin in datamodels, log-odds of the correct class in TRAK for the target output, here the correct-class margincorrect-class logit minus largest other logit, positive exactly when the prediction is right. A linear datamodel fitssolving for by -penalized least squares over networks trained from scratch on random subsets of fraction . Each weight estimates the output gain from including , so deleting a set shifts the predicted output by . On CIFAR-10, fitting these weights took 300,000 ResNet-9 runs on random halves, 17 seconds each on an A100, or roughly two GPU-months.
On held-out random halves, predicted margins track true margins almost exactly, with rank correlation above 0.99 pooled across targets and subsets. The sharper check tests removals far from random halves. For each target, the authors removed 10 to 1,280 examples chosen five ways and retrained from scratch without them. The five rules included top-ranked examples by influence functions, TracIna Hessian-free first-order score (Pruthi et al., 2020) summing learning rate times over saved checkpoints, and feature-space nearest neighbors. Predicted and actual margin shifts correlated at Pearson 0.96 on CIFAR-10 and 0.90 on FMoWFunctional Map of the World, satellite images classified by building or land-use type.
Park et al. (2023) turn this counterfactual test into a common benchmark for any method that assigns training scores . Most attribution methods are additive, predicting the output after training on as the sum of scores over . The linear datamodeling score (LDS) evaluates 100 random half-size subsets , averaging the true output over five models retrained on each subset. It computes the Spearman rank correlation across subsets between that average output and the summed scores,averaged over 2,000 targets. Because a datamodel fits this exact linear predictor by least squares, it serves as the upper reference given enough retrained models.
TRAK bridges the cost gap by reducing a network to logistic regression, where one Newton step is accurate. It sets the target output to the correct-class log-odds , where is the predicted probability of the true label, so cross-entropy becomes the logistic loss . Linearizing around turns the network into a linear model whose features are its output gradients , the empirical neural tangent kernelthe kernel of a network linearized at trained weights. Reading note: The neural tangent kernel view. To make matrix inversion tractable, TRAK projects each gradient to with a random Gaussian matrix of columns, where is a few thousand. By the Johnson-Lindenstrauss lemma, this projection preserves inner products. Stack the as rows of the matrix . Since , each projected loss gradient is ; collect the factors into the diagonal matrix . TRAK drops the per-example weights from the logistic Gauss-Newton Hessian, a change that barely moved scores in the authors' tests. That leaves in place of , and the one-step Newton formula givesSeed-to-seed training noise cannot be attributed to data. TRAK therefore averages and separately across models trained on random halves, then shrinks small entries to zero by soft thresholding.
On CIFAR-10 with ResNet-9, TRAK from 20 models reaches an LDS of 0.27 in 20 A100-minutes. Datamodels from 5,000 models reach 0.20 in 2,500 A100-minutes, and influence functions via inverse-Hessian-vector products score 0.04 in 20,000 A100-minutes (Park et al., Table D.2). Those points are not at matched compute. Across the full cost curve, TRAK matches a given LDS at a fiftieth to a hundredth of datamodels' compute, and both pass 0.5 at the expensive end (their Figure 1). Single-example agreement is loose. With 100 models, TRAK scores and datamodel weights for the same target have a rank correlation of only 0.26 across training points. A high LDS therefore certifies sums over half-size subsets without certifying individual example rankings.
Fact tracing separates counterfactual dependence from textual relevance. On a fine-tuned mT5-small model, TRAK retrieves the abstracts labeled as stating each fact less often than BM25keyword retrieval (Okapi BM25) weighting shared query-document terms by inverse document frequency, scoring 0.42 mean reciprocal rank against 0.77. Yet removing TRAK's top-ranked abstracts and fine-tuning again cuts accuracy on those facts by 34%. That is two to three times the drop from removing the labeled abstracts, which costs 12% in the paper's text and 16.5% in its Figure 9.
Pretrained language models cannot be retrained even 20 times, so Grosse et al. (2023) scale single-model influence functions to 810M to 52B models. They target the log-probability of a completion given a prompt and replace with the damped Gauss-Newton Hessian, with the output Jacobian and the loss Hessian in output space; positive semidefinite and equal to the Fisher information for softmax outputs , which stays positive definite even at unconverged weights. Following Bae et al. (2022), this estimator is the derivative of the proximal Bregman response functionPBRF: as a function of , where is the loss's Bregman divergence in output space (Bae et al. write ) (PBRF), a local counterfactual penalized for moving both outputs and weights away from . Grosse et al. leave open how closely the PBRF tracks retraining from scratch. To invert cheaply, they approximate each MLP layer's block of with EK-FACeigenvalue-corrected Kronecker-factored approximate curvature (George et al., 2018); K-FAC approximates each block by from input and output-gradient covariances (as in Shampoo), and EK-FAC keeps those eigenvectors while refitting eigenvalues to the data. Reading note: Shampoo. Two layer-sized eigendecompositions per block, computed once per model, then reduce to a few matrix products.
Against direct optimization of the PBRF, EK-FAC influence correlates about as well as LiSSA on small networks and on the 810M model, at a small fraction of the cost. Both beat plain gradient dot products, whose top sequences at 810M bear no visible relation to the query. No PBRF check is reported for the larger models. Because each scan requires one gradient per candidate training sequence, the experiments cover at least 10 million pretraining sequences, a small slice of the full corpus. Across that sample, influence spreads thin along a power-law tail. At 22B, the top 1% of scanned sequences carry 12% to 52% of positive influence. No single sequence dominates, except when a model completes a famous passage verbatim; there the passage itself ranks first.
Top influential sequences grow more abstract with model scale. At 810M, the top sequences for a query share short token strings with it, while at 52B they share its underlying theme. Influence also depends on word order. Synthetic sequences such as “The first President of the Republic of Astrobia was Zorald Pfaff” boost that completion. Reversing the order so the name comes first drops influence to about what the name alone contributes.
Ruis et al. (2025) use EK-FAC influence to test whether language models solve simple reasoning problems by reusing pretraining procedures rather than retrieving stored answers. On the 7B and 35B Command Ran instruction-following model family whose base and supervised fine-tuned checkpoints share their pretraining corpus models, they rank 5 million pretraining documents, totaling 2.5 billion tokens sampled across training. Their queries cover 40 factual completions, 20 control queries, and 40 step-by-step reasoning completions. The reasoning tasks are two-step arithmetic at 7B, linear equations at 35B, and line slopes at both. They normalize each score by the completion's information content, in nats. Curvature and document gradients come from the base models, and query gradients from the fine-tuned ones.
Across all 5 million documents, a document's influence on one reasoning query correlates positively and significantly with its influence on other queries of the same task. Factual queries and reasoning-shaped control queries that need no reasoning mostly show no such correlation. Per nat of completion, individual documents also exert smaller and less variable influence on reasoning than on factual queries, especially at 35B. Answers rarely sit near the top for reasoning. The answer appears in the top 500 documents for 55% of factual queries at 7B and 30% at 35B. For reasoning, answers appear there only twice at 7B, as answers to separate steps, and never at 35B, even though step answers exist elsewhere in the sample. For slope queries, top-ranked documents include code and formulas that compute slopes, and code plus StackExchange are overrepresented near the top of reasoning rankings.
Smaller per-document influence and cross-query sharing fit a model drawing weakly on many documents. At 35B, however, concentration points the other way. The power-law tail is slightly steeper for reasoning, and top documents hold a larger share of positive influence, though the authors note this gap may be noise. Checking whether an answer appears in a document is also a textual test, which TRAK's fact-tracing experiment shows can diverge from counterfactual importance. The scan covers 2.5 billion tokens of a much larger corpus and routes influence through MLP weights only. In retraining validation, removing top influential documents hurt perplexity or accuracy more than removing random or gradient-similar ones. Those checks ran only on fine-tuning sets, GPT-2 small on Wikitext-2 and a 7B model on two reading-comprehension benchmarks, never on pretraining.
When the goal is selecting fine-tuning data rather than explaining a pretrained model, Hessian-free gradient alignment is enough. Given a few examples of a target task, LESS (Xia et al., 2024) selects the 5% of a 270K-example instruction pool whose training updates align best with the target's gradient. A brief LoRAlow-rank adaptation (Hu et al., 2021), fine-tuning small low-rank matrices added to weights, here under 2% of LLaMA-2-7B parameters warm-up on a random 5% yields checkpoints with average learning rates . Let the Adam update direction for example at checkpoint , bias-corrected first moment divided elementwise by the square root of the second moment, using warm-up moment estimates be Adam's update for example at checkpoint , and write for the target examples' mean gradient. After randomly projecting LoRA gradients to 8,192 dimensions, LESS scores each candidate bytaking the maximum across target subtasks. That score is TracIn's first-order estimate of how much one update on lowers target loss, with no Hessian and no removal claim. Adam preconditioning matches how instruction tuning runs. Cosine similarity replaces the dot product because sequence gradient norms shrink as completions grow longer. A dot product therefore biases selection toward short examples and picks worse data.
On LLaMA-2-7B across three seeds, LESS's 5% beats a random 5% by 2.6 to 3.7 points on all three targets: MMLU57-subject multiple-choice benchmark; LESS uses 5 examples per subject, TyDiQApassage question answering in 9 typologically diverse languages; LESS uses 1 example per language, and BBHBIG-Bench Hard, 23 chain-of-thought reasoning tasks; LESS uses 3 examples per task. Against training on the full pool, it wins only on TyDiQA, 56.2 versus 54.0. On Mistral-7B, LESS beats the full pool on all three benchmarks. Yet even a random 5% beats the full pool on BBH there, which the authors attribute to irrelevant data in the pool. Subsets chosen with LLaMA-2-7B gradients also beat random selection when training LLaMA-2-13B and Mistral-7B. BM25 gains at most about a point over a random 5%, while n-gram and hidden-representation similarity fall below it. On a Bengali TyDiQA query, BM25 and representation similarity retrieve unrelated Bengali text, whereas LESS retrieves English open-book question answering, matching the skill across languages. Building the gradient store takes roughly 54 A100-hours once and serves any subsequent target.
Consequences and limits. Removal and retraining, or datamodels and TRAK calibrated against it, confirm counterfactual attribution only on models small enough to retrain many times. Large-model findings on scale abstraction and procedural reasoning remain single-model rankings unverified by pretraining removal. Every method here is additive, estimating a set's effect as the sum of member scores. As LESS's authors note, that rule counts two copies of a helpful example as twice as helpful. In practice, TRAK and influence functions point to data worth inspecting. When a handful of target examples are available, LESS gives a working rule for targeted fine-tuning selection.
Terms
- Data attribution
- scoring training examples by how much a given model output depends on them
- Influence function
- ; removing changes the target loss by about
- Newton step
- upweighting by moves the minimizer by about
- Datamodel
- , fit to thousands of networks retrained on random subsets
- Linear datamodeling score
- Spearman correlation between actual outputs of models retrained on random halves and the summed scores of the examples each half contains
- TRAK
- linearize the network, project its gradients randomly, apply the logistic-regression Newton step, average over a few models
- PBRF
- the local counterfactual that damped Gauss-Newton influence estimates, a retraining penalized for moving outputs and weights away from the trained model
- EK-FAC
- per-layer Kronecker-factored Gauss-Newton with refit eigenvalues; inverted once per model
- Procedural knowledge
- in Ruis et al., documents' influence correlates across reasoning queries of one task; answers rarely appear in top documents
- LESS
- pick the 5% of instruction data with the highest learning-rate-weighted cosine between its Adam update and the target gradient
- Fact tracing
- removing TRAK's top abstracts cut accuracy 34%, two to three times the drop from removing the abstracts that state the facts
Sources
- Pang Wei Koh and Percy Liang. Understanding Black-box Predictions via Influence Functions. International Conference on Machine Learning (ICML), 2017.
- Andrew Ilyas, Sung Min Park, Logan Engstrom, Guillaume Leclerc, and Aleksander Madry. Datamodels: Predicting Predictions from Training Data. International Conference on Machine Learning (ICML), 2022.
- Sung Min Park, Kristian Georgiev, Andrew Ilyas, Guillaume Leclerc, and Aleksander Madry. TRAK: Attributing Model Behavior at Scale. International Conference on Machine Learning (ICML), 2023.
- Roger Grosse, Juhan Bae, Cem Anil, Nelson Elhage, Alex Tamkin, Amirhossein Tajdini, Benoit Steiner, Dustin Li, Esin Durmus, Ethan Perez, Evan Hubinger, Kamilė Lukošiūtė, Karina Nguyen, Nicholas Joseph, Sam McCandlish, Jared Kaplan, and Samuel R. Bowman. Studying Large Language Model Generalization with Influence Functions. arXiv preprint, 2023.
- Laura Ruis, Maximilian Mozes, Juhan Bae, Siddhartha Rao Kamalakara, Dwarak Talupuru, Acyr Locatelli, Robert Kirk, Tim Rocktäschel, Edward Grefenstette, and Max Bartolo. Procedural Knowledge in Pretraining Drives Reasoning in Large Language Models. International Conference on Learning Representations (ICLR), 2025.
- Mengzhou Xia, Sadhika Malladi, Suchin Gururangan, Sanjeev Arora, and Danqi Chen. LESS: Selecting Influential Data for Targeted Instruction Tuning. International Conference on Machine Learning (ICML), 2024.
Connected notes
- Stein's paradox and the James-Stein estimatorBenign overfitting · Comparing noisy runs is an estimation problem
With effects spread around a common mean, the posterior mean pulls each raw estimate toward that mean, and Lindley's version of James-Stein estimates both the mean and the amount of pulling from the spread of the estimates themselves. It beats the raw estimates in total squared error for every configuration of the once there are four or more, and in Efron's batting example it cuts the total prediction error to 0.28 of that of the raw batting averages.
- Learned KV-cache evictionEfficient sequence models · Comparing noisy runs is an estimation problem
By the note's rough estimate the difference between two average pass@1 scores, over about 120 problems with 16 samples each, has a standard deviation of at most about 0.016 before any training-seed variation, so gaps of 0.01 to 0.02 between eviction methods are not resolved.
- Best arm identificationBandits and exploration · Comparing noisy runs is an estimation problem
To name the better of two Gaussian arms with error at most , sample arm 1 on the fraction of rounds, which minimizes the variance of the difference of means, and stop once that difference exceeds standard deviations; equal sampling costs up to twice as many samples, and with equal variances the rule is Robbins' sequential test.
ColBERTv2 beats single-vector models in its main table, yet no controlled experiment trains both architectures under the same cross-encoder distillation recipe to separate architecture from supervision.