mlsanityData to 14 Oct 2026

Understanding Transformers via N-gram Statistics

arXiv 2407.12034 ↗First posted 30 Jun 2024cs.CL cs.AI cs.LGcited by 26

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

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2022Training Compute-Optimal Large Language Modelscited by 3,019
  3. 2022In-context Learning and Induction Headscited by 964
  4. 2022Quantifying Memorization Across Neural Language Modelscited by 763
  5. 2023Bias and Fairness in Large Language Models: A Surveycited by 639
  6. 2022Large Language Models Struggle to Learn Long-Tail Knowledgecited by 458
  7. 2023TinyStories: How Small Can Language Models Be and Still Speak Coherent English?cited by 449
  8. 2023Scalable Extraction of Training Data from (Production) Language Modelscited by 434
  9. 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 407
  10. 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 204
  11. 2024Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokenscited by 153
  12. 2023Sudden Drops in the Loss: Syntax Acquisition, Phase Transitions, and Simplicity Bias in MLMscited by 124
6 more
  1. 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
  2. 2023Neurons in Large Language Models: Dead, N-gram, Positionalcited by 88
  3. 2022Measuring Causal Effects of Data Statistics on Language Model's `Factual' Predictionscited by 57
  4. 2021The Grammar-Learning Trajectories of Neural Language Modelscited by 36
  5. 2024Transformers Can Represent n-gram Language Modelscited by 32
  6. 2023Impact of Co-occurrence on Factual Knowledge of Large Language Modelscited by 19

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 2; 2025: 11; 2026: 13.

26 papers.

Sort:

By area:

  1. 2026Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Modelscited by 86
  2. 2024AI as Humanity's Salieri: Quantifying Linguistic Creativity of Language Models via Systematic Attribution of Machine Text against Web Textcited by 42
  3. 2025How do language models learn facts? Dynamics, curricula and hallucinationscited by 37
  4. 2025Learning curves theory for hierarchically compositional data with power-law distributed featurescited by 17
  5. 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Pointscited by 16
  6. 2025Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scalecited by 13
  7. 2025Selective Induction Heads: How Transformers Select Causal Structures In Contextcited by 8
  8. 2025Evolution of Concepts in Language Model Pre-Trainingcited by 8
  9. 2025Bigram Subnetworks: Mapping to Next Tokens in Transformer Language Modelscited by 5
  10. 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architecturescited by 5
  11. 2024Jet Expansions of Residual Computationcited by 4
  12. 2026Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMscited by 3
14 more
  1. 2025Cognitive Activation and Chaotic Dynamics in Large Language Models: A Quasi-Lyapunov Analysis of Reasoning Mechanismscited by 1
  2. 2025From n-gram to Attention: How Model Architectures Learn and Propagate Bias in Language Modelingcited by 1
  3. 2025Quality over Quantity: An Effective Large-Scale Data Reduction Strategy Based on Pointwise V-Informationcited by 1
  4. 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descentcited by 1
  5. 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMscited by 1
  6. 2026Induction Heads Interpolate N-Gramscited by 1
  7. 2026Tokenizer-Agnostic Engram Modulecited by 1
  8. 2026Task-Centric Acceleration of Small-Language Modelscited by 0
  9. 2026The Role of Rigor in Artificial Intelligencecited by 0
  10. 2026Tracing LLM Behavior to the Training Data with Empirical Next-Token Distributionscited by 0
  11. 2026The Geometry of Ignorance: LLMs Know When to Temper Bayesian Priorscited by 0
  12. 2026What Next-Event Accuracy Cannot See: Closed-Loop Evaluation of Emergency Department Trajectory Simulatorscited by 0
  13. 2026Forecasting Corpus-Sampling Disagreement in Masked Text Reconstructioncited by 0
  14. 2026Exact Scaling Laws for a Random-Features Bigram Modelcited by 0