TL;DR
To understand why a large language model (LLM) generates a specific response, researchers trace its outputs back to its training data using either cheap string-matching (data-similarity) or expensive gradient-based calculations (data-influence). This paper reveals a significant, asymmetric agreement between the two: data-influence is highly predictive of data-similarity rankings, but not vice versa. This discovery enables a powerful hybrid approach—pre-filtering training data with cheap similarity metrics and refining the results with precise influence functions—saving massive computational costs without sacrificing accuracy.
What Problem Does This Paper Address?
When an LLM hallucinates, leaks private data, or spits out copyrighted text, we need to know why. One of the most effective ways to diagnose these behaviors is output tracing—finding the specific training documents that caused the model to generate that response.
Currently, researchers use two main paradigms for this, as illustrated in the high-level framework below:
- Data-Similarity: Surface-level text matching (like BM25) that looks for overlapping words between the LLM's response and the training corpus. It is incredibly cheap and scalable but completely blind to the model's internal mechanics.
- Data-Influence: Deep mathematical tracking (using gradients and Hessians) that calculates how the model's parameters and losses change if a training document is removed. It is highly accurate but computationally brutal.
While these two approaches have been compared on classification tasks with absolute ground truths, they have never been rigorously compared for open-ended LLM output tracing. This paper fills that gap, quantifying exactly where these two ranking methods agree, where they diverge, and how they can be combined.
Methods
The authors establish a rigorous workflow to compare the document rankings produced by both methods across 100 different queries.
- Data-Similarity Baseline: The standard Lucene implementation of the BM25 algorithm.
- Data-Influence Estimators: To see if the quality of the math matters, the authors compare three different influence approximations:
- GRAD: A cheap, gradient-only approach (similar to TracIn).
- DIAG: A diagonal approximation of the Hessian matrix.
- EK-FAC: An expensive, high-fidelity Kronecker-factored approximate curvature method to estimate true Influence Functions.
- Metrics: Instead of relying on non-existent "ground truth" labels for open-ended text, the authors evaluate the overlap of ranked document lists at various depths using Agreement at depth $d$ and Rank-Biased Overlap (RBO).
Datasets
The experiments were conducted using:
- Training Corpus Subset: A randomized subset of 100,000 documents from the DCLM dataset, with each document truncated to 300 tokens.
- Evaluation Prompts: 100 diverse, open-ended prompts generated via Gemini and manually verified for topical variety and ambiguity (e.g., "To open the locked door, you'll need...").
- Models: The evaluation spanned several open-weight LLMs under 2B parameters: OLMo2-1B, Qwen3-1.7B, LlaMa3.2-1B, Gemma3-1B, GPT2-medium, and GPT2-small.
Key Insights and Ideas
- The Asymmetry Phenomenon: The core "aha!" moment of the paper is that the relationship between similarity and influence is a one-way street. If a document has high data-similarity, data-influence will likely give it a consistent, high rank. However, if a document has high data-influence, data-similarity might rank it terribly.
- Why the Asymmetry Exists: Data-influence captures abstract structural patterns and generalized reasoning that don't rely on exact word matches. For instance, an LLM might be heavily influenced by a document that teaches it how to reason about locks, even if that document never uses the exact words in the prompt. BM25 completely misses these documents. This is vividly demonstrated in qualitative examples where data-similarity accidentally ranks irrelevant text highly due to superficial word overlap:
- Better Math = Better Agreement: As the influence estimator gets more sophisticated (moving from pure gradients to Hessian-based EK-FAC), its agreement with data-similarity actually increases. This proves that true model influence naturally encompasses lexical similarity while building on top of it.
Key Results
- Quantified Overlap (OLMo2-1B): On average, 11% of the top-100 documents retrieved by both methods are identical. Furthermore, 34% of the top-100 data-similarity documents fall within the top-1000 documents of data-influence, compared to only 28% when looking the other way around.
- The "Pre-Filter and Refine" Triumph: The authors tested a practical pipeline: use the ultra-cheap BM25 to grab a candidate pool of documents, and then use expensive data-influence to re-rank just that pool. This approach achieved an impressive Area Under the ROC Curve (AUC) of 0.83. Trying the reverse (filtering with influence and refining with similarity) yielded a poor AUC of 0.63.
This asymmetry is visualized across the top-100 documents in the stem plots below, showing how data-influence assigns much more stable, lower ranks to top similarity documents:
Limitations and Future Work
The primary limitation of this study is scale. Due to the massive compute required for Hessian-based influence calculations (computing EK-FAC for just one prompt on 100,000 documents took 16 hours across 16 NVIDIA V100 GPUs), the authors had to limit their dataset to 100k documents and their models to under 2B parameters.
Promising next steps include:
- Scaling this analysis to production-grade models (30B+ parameters) and multi-trillion token datasets using massive GPU clusters.
- Categorizing prompts by topic to predict at test-time whether cheap data-similarity is sufficient, or if expensive data-influence is strictly necessary.
- Testing how data-influence pairs with more modern similarity methods, such as dense semantic embeddings or Infini-Gram.
Summary updated