Why Next-Token Prediction Works
It is not obvious that training a model to predict the next word should produce a system that
can reason, write poetry, solve math problems, and explain scientific concepts. Yet it does —
and understanding why is one of the deepest questions in the field.
The compression argument
To predict the next token well across a diverse corpus, the model must implicitly learn everything
that constrains what comes next: grammar, facts about the world, reasoning patterns, style,
social conventions. A model that learns to predict text must, at least partly, model the process that
generated the text — people writing about the world. Next-token prediction is, in this sense, a
proxy for world modeling, though how much of the world a model captures this way is debated.
Formal framing. Minimizing cross-entropy loss on text is equivalent to maximizing
the log-likelihood of the data under the model — which is equivalent to minimizing the KL
divergence between the model's distribution and the true data-generating distribution. A perfect
model would reproduce the data distribution exactly.
Scaling laws
Empirically, model performance improves as a power law with compute, data, and
parameters — across many orders of magnitude. This was established by Kaplan et al. (2020) and
refined in the Chinchilla paper (Hoffmann et al., 2022), which showed the optimal compute
allocation: for a given compute budget, scale model size and data tokens roughly equally.
Scaling law (Chinchilla form, Hoffmann et al. 2022)
Loss(N, D) ≈ E + A/Nα + B/Dβ
N = model parameters, D = training tokens
E ≈ 1.69 (irreducible loss, nats/token), α ≈ 0.34, β ≈ 0.28
Kaplan et al. (2020) fit separate power laws (N without embedding parameters):
Loss(N) = (Nc/N)αN, αN ≈ 0.076 Loss(D) = (Dc/D)αD, αD ≈ 0.095
Emergent capabilities
As models scale, some capabilities have been reported to appear sharply — essentially absent
at smaller scales and present above a threshold. Examples include multi-step arithmetic,
in-context learning (few-shot prompting), chain-of-thought reasoning, and code generation.
Whether these jumps are real is debated: much of the apparent sharpness comes from all-or-nothing
metrics such as exact match, and with continuous metrics the same abilities often improve smoothly
(Schaeffer et al. 2023).
The alignment question. A language model trained on next-token prediction does
not directly optimize for truthfulness, helpfulness, or factual accuracy — only for predicting
the distribution of its training text. Post-training then shapes the model's behavior: supervised
fine-tuning (SFT) on example responses, preference tuning (RLHF or DPO), and reinforcement learning
on verifiable rewards such as correct answers to math or code problems. This distinction matters
enormously for interpretation.
Connection to studying LLMs like brains. If next-token prediction implicitly encodes
world models and reasoning, then the dynamics of this computation — how information
flows through the residual stream layer by layer as a token sequence is processed — should
reveal something about the internal structure of that world model. This is precisely the
electrophysiology analogy: record the "neural activity" of the model mid-computation
and study its geometry, not just its input-output behavior.
The next lesson moves inside the transformer architecture — the specific network design that
makes large-scale language modeling tractable and powerful.
Key formulas — Lesson 1
Chain rule: P(x0…xT−1) = ∏t P(xt | x0…xt−1)
Softmax: P(i) = exp(zi/τ) / Σj exp(zj/τ) [τ = temperature]
Cross-entropy: Loss = −log P(true token)
Perplexity: PPL = exp(Loss) [Loss averaged over tokens; effective branching factor]