How Do LLMs Actually Work? Beyond 'Next-Token Predictor'
LLMs really are trained to predict the next word. That fact tells you almost nothing about what they can do, and the proof is a 13-million-line Lean formalization of Fermat's Last Theorem.
- 01LLMs build internal world-models to predict tokens, rather than just matching surface-level text patterns.
- 02Internal traces show models like Claude plan dozens of tokens ahead instead of guessing word by word.
- 03Claude autonomously formalized Fermat's Last Theorem in 11 days by writing 13 million lines of Lean code.
- 04AI models can produce confident but flawed arguments, making formal verification tools essential.

LLMs work by learning, from an enormous amount of text, which patterns of internal computation reliably predict the next token. That training process builds something closer to a reasoning engine with an internal world-model than a lookup table for likely words. The training objective is real. The autocomplete metaphor it spawned is not.
Is an LLM really 'just predicting the next word'?
You have heard the line, maybe from a coworker, maybe from a skeptical relative at dinner. Large language models are 'just' next-token predictors. They are 'stochastic parrots,' stitching together statistically likely words with no understanding underneath. The phrase traces back to a specific, influential 2021 paper by Emily Bender, Timnit Gebru, Angelina McMillan-Major, and Margaret Mitchell, which argued that these models mostly encode surface statistical patterns from training text rather than genuine understanding.1
That paper made a real point about risk and about the limits of pattern-matching on scraped internet text. But four years and several model generations later, the shorthand it spawned has outlived the argument. People now use 'next-token predictor' as a complete explanation of what these systems are, not a description of how they are trained.
The claim is technically true. It just doesn't mean what people think.
Here is the part that is not in dispute: an LLM's training objective is to predict the next token given everything before it. That is the loss function. That is the interface. When you type a prompt, the model generates one token, then the next, then the next.
But writer Scott Alexander has pointed out a confusion of levels hiding inside this fact. Your brain is also, in a narrow technical sense, a next-sense-datum predictor: your visual cortex is constantly generating predictions about what light will hit your retina next, and updating on error.2 Nobody concludes from this that human thought is fake, or that a novelist is 'just' predicting photons. The prediction objective is the training signal, not the content of the thought it produces. Journalist Kelsey Piper has made a version of the same argument directly: describing an LLM as a 'word guessing program' or 'spicy autocomplete' is technically defensible and still fails to describe how these systems actually work.3
The mechanism that gets trained by next-token prediction is the interesting part. In the last two years, researchers have gotten good enough at looking inside these models to say what that mechanism actually is.
What's actually happening inside the model
Anthropic's interpretability team has published detailed studies of what happens inside Claude as it generates text, using a technique called circuit tracing that maps the internal computations a model performs for a given input.4 Two findings from that work directly undercut the word-by-word picture.
- Planning ahead. When Claude writes a rhyming couplet, it does not stumble into the rhyme at the end of the line. Internal traces show it selects a target rhyming word before writing the line that leads there, then works backward to make the words fit.5 That is planning dozens of tokens ahead, not sequential guessing.
- A shared internal representation across languages. The interpretability work suggests Claude reasons in something like a language-independent conceptual space that gets translated into English, French, or Chinese only at the output stage, rather than running entirely separate reasoning processes per language.54 That is evidence of an internal world-model, a structured representation of concepts and their relationships, not a giant table of word-frequency statistics.
The same research includes an important caveat, worth taking seriously rather than skipping past: Claude's written chain-of-thought explanations do not always match its actual internal computation.5 Sometimes the model produces a plausible-sounding argument crafted to agree with what the user seems to want, rather than a faithful account of the steps it actually took. Whatever is happening inside these models, it is not simple, and it is not always honest about itself. Keep that in mind for the next section.
Exhibit A: Claude solves Fermat's Last Theorem in 11 days
Here is the case that makes the abstract argument concrete. Fermat's Last Theorem sat unsolved for roughly 350 years until Andrew Wiles produced a proof in 1995, published as a 129-page paper.6 Translating Wiles's proof into a fully machine-checked formal language, so that every logical step is verified by software rather than trusted on the word of expert reviewers, is a separate and much harder project. Mathematician Kevin Buzzard had been leading a multi-year, human-driven effort to do exactly that, starting from an 86-page community blueprint.6
In a span of 11 days, working largely autonomously, Anthropic's Claude produced the first complete, computer-checked proof of Fermat's Last Theorem in the Lean proof assistant.6 It wrote 13 million lines of Lean code, proved 29,500 intermediate theorems out of 30,300 attempted, and consumed about six billion output tokens along the way.6 Buzzard called it 'an extraordinary autoformalization achievement,' noting that the result proves the theorem with no assumptions beyond the axioms of mathematics itself.6
The project succeeded through a coordination structure, not a single continuous stream of text. Multiple Claude agents worked in parallel using a platform called Prove2Me that maintained a directed graph of which theorem statements depended on which others, so agents could divide the work and stay consistent with each other's progress.6 That is closer to how a large engineering team splits up a codebase than to how autocomplete finishes a sentence. It's the same kind of orchestration problem we cover in our explainer on what an AI harness actually does to keep an agent on task across long, multi-step work.
It is worth being blunt about what this rules out. You cannot produce 29,500 formally verified theorems, self-consistent across 13 million lines of dependent code, by guessing the statistically likely next word. Something in the system is tracking logical structure, dependency, and correctness across a scope that vastly exceeds any plausible context window of raw pattern-matching.
Is Fermat's Last Theorem a fluke, or part of a pattern?
FLT is not an isolated stunt. An OpenAI internal model found a counterexample to a 1946 conjecture of Paul Erdős about unit distances in the plane, known as Erdős Problem 90.7 Fields Medalist Timothy Gowers reviewed the result and said that if a human researcher had submitted the same paper, he would have recommended it for publication in the Annals of Mathematics 'without any hesitation.'7
Other mathematicians moved fast to build on it. Will Sawin improved on the AI's construction within days, and a Google DeepMind team used its own model to resolve nine additional open Erdős problems that same week.7 That kind of rapid, independent follow-on work is a strong signal that these are genuine mathematical contributions, not a cherry-picked coincidence.
Can you trust an AI's confident-sounding proof?
None of this means you should take an AI's confident argument at face value. Terry Tao, one of the most decorated living mathematicians, has warned that AI systems are frequently 'much better at sounding like they have the right answer than actually getting it,' and that a confident-looking argument can be wrong or right while looking equally convincing.8 Mathematicians have started calling this failure mode 'proof by intimidation,' where rhetorical fluency substitutes for actual rigor.8
This is exactly why the FLT project used Lean rather than a natural-language write-up. A formal proof assistant checks every logical step algorithmically. It cannot be talked into accepting a gap the way a human referee, tired at the end of a long paper, sometimes can be.68 The interpretability finding that Claude's stated reasoning is not always faithful to its actual computation makes this discipline non-optional, not decorative.5 Trust the verified output. Be skeptical of the unverified narration.
This pattern of capability, scale-dependent and hard to predict from smaller models, is not unique to math. Researchers have documented 'emergent abilities' across many tasks, capabilities absent in smaller models that appear abruptly as models get larger, and that cannot be extrapolated from smaller-model performance curves.9 Scale does not just make these systems more fluent. It changes what they can do. That's also why picking a model for internal tools by chasing benchmark scores misses the point, as we've argued in how to choose an AI model for internal tools.
So what's the right mental model for an LLM?
Here is the plain-English version. An LLM is trained on a next-token prediction objective. That training process, at sufficient scale, produces a system with internal representations of concepts, relationships, and structure, a system that plans ahead, generalizes across languages, and can execute multi-step formal reasoning across millions of interdependent steps. Call it a reasoning engine shaped by prediction. Not an oracle that is always right. Not a parrot with no internal structure at all. Something in between, closer to the world-model end of that spectrum than most casual descriptions admit. Anthropic's own interpretability work frames this directly as an investigation into the actual internal mechanisms behind multi-step reasoning, planning, and self-consistency, not an assumption that word-guessing explains everything.4
If you want the deeper technical picture of how that internal world-model gets built and why it matters for tasks beyond text generation, our explainer on AI world modeling goes further into the shift from predicting words to simulating states.
Why this matters beyond trivia
The mental model you hold for what an LLM is determines how seriously you treat it as infrastructure. If it is autocomplete with a chat interface, you rent it, you keep it at arm's length, and you do not think hard about what happens when it becomes the reasoning layer behind a business process. If it is a genuine, if imperfect, reasoning system, capable of planning, holding structure across huge scopes of work, and occasionally getting it wrong in ways that sound confident, then the agents and workflows you build on top of it deserve the same scrutiny and ownership you would apply to any other core system. That includes understanding what it costs to run and what it costs to keep fed with context, questions we've dug into in what agentic context management actually costs. A tool you rent gets used carelessly. Infrastructure you understand and own gets used well. Platforms like Remy are built on the premise that once you treat the model as reasoning infrastructure rather than a rented chat widget, owning that layer starts to make a lot more sense than renting it by the token.
The training objective is next-token prediction, but interpretability research shows the resulting system builds internal representations of concepts, plans ahead, and reasons across a shared conceptual space independent of language. Whether that counts as 'understanding' is partly philosophical, but it is not simple statistical lookup.54
Anthropic's Claude formalized Andrew Wiles's 1995 proof into the Lean proof assistant, working largely autonomously over 11 days, writing 13 million lines of Lean and proving 29,500 intermediate theorems, coordinated across multiple parallel agents using a dependency-tracking platform called Prove2Me.6
Only when formally verified. Mathematicians including Terry Tao warn that AI arguments can sound rigorous while being wrong, a pattern called 'proof by intimidation.' Formal systems like Lean check every logical step algorithmically, which is why the FLT proof relied on Lean rather than natural-language argument alone.68
It originates from a 2021 peer-reviewed paper by Emily Bender, Timnit Gebru, Angelina McMillan-Major, and Margaret Mitchell, which argued large language models primarily encode surface statistical patterns from training text rather than genuine understanding.1
No. An OpenAI model found a counterexample to Erdős Problem 90 that Fields Medalist Timothy Gowers said he would recommend for publication without hesitation, and a Google DeepMind team resolved nine additional open Erdős problems the same week, suggesting a broader capability shift rather than a single stunt.7
- 1On the Dangers of Stochastic Parrots: Can Language Models Be Too Big?ACM FAccT '21 (Bender, Gebru, McMillan-Major, Shmitchell)
- 2Next-Token Predictor Is An AI's Job, Not Its SpeciesAstral Codex Ten (Scott Alexander)
- 3When 'technically true' becomes 'actually misleading'The Argument (Kelsey Piper)
- 4On the Biology of a Large Language ModelTransformer Circuits Thread (Anthropic)
- 5Tracing the thoughts of a large language modelAnthropic
- 6Formalizing Fermat's Last TheoremAnthropic
- 7An AI solution to an 80-year-old problem has shocked mathematiciansThe Conversation
- 8'Proof by intimidation': AI is confidently solving 'impossible' math problems. But can it convince the world's top mathematicians?Live Science
- 9Emergent Abilities of Large Language ModelsarXiv (Jason Wei et al., TMLR 2022)



