OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens

Jiacheng Liu, Taylor Blanton, Yanai Elazar, Sewon Min, Yen-Sung Chen, Arnavi Chheda-Kothary, Huy Tran, Byron Bischoff, Eric Marsh, Michael Schmitz, Cassidy Trier, Aaron Sarnat, Jenna James, Jon Borchardt, Bailey Kuehl, Evie Yu-Yen Cheng, Karen Farley, Sruthi Sreeram, Taira Anderson, David Albright, Carissa Schoenick, Luca Soldaini, Dirk Groeneveld, Rock Yuren Pang, Pang Wei Koh, Noah A. Smith, Sophie Lebrecht, Yejin Choi, Hannaneh Hajishirzi, Ali Farhadi, Jesse Dodge · DOI · OpenReview

TL;DR

OLMoTrace is a novel system that allows us to trace language model (LM) outputs directly back to their original training data, even across massive multi-trillion-token datasets. This breakthrough enables unprecedented insight into why LMs generate specific text, facilitating tasks like fact-checking and understanding model behavior.

What Problem Does This Paper Address?

Modern Large Language Models (LLMs) are trained on colossal datasets, often containing trillions of tokens. While these models exhibit remarkable capabilities, understanding the origin of their outputs—especially for high-stakes applications—remains a significant challenge. Existing methods for tracing LM outputs back to training data struggle to scale to such massive datasets due to their heavy computational demands. This gap makes it difficult to debug, verify, and trust LM generations, hindering their adoption in critical domains.

Methods

The core of OLMoTrace's innovation lies in its efficient tracing mechanism, powered by an extended version of the infini-gram system. The process involves several key steps:

  1. Maximal Matching Spans: OLMoTrace first identifies "maximal matching spans" – segments of the LM output that appear verbatim in the training data. This is achieved by leveraging infini-gram's ability to index and search massive text corpora using suffix arrays. A novel parallel algorithm significantly speeds up this process, reducing the time complexity.
  2. Filtering for Long and Unique Spans: To focus on more informative matches, spans are filtered based on their unigram probability, prioritizing those that are longer and contain less common tokens.
  3. Retrieving Enclosing Documents: For each filtered span, OLMoTrace retrieves up to 10 documents from the training data that contain the span.
  4. Merging Spans and Documents: Overlapping spans and multiple snippets from the same document are merged to simplify the user interface.
  5. Reranking Documents by Relevance: Documents are reranked using the BM25 score, which measures the relevance of retrieved documents to the LM output and user prompt. This helps prioritize the most pertinent sources.

The system is designed for real-time performance, returning results within seconds, making it interactive and user-friendly.

Datasets

The paper primarily discusses the use of the OLMo models' training data for tracing. Specifically, it mentions the OLMo-2-32B-Instruct model, which was trained on approximately 3.2 billion documents and 4.6 trillion tokens, encompassing pre-training, mid-training, and post-training (SFT, DPO, RLVR) datasets. The system is designed to be applicable to any LM, provided access to its full training data.

Key Insights and Ideas

  • Scalability is Key: The most significant insight is the development of a system that can efficiently trace LM outputs across trillions of tokens in near real-time. This overcomes a major hurdle in understanding large models.
  • Verbatim Matches as Direct Connections: OLMoTrace focuses on exact, verbatim matches. The paper posits that these direct lexical connections are the most straightforward way to understand where an LM might have learned a particular phrase or sentence.
  • Beyond "Black Box": By revealing the training data origins, OLMoTrace moves beyond treating LMs as complete black boxes, offering a lens through which to understand their behavior.
  • "Creative" Expressions Aren't Always Novel: The system can reveal that seemingly novel or creative LM outputs might be verbatim reproductions of text found in the training data, such as fan fiction or specific writing styles.

Key Results

  • Low Inference Latency: OLMoTrace achieves an average inference latency of 4.46 seconds for LM responses of around 458 tokens, enabling real-time interaction.
  • Span Length: The selected spans are relatively long, with a mean length of 10.4 tokens, indicating substantial verbatim matches.
  • Document Relevance: The system achieves good document relevance, with an average score of 1.82 for the first displayed document and 1.50 for the top-5 documents (on a 0-3 scale), as evaluated by LLM-as-a-Judge.
  • Training Data Distribution: The vast majority (96.7%) of retrieved documents belong to the pre-training data, with smaller percentages from mid-training (0.9%) and post-training (2.4%) stages.

Limitations and Future Work

  • Verbatim Matches Only: OLMoTrace currently only identifies verbatim matches. It does not capture paraphrased or semantically similar content, which might also influence LM outputs.
  • Correlation vs. Causation: The retrieved documents are not necessarily causal for the LM's output, nor are they intended as citations or evidence. They simply show where the text was found.
  • Copyright and PII: The paper acknowledges the potential for exposing problematic content, including copyright infringement and PII. While measures are in place (takedown requests, PII filtering), this remains an area of concern.
  • Future Work: The authors invite the community to explore additional use cases for OLMoTrace, suggesting its potential in fact-checking, understanding hallucinations, and exploring LM creativity. Further research could focus on extending tracing to non-verbatim matches and exploring the causal relationship between training data and LM behavior.

Summary updated

Abstract

We present OLMoTrace, the first system that traces the outputs of language models back to their full, multi-trillion-token training data in real time. OLMoTrace finds and shows verbatim matches between segments of language model output and documents in the training text corpora. Powered by an extended version of infini-gram (Liu et al., 2024), our system returns tracing results within a few seconds. OLMoTrace can help users understand the behavior of language models through the lens of their training data. We showcase how it can be used to explore fact checking, hallucination, and the creativity of language models. OLMoTrace is publicly available and fully open-source.
BibTeX
@inproceedings{liu2025olmotrace,
  author = {Jiacheng Liu and Taylor Blanton and Yanai Elazar and Sewon Min and Yen-Sung Chen and Arnavi Chheda-Kothary and Huy Tran and Byron Bischoff and Eric Marsh and Michael Schmitz and Cassidy Trier and Aaron Sarnat and Jenna James and Jon Borchardt and Bailey Kuehl and Evie Yu-Yen Cheng and Karen Farley and Sruthi Sreeram and Taira Anderson and David Albright and Carissa Schoenick and Luca Soldaini and Dirk Groeneveld and Rock Yuren Pang and Pang Wei Koh and Noah A. Smith and Sophie Lebrecht and Yejin Choi and Hannaneh Hajishirzi and Ali Farhadi and Jesse Dodge},
  title = {{OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=VYqjlGIEvX},
}
Figure