atlas

Research map / Large language models / Language, safety and interpretability

Understanding Transformers via N-Gram Statistics

NeurIPS 2024 · Large language models › Language, safety and interpretability · approach: Pruning and circuits in LLMs · 2 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Shows that transformer next-token predictions on TinyStories and Wikipedia can be approximated by N-gram rulesets built from training-data statistics, and uses this lens to study approximability, curriculum-like learning dynamics, and an overfitting detector without a holdout set.

Problem

Understanding how transformer LLMs use their context when predicting the next token, by describing their predictions as simple template functions (N-gram rules) derived from training data statistics.

Approach

Defines families of regex-style N-gram rules (suffix, subgram, all) formed by keeping, dropping, or marginalizing context tokens, and measures per-context how close transformer predictions are to the best such rule; low model variance across runs predicts good rule approximation.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase maximum rule context length from 1 to 7 using all rule typesOptimal rules approximating the 160M transformer · TinyStories validation storiestop-1 accuracy (%): 30.0 -> 78.0Helped
Use all rule types rather than suffix rules at M=7Optimal rules approximating the 160M transformer · TinyStories validation storiestop-1 accuracy (%): 65.6 -> 78.0Helped
Use all rule types rather than backoff at M=7Optimal rules approximating the 160M transformer · TinyStories validation storiestop-1 accuracy (%): 56.7 -> 78.0Helped
Increase maximum rule context length from 1 to 7 using all rule typesOptimal rules approximating the 1.4B transformer · Wikipedia holdout sequencestop-1 accuracy (%): 24.3 -> 67.7Helped
Scale the transformer from 160M to 1.4BTransformer · TinyStories holdouteval loss: 1.43 -> 1.22Helped
Scale the transformer from 160M to 1.4BTransformer · Wikipedia holdouteval loss: 2.63 -> 2.26Helped
Scale the transformer from 160M to 1.4BOptimal all-rule approximation · TinyStories holdouttop-1 accuracy (%) at context length 7: 77.9 -> 78.2No clear effect

Surprising findings

Limitations

Experimental setup

Datasets: TinyStories MassiveText Wikipedia

Benchmarks: TinyStories validation (100 stories) Wikipedia holdout (10 chunks)

Metrics: top-1 accuracy variational distance L-infinity distance cross-entropy loss

Baselines: stupid backoff

Builds on: stupid backoff Chinchilla infini-gram

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy