Skip to content

OLMoTrace: tracing language model outputs to trillion-scale training tokensOLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens

arXiv· arXiv:2504.07096· Jiacheng Liu, Taylor Blanton, Yanai Elazar, Sewon Min, YenSung Chen, Arnavi Chheda-Kothary, Huy Tran, Byron Bischoff, Eric Marsh, Michael Schmitz, Cassidy Trier, Aaron Sarnat, Jenna James, Jon Borchardt, Bailey Kuehl, Evie 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 DodgeAllen Institute for AI; University of Washington; UC Berkeley; Stanford UniversityIndexed by this site · 2026-10-15· Originally publishedAlignment

Quick read

Analysis and theory

Based on the paper PDF (AI-generated); refer to the original

OLMoTrace maps OLMo outputs verbatim back to the full training data, with an average latency of 4.46 seconds across 98 conversations.

Questions
As LMs enter higher-risk scenarios, understanding why they generate what they do becomes necessary, yet training corpora are often unavailable. Fully open models provide trillions of tokens of data, but the authors state existing tracing methods cannot run in real time at this scale due to computational demands.
Methods
OLMoTrace, after generation, indexes all training data with the infini-gram suffix array. For each suffix of the reply, it performs one FIND to get the longest verbatim match, then keeps a few spans by span unigram probability, takes at most 10 documents per span, and colors by BM25 bins.
Experiments and results
98 internal OLMo conversations average 458 tokens, with tracing steps 1–3 averaging 4.46 seconds. Spans average 10.4 tokens, and 96.7% of retrieved documents come from pre-training. gpt-4o rates the first document in the final setting at 1.82, with a human Spearman of 0.73.
Limitations and future work
The authors state that verbatim matching should not be interpreted as causation, supporting evidence, or citation. The system may expose problematic content in the training data; the authors conducted internal red-teaming and mitigation for copyright, PII, and toxicity. The paper does not specify which OLMo model was used for the 98 dialogues.
Experimental setupOLMo-2-32B-Instruct · 98 Ai2 Playground internal OLMo conversations、allenai/olmo-mix-1124 et al. · inference latency、span length et al.
Evaluated models
OLMo-2-32B-Instruct
Benchmarks
98 Ai2 Playground internal OLMo conversationsallenai/olmo-mix-1124allenai/dolmino-mix-1124SFT & DPO & RLVR
Metrics
inference latencyspan lengthBM25 relevancedocument relevance score (0-3)% relevantSpearman correlationtraining-stage share
AI summaryThe authors release OLMoTrace, claiming it is the first system capable of tracing language model outputs in real time back to the full multi-trillion-token training data. The system, based on an extended version of infini-gram, returns tracing results within seconds, showing verbatim matches between model output fragments and documents in the training corpus. The authors state it can help users understand model behavior from the training data perspective, for fact-checking, hallucination and creativity exploration, and it has been made public and fully open source.

The authors release OLMoTrace, claiming it is the first system capable of tracing language model outputs in real time back to the full multi-trillion-token training data. The system, based on an extended version of infini-gram, returns tracing results within seconds, showing verbatim matches between model output fragments and documents in the training corpus. The authors state it can help users understand model behavior from the training data perspective, for fact-checking, hallucination and creativity exploration, and it has been made public and fully open source.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors want to trace outputs back to the training data word by word in real time over a training corpus of multiple trillions of tokens.

    How to find verbatim correspondences between language model outputs and training documents in real time over the full training corpus of multiple trillions of tokens.

    • Why it matters: The authors state that as models enter higher-risk scenarios, there is a need to understand why they generate certain responses. Training corpora often reach trillions of tokens and are frequently proprietary; fully open models (such as OLMo) provide access to training data, but methods such as Koh and Liang (2017), Khalifa et al. (2024), and Huang et al. (2024) have not scaled to this size due to computational demands.
    • Gap in existing approaches: The authors state that influence functions work at small scale, but at trillions of tokens their computational cost makes them infeasible. Having the model learn to cite during training, or citing context or web search results, is not a post-hoc trace of the model's full training data that does not alter generation.
    • Core idea: After pre-sorting all suffixes of the corpus in lexicographic order, exact matching can be located quickly. The authors treat verbatim matching as the most direct link between output and training data, not as causal attribution.
    • System in this paper: The authors propose OLMoTrace. Given a response, it finds verbatim spans that are longer, more distinctive, and relevant to the whole response, and displays training documents. The authors state this is the first system that can trace outputs to the full multi-trillion-token training data in real time; the introduction reports that responses of on average ~450 tokens return within 4.5 seconds. The exploratory uses listed in the abstract are fact-checking, hallucination, and creativity; the case studies in §5 are fact-checking, creative expression, and mathematical ability.
    • Applicability: The system supports three flagship OLMo models, including OLMo-2-32B-Instruct. The authors state that as long as the serving party has access to the full training data, it can be used for other LMs; the authors state the system is publicly available, with the core components open-sourced under Apache 2.0.
  2. What related research exists?

    The authors position the paper in relation to RAG, search engines, and training-data tracing.

    §6 is written as a usage comparison and does not report numerical comparisons with these methods on the same dataset.

    Retrieval-augmented generation

    • RAG: The systems the authors describe retrieve documents from a database before generation and condition generation on them, with examples being Bing Chat, Google AI Overview, and Perplexity AI. The authors state OLMoTrace is post hoc retrieval that does not intervene in generation, aiming to show connections between output and training data rather than improve generation.

    Search engines

    • Web indexing: The authors state traditional search engines (example: Google) retrieve documents from a web index. OLMoTrace retrieves from a specific LM's training data; the authors state this is more suitable for understanding the data sources of model behavior.

    Tracing to training data

    • Influence functions: Koh and Liang (2017), Han et al. (2020), and Han and Tsvetkov (2022) use gradients to find training samples that influence a given test sample. The authors state this works at small scale, but computational cost makes it infeasible for trillion-token corpora; this paper instead retrieves by surface overlap, with the heuristic that such samples may influence a given output.
    • Training-time citation: Khalifa et al. (2024) train models to cite pre-training documents. The authors describe this as an intervention in the training process, distinct from post hoc retrieval.

    Tracing on other sources

    • Context citation: Huang et al. (2024) extend RAG so models cite documents in context; Chuang et al. (2025) train models to cite long context given at inference time.
    • External search: Gao et al. (2022) retrieve supporting evidence from Google Search for generation. The authors also mention the Gemini App's double-check response: it highlights reply fragments and shows similar results from Google Search; the authors state these results update in real time and differ from Gemini's training data, making them less useful for scientific exploration.

    The authors place the paper on the side of "no training changes, no generation changes, surface retrieval over the full training data," used to observe direct correspondences between output and training text.

  3. How does the paper address this problem?

    OLMoTrace uses suffix arrays to find the longest verbatim spans in parallel, then filters and tiers them with BM25.

    OLMoTrace, after the reply has already been generated, maps verbatim fragments in it back to that model's full training data and highlights spans and source documents in the interface.

    Input, output, and corpus

    • Interface: Input is the LM's reply to a user prompt. Output is the start and end positions of several spans in the reply, along with training documents containing each span.
    • Match scope: Matches against all training data of that LM, including pre-training, mid-training, and post-training. The first two stages are the same across the three OLMo models, with post-training slightly different.
    • Scale: Table 1, counting OLMo-2-32B-Instruct, totals 3164 M documents, 4611 B Llama-2 tokens. Mid-training statistics and indexing exclude sources already present in pre-training.
    • Interface: Highlights matching spans; the document panel lists documents that hit at least one span. Clicking a span shows only documents containing it, and one can also locate spans from a document (Appendix Figure 6). By default, 80 tokens around the match are shown, expandable to 500 tokens.

    Five-step pipeline

    • Maximal matching spans: The reply is tokenized with the Llama-2 tokenizer. A span must appear at least once in the training data; a period token or newline token can only appear at the end of a span, and a span cannot start or end with an incomplete word; it cannot be a sub-span of another qualifying span.
    • Filtering: Span unigram probability is the product of the unigram probabilities of its tokens, with unigrams from all training data of that LM and pre-cached. Keep the K spans with the smallest probability, where K is 0.05 times the reply token count L, rounded up. The authors state that during development, retaining by length made document relevance worse (Appendix Table 3); bigram or trigram are not used because online computation or pre-caching is expensive.
    • Fetching documents: Each retained span takes at most 10 fragments containing it; if it appears more than 10 times, randomly sample 10. The authors state that due to maximality, most spans appear no more than 10 times.
    • Merging and coloring: Overlapping spans are highlighted as a union; fragments from the same document are merged. Documents are sorted by BM25 descending: retrieved documents are treated as the corpus, and the concatenation of the user prompt and reply as the query. Scores are binned into high, medium, and low; a span's bin is the highest bin among documents containing it.

    Parallel longest prefix

    • Two steps: For each suffix of the reply, find the longest matching prefix, then delete non-maximal spans. Each start position has at most one maximal matching span, and queries for each suffix can be parallelized.
    • One FIND: infini-gram indexes the corpus with a suffix array, and FIND returns the interval of that query in the array. If the query does not exist, the interval length is 0, and adjacent suffixes are the lexicographically nearest corpus suffixes; any suffix sharing the longest common prefix with the query must come from one of these two neighbors. Thus one FIND per suffix suffices, without binary search over prefixes.
    • Sharding and second query: Each shard is capped at 500B tokens. With multiple shards, FIND is parallelized and the maximum longest-common-prefix length is taken. Locating all occurrences requires one more FIND; in the implementation it immediately follows the first to exploit the disk cache. The self-containment condition is satisfied by shortening the match length.
    • Complexity: The authors give time complexity O(L log N), and with full parallelism latency O(log N); in the paper N > 10^12. Production speed is limited by disk I/O throughput, and the index is placed on high-IOPS SSDs.

    Relevance bins and deployment

    • Normalization: The authors state the maximum BM25 a document can reach is roughly capped at 0.18 times the reply character count (in Figure 4), so this coefficient is used for normalization. After normalization, ≥0.7 is high, 0.5 to 0.7 is medium, <0.5 is low. The authors state these thresholds align with human expectations.
    • Node: The latency measurement in §3.2 was done on a CPU-only node, 64 vCPU, 256GB RAM, 40TB SSD. Appendix B states the disk has up to 80,000 read IOPS, shared by two VMs; prefetch is disabled because speculative reads are not beneficial when the bottleneck is I/O throughput, and batched queries are used to fetch documents.
  4. What experiments did the paper conduct?

    98 conversations average 4.46 seconds; 96.7% of documents come from pre-training.

    Experimental setup

    • Conversations: Latency, span, and document statistics use 98 internal Ai2 Playground conversations from OLMo models. The paper does not state which of the three flagship models each belongs to. The named model is OLMo-2-32B-Instruct; the other two are unnamed.
    • Corpus: In Table 1, pre-training allenai/olmo-mix-1124 is 3081 M documents, 4575 B tokens; mid-training allenai/dolmino-mix-1124 is 81 M documents, 34 B tokens; post-training (SFT, DPO, RLVR) is 1.7 M documents, 1.6 B tokens. Total 3164 M documents, 4611 B Llama-2 tokens.
    • Evaluation: One human expert annotated the top-5 documents shown for each conversation using the 0–3 scale in Appendix Table 2. Then gpt-4o-2024-08-06 was used as LLM-as-a-Judge with the same scale in the prompt. Scores of 2 or 3 count as relevant. Human annotation was on early hyperparameters, not the final setting.
    • Metrics: Inference latency for steps 1–3; span length after step 2 and before merging; normalized BM25; training-stage proportion of retrieved documents.
    • Environment: §3.2 is 64 vCPU, 256GB RAM, 40TB SSD. Appendix B states up to 80,000 read IOPS, two VMs, prefetch disabled.
    • Repetition: The paper does not report the number of repetitions for latency or scores, nor a second annotator.

    Main results

    Per Table 3. The authors state rows are in reverse chronological order; "+" is the incremental difference over the previous row. Except for the last row, which changes to a human expert, the scorer is gpt-4o; the last two rows use the same early hyperparameters.

    Swipe horizontally to read the table

    SettingFirst-doc meanTop-5 meanFirst-doc relevantTop-5 relevant
    Final setting1.821.5063.3%55.1%
    + BM25 only on LM reply1.781.4962.2%54.5%
    + Context reduced to 100 tokens1.741.4464.3%52.9%
    + Spans sorted by length1.561.3757.1%49.4%
    + Drop frequency >101.731.2862.2%47.0%
    + Changed to human expert1.901.4363.0%46.2%
    • Relation to human: The authors state gpt-4o broadly agrees with the expert, Spearman 0.73 (§4); under the same early setting, the judge model's scores are slightly lower overall.
    • Tuning direction: The authors state that after no longer dropping spans appearing more than 10 times, first-document metrics drop and top-5 rise. Then switching to unigram ranking, longer context, and including the user prompt in BM25; the authors state overall relevance improves, with one small exception in the first-document relevant proportion.
    • Final setting: Human scores correspond only to early hyperparameters. The paper does not report redoing human annotation on the final setting.

    Latency, spans, and document sources

    • Latency: The same 98 conversations average 458 tokens, steps 1–3 average 4.46 seconds (§3.2). The introduction also writes average ∼450 tokens, within 4.5 seconds. The authors state measurements match the disk analysis in Appendix B.
    • Length and bins: After filtering, before merging, span mean is 10.4 tokens, median 10 tokens (§4; Figure 4 also writes mean 10.4). When normalized BM25 ≥0.7, 14% of documents are high-relevance and 19% of spans are high-relevance (§4).
    • Training stage: Of retrieved documents, 96.7% come from pre-training, 0.9% from mid-training, 2.4% from post-training. As proportions of all retrieved documents, SFT is 0.9%, DPO is 1.5%, RLVR is none (§4). The authors state this distribution strongly depends on topic, and math-heavy outputs may retrieve more documents from SFT and RLVR.

    Case studies

    • Three qualitative examples: §5 does not report success rates. One fact-checking example checks whether a factual statement appears verbatim in training documents, and the source webpage of the pre-training document can be used to continue viewing context. One creative expression example is a phrase in a Tolkien-style story. In one math example, the authors state OLMo correctly answers Problem 4 of AIME 2024 I (a combinatorics problem), and a certain computation step appears verbatim in post-training data.
    • Numbering inconsistency: The main text writes the creative example as Figure 5(c) and the math example as Figure 5(d). The in-figure captions are (a) fact-checking, (b) creative expression, (c) math ability; the figure caption states (a) and (c) selected a span. The main text numbering does not match the figure caption.
    • Authors' usage note: The authors state that viewing document context and sources helps judge the factuality of statements, because text out of context can mislead, and some webpage sources may be unreliable.

    Other ablations and analyses

    • Normalization coefficient: The authors state the maximum BM25 is roughly capped at 0.18 times the reply character count (in Figure 4); thresholds 0.7 and 0.5 (§4).
    • High-relevance proportions: documents 14%, spans 19% (§4, 98 conversations).
    • Appendix B disk read analysis: training data is split into 12 shards; the authors state, for example, a 100-token output can be processed in 1.2 seconds. This is an example computed from IOPS, not the 4.46-second measurement in §3.2.
    • Four differences of the early setting relative to the final setting: dropping spans with frequency >10, sorting by length rather than unigram, BM25 context 100 tokens rather than 500, BM25 not including the user prompt (Appendix C). Row scores are in the table above.
    • The length-sorted row has first/top-5 means of 1.56/1.37; the authors already state in §3 that retaining by length gives worse relevance. That row also stacks earlier settings, so it is not a controlled comparison of changing only the sort.
  5. What are some points that can be further explored?

    The authors state that verbatim matching is not causation, evidence, or citation, and they wrote about content exposure and mitigation.

    Limitations and future directions noted by the authors

    • Non-causal: OLMoTrace finds surface-level, verbatim matches. Retrieved documents should not be interpreted as having a causal role in the LM's output, nor should they be treated as supporting evidence or citations. (Limitations)
    • Content exposure: The system may make potentially problematic content in the training data more visible. The authors conducted internal red teaming and implemented mitigations based on findings, focusing on copyright, PII, and toxicity. (Limitations)
    • Copyright: The authors state that in red teaming they could surface news or lyrics, and did not see copyrighted books; they provide a takedown request and implemented takedown without re-indexing the full data. (Limitations)
    • PII: The authors state they could not find PII in OLMoTrace results and implemented regex-based document filtering. (Limitations)
    • Toxicity: The authors state that Ai2 Playground already filters user prompts, and they did not add further filtering. (Limitations)

    Experimental coverage

    • Latency, span length, BM25 bins, and training-stage proportions all come from the same batch of 98 internal Ai2 Playground OLMo conversations (§3.2, §4).
    • The paper states support for three flagship OLMo models; Table 1 only gives OLMo-2-32B-Instruct. The names and per-component corpora of the other two are not given, only that pre-training and mid-training are the same, with post-training slightly different (§2). The paper does not state which of the 98 conversations corresponds to which model.
    • Correlation was annotated by one human expert on top-5 documents under early hyperparameters, then scored by gpt-4o-2024-08-06; the paper reports Spearman 0.73 (§4, Appendix C). The paper does not report the number of repetitions or a second annotator.
    • §5 contains three qualitative case studies. The paper does not report fact-checking accuracy or quantitative success rates beyond these cases.
    • Related Work states influence functions are infeasible on trillion tokens due to computational cost. §3–§5 experiments do not include numerical comparisons against influence functions, RAG, or search engines.
  6. Summarize the main content of the paper

    OLMoTrace post hoc maps OLMo outputs verbatim back to training data and measures latency and relevance.

    OLMoTrace, after the response is generated, maps verbatim spans in OLMo outputs back to that model's full training data, and highlights spans and source documents in the interface. The exploratory directions mentioned in the abstract include fact-checking, hallucination, and creativity; the case studies in the main text are fact-checking, creative expression, and mathematical steps.

    The problem to be solved is scale: although fully open models provide multi-trillion-token corpora, the computational cost of methods like influence functions prevents them from being used in real time at this scale. The authors' approach is to index all suffixes in lexicographic order in advance, treating verbatim matching as an interactive direct link.

    Both the responses and the corpus use the Llama-2 tokenizer. For each suffix, an infini-gram FIND is run once, taking the longest common prefix, removing spans that are non-maximal or do not satisfy the self-containment condition, then keeping the K spans with the smallest unigram probability, where K is 0.05 times the response length rounded up. Each span keeps at most 10 documents, which are merged and colored in three tiers by BM25 score. The index is sharded by at most 500B tokens and stored on SSD.

    The 98 internal dialogues average 458 tokens, with steps 1–3 averaging 4.46 seconds; the introduction separately reports on average ~450 tokens and 4.5 seconds. After filtering, spans average 10.4 tokens with a median of 10. Of retrieved documents, 96.7% come from pre-training, 0.9% from mid-training, and 2.4% from post-training; among these, SFT accounts for 0.9% of all documents, DPO 1.5%, and RLVR none. Under the final setting, gpt-4o gives the first document an average score of 1.82 and top-5 of 1.50 (Table 3). Under the early setting, human experts give the first document 1.90 and top-5 1.43, with a Spearman correlation of 0.73 with gpt-4o.

    The authors use case studies to show that users can check factual statements, seemingly novel expressions, and arithmetic steps against training documents to see whether they appear verbatim in post-training. The authors also state explicitly: these documents are not causal explanations, nor are they citations; the system may also make problematic content in the training data easier to see.

Read originalarxiv.org