TL;DR
Training data attribution allows us to trace a language model’s predictions back to the data it learned from. This paper introduces a scalable multi-stage influence function that can attribute the downstream outputs of fully fine-tuned, billion-parameter LLMs directly back to their pre-training data using Eigenvalue-corrected Kronecker-Factored (EK-FAC) approximations.
What Problem Does This Paper Address?
Most factual knowledge stored in Large Language Models (LLMs) is acquired during large-scale pre-training, yet these models are typically deployed only after downstream fine-tuning. When a fine-tuned model outputs a fact—or hallucinates—we need to trace that behavior back to the original pre-training corpus to evaluate grounding and trustworthiness.
Standard Influence Functions (IFs) assess how removing a training example would affect test predictions. However, traditional IFs suffer from two major roadblocks in modern NLP:
- The Multi-Stage Gap: Classical IFs assume a single training run. When models undergo full-parameter fine-tuning (and potentially change task formulations or output heads), standard IF gradients between pre-training and inference become mathematically incompatible.
- Computational Bottlenecks: Calculating inverse Hessian-Vector Products (iHVPs) and gradients across billions of parameters and billions of training tokens is prohibitively expensive.
Methods
The authors tackle these challenges with a three-part approach:
- Proximity-Constrained Multi-Stage IF: To link pre-training and fine-tuning parameter spaces, the authors model fine-tuning as empirical risk minimization with an added post-hoc $L_2$ Euclidean proximity penalty toward the pre-trained weights ($\frac{\alpha}{2} \|\theta - \theta_{pt}\|_2^2$). This yields a closed-form attribution score expressed as the inner product of two preconditioned gradients: one for the fine-tuned query and one for the pre-training candidate, each inverted through their respective Generalized Gauss-Newton (GGN) curvature matrices.
- EK-FAC Parameterization: Inverting full Hessian matrices is impossible at scale. The authors approximate the block-diagonal GGN using Eigenvalue-corrected Kronecker-Factored Approximate Curvature (EK-FAC) for the linear layers of Multi-Head Attention (MHA) and Multi-Layer Perceptron (MLP) blocks, pre-computing factors once to make pairwise inference fast.
- Semantic Candidate Filtering: Iterating over an entire pre-training corpus for every query would require the equivalent of an entire training epoch. Instead, they pre-filter candidates using $k$-Nearest Neighbors ($k$-NN) over dense sentence embeddings (Sentence-BERT), calculating exact influence scores only on semantically relevant candidates.
Datasets
- Penn Treebank: Used to train a custom GPT-NeoX model (~1.57M parameters) for single-stage scalability and efficiency benchmarks against iterative baselines.
- Fact-Tracing Benchmark (T-REx & LAMA): Derived from aligning T-REx knowledge base triples with DBpedia abstracts. The authors manually converted LAMA text-completion cloze-style prompts (e.g., "X was born in [Y]") into question-answering formats ("Where was X born?") suited for autoregressive instruction-following LLMs.
- Wikipedia / The Pile Subset: Used for qualitative attribution on the instruction-tuned
dolly-v2-3bmodel. - Evaluated LLM Pairs: BLOOM-560m vs. BLOOMZ-560m, and Pythia-2.8b vs. dolly-v2-3b.
Key Insights and Ideas
- Fine-Tuning Stays Close in Weight Space: Empirically, fine-tuned weights drift surprisingly little from their pre-trained base: the distance $\|\theta_{ft} - \theta_{pt}\|_2$ accounted for less than 8% of the base model's norm, and the proximity constraint added virtually zero penalty to overall loss.
- MLP Layers Do the Heavy Lifting: While MHA parameters made up 25% of evaluated weights, they accounted for only 14.5% of total influence. Removing attention layers from influence calculations barely reduced estimation quality ($\rho$ dropped from 0.612 to 0.523), confirming that factual attribution is heavily concentrated in MLP feed-forward layers.
- Curvature Matters at Low Damping: With large damping terms ($10^{-4}$), influence functions degrade into simple Gradient Dot Product (GDP). However, at lower damping ($10^{-6}$ to $10^{-8}$), second-order curvature information significantly boosts attribution quality.
Key Results
- Scalability Trade-Off: On the Penn Treebank benchmark, EK-FAC achieved a Spearman correlation of $\rho = 0.612$ relative to ground-truth Conjugate Gradient (CG) with a pairwise compute time of just 3.57 seconds (compared to 913 seconds for raw CG and 1.25 hours for LiSSA at $\rho = 0.518$). Retraining-based TRAK achieved only $\rho = 0.013$ while requiring over 18 hours of overhead.
- Fact-Tracing Superiority: On the fact-tracing benchmark, the proposed Multi-Stage IF (MS-IF) consistently outperformed Single-Stage IF (SS-IF), BM25, Representation Similarity (RepSim), and GDP in Mean Reciprocal Rank (MRR) and Recall@10 when using appropriate damping factors ($10^{-6}$ – $10^{-8}$).
- Qualitative Case Study: When
dolly-v2-3bhallucinated that "The fortune cookie originated in China," MS-IF successfully surfaced the exact Wikipedia excerpt explaining that fortune cookies are served in American Chinese restaurants but originated in Kyoto, Japan—illustrating how training data directly induces subtle model misconceptions.
Limitations and Future Work
- Omitted Parameter Groups: The analysis focuses solely on linear layers in MLP and MHA backbones, excluding embeddings, unembeddings, and layer normalization parameters.
- Architecture Constraints: The framework was only evaluated on decoder-only transformers; encoder-decoder and diffusion architectures remain unexplored.
- Missing Baseline Comparison: The authors could not directly benchmark against SOURCE (an approximate unrolled differentiation attribution method) due to lack of public implementation code.
- Imperfect Retrieval: Even the best-performing attribution scores remain well below 100% recall, reflecting residual approximation errors inherent to Kronecker-factored curvature methods.
Summary updated