TL;DR
If you want to understand why a Large Language Model said something—whether it’s memorizing, generalizing, or suffering from benchmark contamination—you need to search its massive training data. Standard search engines buckle under multi-trillion-token datasets, while ultra-scalable data structures like Byte Suffix Arrays (BSAs) are stuck doing rigid, exact-text matching (Ctrl+F on steroids). InfiniSearch bridges this gap by pairing an LLM-powered "smart query generator" with a massive BSA index, giving researchers true semantic search over trillion-token corpora for the first time.
What Problem Does This Paper Address?
Modern LLMs train on oceans of text—often trillions of tokens occupying tens of terabytes. Exploring this data is vital for data attribution and auditing, yet our search tools hit a wall at this scale. Dense vector databases and traditional lexical indices (like Lucene/BM25) become prohibitively expensive to build and host for pre-training corpora.
Recently, an engine called infini-gram used Byte Suffix Arrays (BSAs)—essentially giant, sorted lookup tables of every byte suffix in a corpus—to count exact phrases across trillions of tokens in milliseconds. The catch? BSAs are binary and unforgiving. If you search for "vicarious trauma" and a relevant document calls it "compassion fatigue," a BSA returns nothing. The authors tackle how to bring flexible, meaning-aware retrieval to rigid BSAs without sacrificing their massive scalability.
Methods
InfiniSearch wraps the raw speed of infini-gram in a clever three-stage pipeline, turning fuzzy human questions into precise logical queries before filtering the results.
- LLM Keyword Expansion (Novel application for BSAs): An LLM (like Claude-Opus 4.6) reads the user's query, extracts core noun phrases, expands each with 5 synonyms, and suggests 10 broader associated terms.
- Dynamic CNF Query Construction (Novel): Feeding millions of broad keyword matches into a reranker would grind the system to a halt. Instead, InfiniSearch builds Conjunctive Normal Form (CNF) queries—logical
AND/ORcombinations like(Vicarious OR vicarious) AND (Trauma OR trauma)within a 10-token window. Crucially, it queries the BSA just for match counts first. Rare standalone terms are kept directly; overly common terms (like "coping", with 117k+ matches) are combined into stricter 2-termANDqueries until a target budget $B$ (e.g., 40,000 matches) is reached. - Lightweight Semantic Filtering & Reranking (Standard): The ~25k retrieved documents are decoded from tokens back to text, filtered down to 1,000 via a tiny bi-encoder (
all-MiniLM-L6-v2), and reranked to the top 100 using a small cross-encoder (ms-marco-MiniLM-L-12-v2)—all runnable on a CPU.
Datasets
No new benchmarks were introduced; instead, the authors tested across scales:
- Development & Sanity Check: MS MARCO v2.1 using TREC RAG 2024 queries (301 test topics).
- Zero-Shot Generalization: Seven diverse BEIR benchmarks covering fact-checking (FEVER, Climate-FEVER, SciFact, TREC-Covid), argument retrieval (ArguAna, Touché 2020), and QA (FiQA-2018).
- LLM-Scale Case Study: The OLMo 2 pre-training corpus—a massive 4.6 trillion token dataset (22.4 TB index) accessed via the infini-gram API.
Key Insights and Ideas
- Exact-match traces can be deceiving: Tools like OlmoTrace link model outputs to training data via verbatim overlapping spans. When OLMo-2 wrote that vicarious trauma causes "symptoms such as anxiety, depression, burnout," OlmoTrace matched that exact phrase to training documents about nicotine, caffeine, and perfectionism! InfiniSearch found documents actually discussing trauma and compassion fatigue.
- Associated terms are your safety net: In ablations, direct synonyms drove most of the average recall gains, while broader "associated terms" boosted the worst-performing 10% of queries (CVaR) by 7.6%, rescuing edge cases where synonyms fell short.
- Counting before fetching: Using millisecond BSA count queries to dynamically gauge term specificity lets the system tame wildly skewed term frequencies (e.g., 600 hits vs. millions) before pulling actual documents.
Key Results
- TREC RAG 2024: InfiniSearch achieved 0.54 NDCG@10 and 0.22 Recall@100, beating standard BM25 (0.47 / 0.14) and keyword-expanded BM25 (0.52 / 0.12) under the same reranker.
- BEIR Suite: Without any task-specific tuning, InfiniSearch beat BM25, SPLADE++, and Contriever on fact-retrieval tasks like TREC-Covid (0.746 NDCG@10) and FEVER (0.838 NDCG@10), though it lagged on long-query argument tasks like ArguAna (0.233).
- OLMo 2 Qualitative Study: When pooling InfiniSearch results with verbatim OlmoTrace matches and reranking them for relevance to 11 model claims, OlmoTrace's best document ranked 84.5 on average (never cracking the top 45), whereas InfiniSearch's top-1 results consistently corroborated the claims via expanded keywords.
Limitations and Future Work
- Query Latency: On smaller benchmarks like MS MARCO, InfiniSearch is much slower than Lucene BM25 (32.7s median query latency vs. 0.39s), largely because constructing CNF queries requires ~227 round-trip index calls per topic. (Though at 4.6T tokens, Lucene isn't even in the race.)
- Tokenization Brittleness: Because the BSA operates on Llama-2 tokens,
Greatand"Greatare distinct tokens, making search sensitive to punctuation artifacts and typos. - Future Directions: Adopting compressed FM-Indices (like infini-gram mini) to shrink the 2.5× larger index footprint, and using reinforcement learning to generate optimal CNF queries in a single pass—eliminating the slow heuristic counting loop.
Summary updated