Towards Tracing Knowledge in Language Models Back to the Training Data

Ekin Akyürek, Tolga Bolukbasi, Frederick Liu, Binbin Xiong, Ian Tenney, Jacob Andreas, Kelvin GuuEMNLP 2022

Abstract

Large language models (LLMs) acquire vast amounts of factual knowledge during training, yet identifying the specific training examples responsible for a particular model prediction remains a significant challenge. This paper introduces fact tracing, the task of attributing a model's factual assertions to their source training data. We present FTRACE, a benchmark for evaluating training data attribution (TDA) methods. Our evaluation reveals that while neural attribution methods show promise in synthetic environments, simple keyword-matching baselines often outperform them on real-world data, highlighting a critical gap in current interpretability techniques.

Introduction: The Challenge of Fact Provenance

Modern language models act as massive repositories of world knowledge. However, when a model predicts that "The United States was founded in 1776," it is difficult to pinpoint which training documents provided this information. This lack of provenance hinders model trustworthiness and makes it difficult to diagnose the roots of hallucinations or biases.

Training Data Attribution (TDA) aims to bridge this gap by identifying "proponents"—specific training examples that positively influence a model's prediction.

Conceptual overview of training data attribution for factual queries.

Methods for Attribution

We evaluate three primary approaches to TDA:

  1. Gradient-based (TracIn): This method estimates influence by calculating how much the loss on a specific fact would decrease if the model were fine-tuned on a candidate training example. We enhance this approach by accounting for optimizer momentum (Adafactor) and applying unit-normalization.
  2. Embedding-based (EMBED): This technique measures the cosine similarity between the internal hidden representations (embeddings) of the training example and the query.
  3. Lexical Baseline (BM25): A standard information retrieval technique that ranks examples based on word overlap, serving as a non-neural baseline that ignores model internals.

To handle the computational complexity of searching massive datasets, we employ a reranking setup, where methods rank a candidate set containing true proponents and difficult distractors.

The FTRACE Benchmark

To rigorously evaluate these methods, we developed two new datasets using a "novel fact injection" protocol.

Construction of the FTRACE benchmark using the TREx dataset and LAMA queries.
  • FTRACE-TREX: Derived from real-world facts. We identify facts unknown to the model, fine-tune the model on sentences containing these facts, and then test if TDA methods can recover those specific sentences.
  • FTRACE-SYNTH: A synthetic dataset with generated entities and relations. This allows us to control lexical overlap, testing whether TDA methods truly understand model behavior or are merely performing keyword matching.

Key Insights and Results

Our experiments yielded several surprising findings:

The Dominance of Lexical Overlap

On the real-world FTRACE-TREX dataset, the simple BM25 baseline achieved a Mean Reciprocal Rank (MRR) of 77.55, outperforming the best neural method, TracIn (62.38). This suggests that current TDA methods often rely on surface-level similarities that are better captured by traditional IR techniques.

Success in Controlled Environments

In the FTRACE-SYNTH setting, where lexical overlap was intentionally minimized, neural methods demonstrated their potential. TracIn achieved a perfect 100.00 MRR, while BM25's performance dropped to 87.69, indicating that gradient-based methods can indeed capture deeper causal links when surface cues are absent.

The Importance of Early Layers

Analysis showed that the strongest attribution signals for both TracIn and EMBED often originate from the model's embedding layer rather than deeper layers. This implies that factual similarity is encoded early in the network's processing pipeline.

Conclusion and Future Directions

While TDA methods show significant promise, particularly in synthetic settings, their performance on real-world data remains limited. The "saturation" problem—where pre-existing knowledge masks the gradient signal of new facts—remains a major hurdle. Future work must address the challenge of identifying indirect proponents and scaling these methods to the massive, redundant datasets used in modern LLM training.

Summary updated

BibTeX
@inproceedings{akyurek2022towards,
  author = {Ekin Akyürek and Tolga Bolukbasi and Frederick Liu and Binbin Xiong and Ian Tenney and Jacob Andreas and Kelvin Guu},
  title = {{Towards Tracing Knowledge in Language Models Back to the Training Data}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  url = {https://openreview.net/forum?id=HhNwCL5mzw3},
}
Figure