Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens
Not on the map. Why?
Abstract (arXiv)
Are n-gram language models still relevant in this era of neural large language models (LLMs)? Our answer is yes, and we showcase their values in both text analysis and improving neural LLMs. This was done by modernizing n-gram LMs in two aspects. First, we train them at the same data scale as neural LLMs -- 5 trillion tokens. This is the largest n-gram LM ever built. Second, existing n-gram LMs use small n which hinders their performance; we instead allow n to be arbitrarily large, by introducing a new ∞-gram LM with backoff. Instead of pre-computing n-gram count tables (which would be very expensive), we develop an engine named infini-gram -- powered by suffix arrays -- that can compute ∞-gram (as well as n-gram with arbitrary n) probabilities with millisecond-level latency. The ∞-gram framework and infini-gram engine enable us to conduct many novel and interesting analyses of human-written and machine-generated text: we find that the ∞-gram LM has fairly high accuracy for next-token prediction (47%), and can complement neural LLMs to greatly reduce their perplexity. When analyzing machine-generated text, we also observe irregularities in the machine--∞-gram agreement level with respect to the suffix length, which indicates deficiencies in neural LLM pretraining and the positional embeddings of Transformers.
Key facts. Cited by 148 papers in the map (data through 7 Oct 2026). Builds on 25 of its 51 references that are in the map. First posted on arXiv 30 Jan 2024.
Builds on
25 of 51 references.
References · 25
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
- 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,103
- 2023Accelerating Large Language Model Decoding with Speculative Samplingcited by 975
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 940
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
- 2023REPLUG: Retrieval-Augmented Black-Box Language Modelscited by 786
13 more
- 2021Deduplicating Training Data Makes Language Models Bettercited by 705
- 2021Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpuscited by 481
- 2018Adaptive Input Representations for Neural Language Modelingcited by 226
- 2023REST: Retrieval-Based Speculative Decodingcited by 148
- 2023What's In My Big Data?cited by 129
- 2022Training Language Models with Memory Augmentationcited by 112
- 2023SILO Language Models: Isolating Legal Risk In a Nonparametric Datastorecited by 71
- 2022Nonparametric Masked Language Modelingcited by 39
- 2023The ROOTS Search Tool: Data Transparency for LLMscited by 30
- 2023Data Portraits: Recording Foundation Model Training Datacited by 29
- 2023Copy Is All You Needcited by 25
- 2023Koala: An Index for Quantifying Overlaps with Pre-training Corporacited by 19
- 2019KiloGrams: Very Large N-Grams for Malware Classificationcited by 9
Built on by
Citing papers per year: 2024: 33; 2025: 62; 2026: 53.
148 papers.
Sort:
By area:
- 2025A General Framework for Inference-time Scaling and Steering of Diffusion Modelscited by 201
- 2024Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Datacited by 83
- 2026Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Modelscited by 78
- 2025SuperBPE: Space Travel for Language Modelscited by 58
- 2024Demystifying Verbatim Memorization in Large Language Modelscited by 55
- 2024Gender, Race, and Intersectional Bias in Resume Screening via Language Model Retrievalcited by 49
- 2024Can LLM Graph Reasoning Generalize beyond Pattern Memorization?cited by 46
- 2025Theoretical Benefit and Limitation of Diffusion Language Modelcited by 46
- 2025Over-Tokenized Transformer: Vocabulary is Generally Worth Scalingcited by 42
- 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Textcited by 40
- 2025Safety Pretraining: Toward the Next Generation of Safe AIcited by 35
- 2025Tracing the Representation Geometry of Language Models from Pretraining to Post-trainingcited by 33
38 more
- 2025Diffusion Tree Sampling: Scalable inference-time alignment of diffusion modelscited by 31
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2025OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokenscited by 27
- 2025WikiBigEdit: Understanding the Limits of Lifelong Knowledge Editing in LLMscited by 25
- 2024Evaluating n-Gram Novelty of Language Models Using Rusty-DAWGcited by 24
- 2024Understanding Transformers via N-gram Statisticscited by 23
- 2024Avoiding Copyright Infringement via Large Language Model Unlearningcited by 22
- 2026Deriving Neural Scaling Laws from the statistics of natural languagecited by 18
- 2024Language Models are Surprisingly Fragile to Drug Names in Biomedical Benchmarkscited by 17
- 2024Cross-Care: Assessing the Healthcare Implications of Pre-training Data on Language Model Biascited by 15
- 2025Synthesizing Privacy-Preserving Text Data via Finetuning without Finetuning Billion-Scale LLMscited by 15
- 2025The Illusion of Certainty: Uncertainty Quantification for LLMs Fails under Ambiguitycited by 15
- 2024From Loops to Oops: Fallback Behaviors of Language Models Under Uncertaintycited by 13
- 2024Reverse Question Answering: Can an LLM Write a Question so Hard (or Bad) that it Can't Answer?cited by 13
- 2025Infini-gram mini: Exact n-gram Search at the Internet Scale with FM-Indexcited by 13
- 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scalecited by 13
- 2026Speculative Speculative Decodingcited by 13
- 2024The Responsible Foundation Model Development Cheatsheet: A Review of Tools & Resourcescited by 11
- 2024Can Transformers Learn n-gram Language Models?cited by 11
- 2024Probing Language Models on Their Knowledge Sourcecited by 11
- 2025Blackbox Model Provenance via Palimpsestic Membership Inferencecited by 11
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2025Tracing Multilingual Factual Knowledge Acquisition in Pretrainingcited by 10
- 2024Richer Output for Richer Countries: Uncovering Geographical Disparities in Generated Stories and Travel Recommendationscited by 9
- 2025LLM Knowledge is Brittle: Truthfulness Representations Rely on Superficial Resemblancecited by 9
- 2025AI Agents as Universal Task Solverscited by 9
- 2024Attributing Culture-Conditioned Generations to Pretraining Corporacited by 8
- 2025Information-Guided Identification of Training Data Imprint in (Proprietary) Large Language Modelscited by 8
- 2025Truth over Tricks: Measuring and Mitigating Shortcut Learning in Misinformation Detectioncited by 8
- 2025Gaperon: A Peppered English-French Generative Language Model Suitecited by 8
- 2025Beat the long tail: Distribution-Aware Speculative Decoding for RL Trainingcited by 8
- 2026Why Larger Models Learn More: Effects of Capacity, Interference, and Rare-Task Retentioncited by 8
- 2024TAXI: Evaluating Categorical Knowledge Editing for Language Modelscited by 7
- 2025On the Acquisition of Shared Grammatical Representations in Bilingual Language Modelscited by 7
- 2025All Code, No Thought: Current Language Models Struggle to Reason in Ciphered Languagecited by 7
- 2024The Role of n-gram Smoothing in the Age of Neural Networkscited by 6
- 2024Unlocking Legal Knowledge: A Multilingual Dataset for Judicial Summarization in Switzerlandcited by 6
- 2024N-Gram Induction Heads for In-Context RL: Improving Stability and Reducing Data Needscited by 6
50 most cited of 148 All 148 (JSON)
- 2026ActiveMedAgent: Cost-Aware Trajectory Learning for Multimodal Medical Diagnosis8 Oct 2026
- 2026Sample complexity bounds for categorical Markov random fields via Discrete Diffusions1 Oct 2026
- 2026Forking: Sudden Overfitting Under Replay30 Sep 2026
- 2026MoME: Mixture-of-Memory Embeddings for Context-Aware Sparse Lookup14 Sep 2026
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Detectable Only Where It Is Confounded: What Verified Duplication Counts Say About Membership Evidence in Language Models9 Sep 2026
- 2026Molecular D'ej`a Vu: Digit-Level Retrieval of Molecular Properties in Frontier Language Models4 Sep 2026
- 2026Knowledge Acquisition During Pre-training? Large Language Models Learn Better With Auxiliary Views3 Sep 2026
- 2026Who Put the I in AI? Provenance and the Admissibility of Machine Self-Report24 Aug 2026
- 2026The Limits of Automatic Evaluation of Creativity in Large Language Models24 Aug 2026
- 2026Interrupting the Loop: Periodic Subject Changes Raise Judged Surprise and Connection in Base Language Models20 Aug 2026
- 2026What to Forget in Unlearning? Forget Set Curation for Language Models14 Aug 2026
38 more
- 2026The More Popular, The Harder to Forget: Adaptive Popularity for LLM Unlearning14 Aug 2026
- 2026Toward a Gricean Retreat: Probing LLMs for Knowledge Boundaries and Referent Specificity13 Aug 2026
- 2026REFRAMED: Towards Realistic Audio Description Generation for Movies10 Aug 2026
- 2026ConlangBench: Exploring Language Knowledge and Learning in LLMs through Diverse Constructed Languages4 Aug 2026
- 2026Tokenizer-Agnostic Engram Module31 Jul 2026
- 2026When Trivia Is Not Trivial: Everyday Knowledge Failures in Multilingual LLMs23 Jul 2026
- 2026Frontier AI performance across the business disciplines: a case-grounded benchmark of knowledge work and analytical reasoning17 Jul 2026
- 2026Tracing LLM Behavior to the Training Data with Empirical Next-Token Distributions15 Jul 2026
- 2026Reading Without a Reader: Large Language Models Collapse Reading and Writing into a Single Entangled Code2 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026Parameter Golf: What Really Works?1 Jul 2026
- 2026Quantifying the Agreement Between Data-Influence and Data-Similarity to Understand LLM Behavior22 Jun 2026
- 2026DeFAb: A Verifiable Benchmark for Defeasible Abduction in Foundation Models17 Jun 2026
- 2026LLMs Infer Cultural Context but Fail to Apply It When Responding16 Jun 2026
- 2026The Holistic Storage of Verb+Up Phrases in Text-based and Audio-based Language Models12 Jun 2026
- 2026PhantomBench: Benchmarking the Non-existential Threat of Language Models9 Jun 2026
- 2026LLMs Can Leak Training Data But Do They Want To? A Propensity-Aware Evaluation of Memorization in LLMs4 Jun 2026
- 2026Rethinking the Idiomaticity Decomposability Hypothesis: Evidence from Distributional Learning2 Jun 2026
- 2026Language Models Learn Constructional Semantics, Not To Mention Syntax: Investigating LM Understanding of Paired-Focus Constructions29 May 2026
- 2026Measuring, Localizing, and Ablating Alignment Signatures in LLMs28 May 2026
- 2026Beyond Math and Code: Lightweight Corpus-Grounded Process Rewards for Factual Question Answering28 May 2026
- 2026Why Larger Models Learn More: Effects of Capacity, Interference, and Rare-Task Retention28 May 2026
- 2026Efficient and Scalable Provenance Tracking for LLM-Generated Code Snippets27 May 2026
- 2026PoisonForge: Task-Level Targeted Poisoning Benchmark for Instruction-Tuned LLMs22 May 2026
- 2026Memory Grafting: Scaling Language Model Pre-training via Offline Conditional Memory20 May 2026
- 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMs16 May 2026
- 2026Attribution Bias in Large Language Models6 Apr 2026
- 2026Translation or Recitation? Calibrating Evaluation Scores for Machine Translation of Extremely Low-Resource Languages26 Mar 2026
- 2026A Comparative Analysis of LLM Memorization at Statistical and Internal Levels: Cross-Model Commonalities and Model-Specific Signatures23 Mar 2026
- 2026Alignment Whack-a-Mole : Finetuning Activates Verbatim Recall of Copyrighted Books in Large Language Models21 Mar 2026
- 2026N-gram-like Language Models Predict Naturalistic Reading Time Best10 Mar 2026
- 2026N-gram Injection into Transformers for Dynamic Language Model Adaptation in Handwritten Text Recognition4 Mar 2026
- 2026Speculative Speculative Decoding3 Mar 2026
- 2026Task-Centric Acceleration of Small-Language Models27 Feb 2026
- 2026In Agents We Trust, but Who Do Agents Trust? Latent Source Preferences Steer LLM Generations17 Feb 2026
- 2026SoftMatcha 2: A Fast and Soft Pattern Matcher for Trillion-Scale Corpora11 Feb 2026
- 2026Deriving Neural Scaling Laws from the statistics of natural language7 Feb 2026
- 2026BenchMarker: An Education-Inspired Toolkit for Highlighting Flaws in Multiple-Choice Benchmarks5 Feb 2026
50 newest of 148 All 148 (JSON)
- 2025A General Framework for Inference-time Scaling and Steering of Diffusion Modelscited by 201
- 2024Can LLM Graph Reasoning Generalize beyond Pattern Memorization?cited by 46
- 2025All Code, No Thought: Current Language Models Struggle to Reason in Ciphered Languagecited by 7
- 2025One Model, Many Morals: Uncovering Cross-Linguistic Misalignments in Computational Moral Reasoningcited by 4
- 2025Rectifying Belief Space via Unlearning to Harness LLMs' Reasoningcited by 2
- 2024QUENCH: Measuring the gap between Indic and Non-Indic Contextual General Reasoning in LLMscited by 0
- 2026Rethinking the Idiomaticity Decomposability Hypothesis: Evidence from Distributional Learningcited by 0
- 2026Frontier AI performance across the business disciplines: a case-grounded benchmark of knowledge work and analytical reasoningcited by 0
- 2026Frontier AI performance across the business disciplines: a case-grounded benchmark of knowledge work and analytical reasoning17 Jul 2026
- 2026Rethinking the Idiomaticity Decomposability Hypothesis: Evidence from Distributional Learning2 Jun 2026
- 2025All Code, No Thought: Current Language Models Struggle to Reason in Ciphered Language10 Oct 2025
- 2025One Model, Many Morals: Uncovering Cross-Linguistic Misalignments in Computational Moral Reasoning25 Sep 2025
- 2025Rectifying Belief Space via Unlearning to Harness LLMs' Reasoning28 Feb 2025
- 2025A General Framework for Inference-time Scaling and Steering of Diffusion Models12 Jan 2025
- 2024QUENCH: Measuring the gap between Indic and Non-Indic Contextual General Reasoning in LLMs16 Dec 2024
- 2024Can LLM Graph Reasoning Generalize beyond Pattern Memorization?23 Jun 2024
- 2024Avoiding Copyright Infringement via Large Language Model Unlearningcited by 22
- 2025Blackbox Model Provenance via Palimpsestic Membership Inferencecited by 11
- 2024A Statistical and Multi-Perspective Revisiting of the Membership Inference Attack in Large Language Modelscited by 5
- 2025Revisiting the Past: Data Unlearning with Model State Historycited by 2
- 2026The More Popular, The Harder to Forget: Adaptive Popularity for LLM Unlearningcited by 0
- 2026What to Forget in Unlearning? Forget Set Curation for Language Modelscited by 0
- 2026What to Forget in Unlearning? Forget Set Curation for Language Models14 Aug 2026
- 2026The More Popular, The Harder to Forget: Adaptive Popularity for LLM Unlearning14 Aug 2026
- 2025Blackbox Model Provenance via Palimpsestic Membership Inference22 Oct 2025
- 2025Revisiting the Past: Data Unlearning with Model State History26 Jun 2025
- 2024A Statistical and Multi-Perspective Revisiting of the Membership Inference Attack in Large Language Models18 Dec 2024
- 2024Avoiding Copyright Infringement via Large Language Model Unlearning16 Jun 2024
- 2025Beat the long tail: Distribution-Aware Speculative Decoding for RL Trainingcited by 8
- 2025ParaPO: Aligning Language Models to Reduce Verbatim Reproduction of Pre-training Datacited by 6
- 2026Alignment Whack-a-Mole : Finetuning Activates Verbatim Recall of Copyrighted Books in Large Language Modelscited by 6
- 2026Measuring, Localizing, and Ablating Alignment Signatures in LLMscited by 0
- 2026Measuring, Localizing, and Ablating Alignment Signatures in LLMs28 May 2026
- 2026Alignment Whack-a-Mole : Finetuning Activates Verbatim Recall of Copyrighted Books in Large Language Models21 Mar 2026
- 2025Beat the long tail: Distribution-Aware Speculative Decoding for RL Training17 Nov 2025
- 2025ParaPO: Aligning Language Models to Reduce Verbatim Reproduction of Pre-training Data20 Apr 2025
- 2026Speculative Speculative Decodingcited by 13
- 2026Speculative Speculative Decoding3 Mar 2026
- 2024Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Datacited by 83
- 2025SuperBPE: Space Travel for Language Modelscited by 58
- 2024Demystifying Verbatim Memorization in Large Language Modelscited by 55
- 2024Gender, Race, and Intersectional Bias in Resume Screening via Language Model Retrievalcited by 49
- 2025Over-Tokenized Transformer: Vocabulary is Generally Worth Scalingcited by 42
- 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Textcited by 40
- 2025Safety Pretraining: Toward the Next Generation of Safe AIcited by 35
- 2025Tracing the Representation Geometry of Language Models from Pretraining to Post-trainingcited by 33
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2025OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokenscited by 27
- 2025WikiBigEdit: Understanding the Limits of Lifelong Knowledge Editing in LLMscited by 25
- 2024Evaluating n-Gram Novelty of Language Models Using Rusty-DAWGcited by 24
12 most cited of 119 All 119 (JSON)
- 2026ActiveMedAgent: Cost-Aware Trajectory Learning for Multimodal Medical Diagnosis8 Oct 2026
- 2026Forking: Sudden Overfitting Under Replay30 Sep 2026
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Detectable Only Where It Is Confounded: What Verified Duplication Counts Say About Membership Evidence in Language Models9 Sep 2026
- 2026Molecular D'ej`a Vu: Digit-Level Retrieval of Molecular Properties in Frontier Language Models4 Sep 2026
- 2026Knowledge Acquisition During Pre-training? Large Language Models Learn Better With Auxiliary Views3 Sep 2026
- 2026Who Put the I in AI? Provenance and the Admissibility of Machine Self-Report24 Aug 2026
- 2026The Limits of Automatic Evaluation of Creativity in Large Language Models24 Aug 2026
- 2026Interrupting the Loop: Periodic Subject Changes Raise Judged Surprise and Connection in Base Language Models20 Aug 2026
- 2026Toward a Gricean Retreat: Probing LLMs for Knowledge Boundaries and Referent Specificity13 Aug 2026
- 2026REFRAMED: Towards Realistic Audio Description Generation for Movies10 Aug 2026
- 2026ConlangBench: Exploring Language Knowledge and Learning in LLMs through Diverse Constructed Languages4 Aug 2026
12 newest of 119 All 119 (JSON)