Understanding Transformers via N-gram Statistics
Not on the map. Why?
Abstract (arXiv)
Transformer based large-language models (LLMs) display extreme proficiency with language yet a precise understanding of how they work remains elusive. One way of demystifying transformer predictions would be to describe how they depend on their context in terms of simple template functions. This paper takes a first step in this direction by considering families of functions (i.e. rules) formed out of simple N-gram based statistics of the training data. By studying how well these rulesets approximate transformer predictions, we obtain a variety of novel discoveries: a simple method to detect overfitting during training without using a holdout set, a quantitative measure of how transformers progress from learning simple to more complex statistical rules over the course of training, a model-variance criterion governing when transformer predictions tend to be described by N-gram rules, and insights into how well transformers can be approximated by N-gram rulesets in the limit where these rulesets become increasingly complex. In this latter direction, we find that for 79% and 68% of LLM next-token distributions on TinyStories and Wikipedia, respectively, their top-1 predictions agree with those provided by our N-gram rulesets.
Key facts. Cited by 26 papers in the map (data through 14 Oct 2026). Builds on 18 of its 29 references that are in the map. First posted on arXiv 30 Jun 2024.
Builds on
18 of 29 references.
References · 18
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Training Compute-Optimal Large Language Modelscited by 3,019
- 2022In-context Learning and Induction Headscited by 964
- 2022Quantifying Memorization Across Neural Language Modelscited by 763
- 2023Bias and Fairness in Large Language Models: A Surveycited by 639
- 2022Large Language Models Struggle to Learn Long-Tail Knowledgecited by 458
- 2023TinyStories: How Small Can Language Models Be and Still Speak Coherent English?cited by 449
- 2023Scalable Extraction of Training Data from (Production) Language Modelscited by 434
- 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 407
- 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 204
- 2024Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokenscited by 153
- 2023Sudden Drops in the Loss: Syntax Acquisition, Phase Transitions, and Simplicity Bias in MLMscited by 124
6 more
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
- 2023Neurons in Large Language Models: Dead, N-gram, Positionalcited by 88
- 2022Measuring Causal Effects of Data Statistics on Language Model's `Factual' Predictionscited by 57
- 2021The Grammar-Learning Trajectories of Neural Language Modelscited by 36
- 2024Transformers Can Represent n-gram Language Modelscited by 32
- 2023Impact of Co-occurrence on Factual Knowledge of Large Language Modelscited by 19
Built on by
Citing papers per year: 2024: 2; 2025: 11; 2026: 13.
26 papers.
Sort:
By area:
- 2026Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Modelscited by 86
- 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Textcited by 42
- 2025How do language models learn facts? Dynamics, curricula and hallucinationscited by 37
- 2025Learning curves theory for hierarchically compositional data with power-law distributed featurescited by 17
- 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Pointscited by 16
- 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scalecited by 13
- 2025Selective Induction Heads: How Transformers Select Causal Structures In Contextcited by 8
- 2025Evolution of Concepts in Language Model Pre-Trainingcited by 8
- 2025Bigram Subnetworks: Mapping to Next Tokens in Transformer Language Modelscited by 5
- 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architecturescited by 5
- 2024Jet Expansions of Residual Computationcited by 4
- 2026Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMscited by 3
14 more
- 2025Cognitive Activation and Chaotic Dynamics in Large Language Models: A Quasi-Lyapunov Analysis of Reasoning Mechanismscited by 1
- 2025From n-gram to Attention: How Model Architectures Learn and Propagate Bias in Language Modelingcited by 1
- 2025Quality over Quantity: An Effective Large-Scale Data Reduction Strategy Based on Pointwise V-Informationcited by 1
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descentcited by 1
- 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMscited by 1
- 2026Induction Heads Interpolate N-Gramscited by 1
- 2026Tokenizer-Agnostic Engram Modulecited by 1
- 2026Task-Centric Acceleration of Small-Language Modelscited by 0
- 2026The Role of Rigor in Artificial Intelligencecited by 0
- 2026Tracing LLM Behavior to the Training Data with Empirical Next-Token Distributionscited by 0
- 2026The Geometry of Ignorance: LLMs Know When to Temper Bayesian Priorscited by 0
- 2026What Next-Event Accuracy Cannot See: Closed-Loop Evaluation of Emergency Department Trajectory Simulatorscited by 0
- 2026Forecasting Corpus-Sampling Disagreement in Masked Text Reconstructioncited by 0
- 2026Exact Scaling Laws for a Random-Features Bigram Modelcited by 0
- 2026Exact Scaling Laws for a Random-Features Bigram Model13 Oct 2026
- 2026Forecasting Corpus-Sampling Disagreement in Masked Text Reconstruction9 Oct 2026
- 2026What Next-Event Accuracy Cannot See: Closed-Loop Evaluation of Emergency Department Trajectory Simulators10 Sep 2026
- 2026The Geometry of Ignorance: LLMs Know When to Temper Bayesian Priors2 Sep 2026
- 2026Tokenizer-Agnostic Engram Module31 Jul 2026
- 2026Tracing LLM Behavior to the Training Data with Empirical Next-Token Distributions15 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMs6 Jun 2026
- 2026The Role of Rigor in Artificial Intelligence19 May 2026
- 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMs16 May 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
- 2026Task-Centric Acceleration of Small-Language Models27 Feb 2026
14 more
- 2026Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models12 Jan 2026
- 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scale28 Oct 2025
- 2025Evolution of Concepts in Language Model Pre-Training21 Sep 2025
- 2025Selective Induction Heads: How Transformers Select Causal Structures In Context9 Sep 2025
- 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Points18 Aug 2025
- 2025Quality over Quantity: An Effective Large-Scale Data Reduction Strategy Based on Pointwise V-Information19 Jun 2025
- 2025From n-gram to Attention: How Model Architectures Learn and Propagate Bias in Language Modeling18 May 2025
- 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architectures11 May 2025
- 2025Learning curves theory for hierarchically compositional data with power-law distributed features11 May 2025
- 2025Bigram Subnetworks: Mapping to Next Tokens in Transformer Language Models21 Apr 2025
- 2025How do language models learn facts? Dynamics, curricula and hallucinations27 Mar 2025
- 2025Cognitive Activation and Chaotic Dynamics in Large Language Models: A Quasi-Lyapunov Analysis of Reasoning Mechanisms15 Mar 2025
- 2024Jet Expansions of Residual Computation8 Oct 2024
- 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Text5 Oct 2024
- 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Textcited by 42
- 2025How do language models learn facts? Dynamics, curricula and hallucinationscited by 37
- 2025Learning curves theory for hierarchically compositional data with power-law distributed featurescited by 17
- 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Pointscited by 16
- 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scalecited by 13
- 2025Selective Induction Heads: How Transformers Select Causal Structures In Contextcited by 8
- 2025Evolution of Concepts in Language Model Pre-Trainingcited by 8
- 2025Bigram Subnetworks: Mapping to Next Tokens in Transformer Language Modelscited by 5
- 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architecturescited by 5
- 2024Jet Expansions of Residual Computationcited by 4
- 2026Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMscited by 3
- 2025From n-gram to Attention: How Model Architectures Learn and Propagate Bias in Language Modelingcited by 1
12 most cited of 23 All 23 (JSON)
- 2026Exact Scaling Laws for a Random-Features Bigram Model13 Oct 2026
- 2026Forecasting Corpus-Sampling Disagreement in Masked Text Reconstruction9 Oct 2026
- 2026What Next-Event Accuracy Cannot See: Closed-Loop Evaluation of Emergency Department Trajectory Simulators10 Sep 2026
- 2026The Geometry of Ignorance: LLMs Know When to Temper Bayesian Priors2 Sep 2026
- 2026Tokenizer-Agnostic Engram Module31 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMs6 Jun 2026
- 2026The Role of Rigor in Artificial Intelligence19 May 2026
- 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMs16 May 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
- 2026Task-Centric Acceleration of Small-Language Models27 Feb 2026
- 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scale28 Oct 2025
12 newest of 23 All 23 (JSON)