A large language model is a system trained to predict what token comes next, over and over, across an enormous amount of text. That sentence sounds too small to explain ChatGPT, and the gap between how simple the objective is and how much falls out of it is the most interesting thing about the field. This is an account of how the machinery works, what it genuinely does, and which parts of the popular explanation — including parts this article used to carry — turn out to be wrong.

Before these systems existed, computers followed strict rules and struggled with meaning. They could sort a spreadsheet instantly, but ask a nuanced question in plain English and they fell apart. That changed in stages, and the stages matter: each one removed a specific bottleneck, and the bottleneck it removed explains what the next generation could suddenly do.

A better metaphor

Not a librarian who retrieves the right book. A writer with an extraordinary memory for how sentences tend to go — who has read enormously, remembers no single source exactly, and will finish your sentence confidently whether or not the ending is true.

That distinction is worth holding on to, because it predicts the failure modes. A retrieval system that cannot find a document returns nothing. A generative system that has no basis for an answer produces one anyway.

Foundations: From Word Counts to Learned Meaning

Counting words

The earliest language models guessed the next word from the two or three words immediately before it — bigrams and trigrams, counted across a corpus. [1] They worked in narrow settings like phone-keyboard autocomplete, and they had a hard ceiling: no memory beyond that tiny window. It is like being asked to continue a story having read only the last two words of it.

Learning representations instead

Neural language models changed the representation rather than the window. Instead of counting how often word sequences co-occur, they learned to place words in a continuous vector space, so that words used in similar ways ended up near each other — generalising to phrasings never seen in training. [2] Recurrent networks, and later Long Short-Term Memory networks, then processed text one step at a time while carrying a hidden state forward. [3]

LSTMs handled far longer dependencies than n-grams, but everything the model knew about the preceding text had to be squeezed through a single fixed-size hidden state. Information from early in a long document faded by the end, and because each step depended on the one before it, training could not be parallelised — a limit the Transformer paper names directly. [4] Both limits fell at once in 2017.

The Transformer, and What It Actually Changed

Attention

The 2017 paper Attention Is All You Need introduced the Transformer. [4] Its mechanism, self-attention, lets each position in a sequence look directly at every other position it is allowed to see, and weigh how much each one matters — rather than inheriting a summary of them through a chain of steps.

“In this work we propose the Transformer, a model architecture eschewing recurrence and instead relying entirely on an attention mechanism to draw global dependencies between input and output.”

— Vaswani et al., Attention Is All You Need, 2017 [4]

The paper frames the benefit as path length: the distance information must travel between two positions drops from proportional-to-length to constant. Shorter paths are easier to learn across. That is the real claim, and it is narrower and more useful than the version usually repeated.

Two things the popular explanation gets wrong

The first is the phrase “looks at every word at once.” During training, yes — the whole sequence is processed in parallel, which is exactly why Transformers train so much faster than recurrent networks. But every model you actually talk to is decoder-only with causal masking, which the original paper describes as preventing leftward information flow to preserve the autoregressive property. [4] Each position sees only what comes before it. And when the model generates, it still emits one token at a time, each one conditioned on everything already written. Parallel training, sequential generation. Conflating the two is why people are surprised that output speed did not improve the way training speed did.

The second is “no information bottleneck.” True in the narrow sense that there is no fixed-size hidden state. False as a general claim: attention costs grow quadratically with sequence length [4], context windows are finite, and models measurably fail to use long contexts evenly. Liu et al. found accuracy is highest when the relevant passage sits at the beginning or end of the input and degrades significantly when it sits in the middle — even in models explicitly built for long contexts. [5]

Position, and why order survives

Self-attention on its own is permutation-invariant: shuffle the words and the mechanism cannot tell. Word order survives because position is injected explicitly, as a separate signal added to each token's representation. [4] It is a small detail that most explanations skip, and skipping it leaves readers with a model that should not be able to distinguish “dog bites man” from “man bites dog.”

Objectives: three that mattered, one that won

2018
GPT — next token

A decoder-only stack with masked self-attention, predicting each token from those before it. [6] The objective every frontier model now uses.

2019
BERT — masked

Hides random tokens and predicts them from both directions at once. [7] Excellent for classification and search; cannot generate fluently.

2020
T5 — text-to-text

Casts every task as text in, text out. [8] Note this is a task interface; T5 pretrains by corrupting spans.

Today
The field converged

The frontier converged on the decoder-only next-token objective; masked encoders survive mainly inside embedding and retrieval systems.

How a Model Is Actually Built

This is the part most explainers truncate, and truncating it leaves a real hole: it makes it impossible to say why a chatbot answers your question instead of continuing your sentence. Building a modern LLM has two distinct stages, and the second one is where the product lives.

Stage one: pretraining

The model reads an enormous corpus — books, web pages, papers, code, forums — and learns to predict the next token. Composition matters enormously; what goes in shapes what the model knows and what it is blind to. Training runs on large clusters of accelerators for extended periods, using mixed-precision arithmetic, gradient checkpointing and distributed parallelism to keep the computation tractable.

Scaling, and the correction nobody mentions

Kaplan et al. established in 2020 that loss falls as a smooth power law in model size, dataset size and compute. [9] That result is genuinely foundational and it is also the single most commonly misquoted thing in the field, because its specific prescription was overturned two years later.

Kaplan's recommendation was to grow parameters aggressively and stop training well short of convergence. [9] Hoffmann et al. — the Chinchilla paper — found the opposite balance: models of that era were badly undertrained, and for a fixed compute budget, parameters and training tokens should scale roughly in proportion. [10] A 70-billion-parameter Chinchilla beat a 280-billion-parameter Gopher on equal compute. [10] The correction runs toward more data, not more parameters, and getting that direction backwards is the standard error.

The story does not end tidily either. A 2024 reanalysis found Chinchilla's own headline fit inconsistent with its other estimation methods, with confidence intervals so narrow they would have required “over 600,000 experiments, while they likely only ran fewer than 500”. [11] Scaling is a real and useful regularity. The exact coefficients are still contested.

One caveat on all of it: scaling laws predict loss. The jump from lower loss to specific useful capabilities is a separate, weaker, more argued-over inference.

Stage two: post-training

A freshly pretrained model is not an assistant. Ask it a question and it will happily continue with three more questions, because that is what text does. Turning it into something that answers requires a second stage.

InstructGPT established the recipe: fine-tune on human demonstrations of desired behaviour, collect human rankings of model outputs, then optimise against those preferences. [12] The result was decisive — a 1.3-billion-parameter InstructGPT was preferred to the 175-billion-parameter GPT-3 it came from, a hundred times larger. [12] A great deal of what people mean by “the model got better” since 2022 happened at this stage rather than in pretraining, though no public accounting separates the two cleanly. Direct Preference Optimization later showed the same alignment could be reached without a separate reward model. [13] Constitutional AI substitutes a written set of principles for much of the human labelling. [14]

Why this matters

Pretraining decides what the model knows. Post-training decides who it is. Any explanation that stops after stage one is describing a system nobody has shipped since 2020.

What They Can Do

Understanding
Reading at length

Summarising, extracting and answering questions over long documents — with the caveat that middle-of-context material is used least reliably. [5]

Generation
Writing and code

Prose, correspondence and working code, with tone and register controlled by instruction. The most commercially settled capability.

Reasoning
Multi-step work

Now trained in rather than prompted for — and the most actively disputed claim in the field. See below.

Multimodal
Beyond text

Images, audio and structured data handled alongside text, largely by the same next-token machinery.

Reasoning: the live argument

In 2022, chain-of-thought prompting showed that asking a model to work step by step sharply improved multi-step accuracy. [15] That framing is now a generation out of date. Reasoning is increasingly trained in directly through reinforcement learning against verifiable answers — DeepSeek-R1 demonstrated reasoning behaviour emerging from pure RL without human-written reasoning traces at all. [16]

Whether any of this constitutes reasoning is genuinely unsettled, and the argument is worth watching rather than resolving. Apple researchers reported a “complete accuracy collapse” in reasoning models beyond certain puzzle complexities. [17] A single-author preprint — unrefereed, and revised after its first version to drop an LLM co-author and correct two of its own sections — then argued the collapse largely reflected the experiment: some benchmark instances were mathematically unsolvable, and models were scored as failing for not solving them. [18] Three parties, no consensus, and uneven standing: one peer-reviewed paper, one industrial lab report, one self-corrected preprint. Anyone who tells you this question is settled is selling something.

What They Get Wrong

Hallucination is structural

Models produce fluent, confident, false statements. The usual explanation — it is trained to sound plausible — is true but unhelpfully vague. A sharper account: training and benchmark scoring reward guessing over admitting uncertainty, so calibrated abstention gets optimised away. A model that says “I don't know” scores zero; a model that guesses sometimes scores one. [19] Separately, a learning-theoretic argument holds that hallucination cannot be eliminated from LLMs at all, only reduced. [20] The two do not agree on the remedy, and the disagreement is the useful part: Kalai et al. argue the incentive is fixable by rescoring the benchmarks that reward guessing, while Xu et al. argue elimination is impossible in principle. Either way, it is a property to design around today rather than something to wait out.

Bias is measurable, not hypothetical

Models reproduce patterns in their training data, including harmful ones. This is not a theoretical worry. Leading models have been shown to propagate debunked race-based medical claims when asked clinical questions. [21] A Stanford audit found that advice varies systematically with the name in the prompt, disadvantaging names associated with racial minorities and women — consistently across 42 prompt templates and several models. [22]

The energy story has flipped

The familiar framing blames training runs, and that was right when it was written. [23] It is no longer the whole picture. The IEA's 2026 assessment finds energy per AI task falling by at least an order of magnitude annually while total demand still roughly doubles, because new workloads keep arriving: video generation, reasoning and agentic tasks “can consume hundreds or thousands of times more energy per query than simple text generation.” [24] Data centres are projected to move from 485 TWh in 2025 to around 950 TWh by 2030, roughly 3% of global electricity. [24] A 2024 US Department of Energy analysis projects US data-centre demand rising from 176 TWh in 2023 to between 325 and 580 TWh by 2028 — a different geography and horizon, pointing the same way. [25]

What is not settled is the split between the two. It is tempting to say the footprint has moved from building models to serving them, and it may well have. But the Department of Energy report says only that “the relationship between inference and training energy use continues to evolve,” and the IEA does not break the total down that way at all. [25] Anyone stating that ratio confidently is going past the public measurements.

Interpretability: partial, and improving

Saying these systems are black boxes was accurate in 2023 and is now too strong. Sparse autoencoders decompose internal activations into interpretable features, and DeepMind has released them across every layer of an open model. [26] Attribution graphs trace intermediate steps inside a working model. The honest summary is the one the researchers give themselves: the graphs yield “satisfying insight for about a quarter of the prompts we’ve tried,” and even the successful cases capture “only a small fraction of the mechanisms of the model.” [27] Some of the path is visible, most is not, and none of it is yet reliable enough to explain a particular output to a regulator.

Where It Is Actually Going

Efficiency, which is where the gains have been

Distillation and quantization remain the workhorses. Sparsity is the other lever — mixture-of-experts models activate only a fraction of their parameters for any given token — and a third line avoids attention's quadratic cost entirely. State-space models are the serious contender, motivated explicitly by that inefficiency on long sequences. [28]

Alignment as an unsolved problem

RLHF and Constitutional AI are production practice, not future work, and belong in the training section above. What remains genuinely open is harder: verifying that a system behaves as intended in situations nobody anticipated, and supervising models on tasks where humans cannot easily check the answer.

Neuro-symbolic is not a forecast

It already works. AlphaGeometry — a neuro-symbolic system pairing a language model with a symbolic deduction engine — solved 25 of 30 olympiad geometry problems, approaching the performance of an average IMO gold medallist, and it did so in 2024. [29] The open question is not whether the combination works but how far beyond formally verifiable domains it extends.

Specialists versus generalists, honestly

The intuitive claim is that a model trained on domain text beats a general one in that domain. In medicine, where the comparison has been run hardest, the evidence points the other way. Microsoft researchers found GPT-4 with careful prompting topped all nine benchmarks in the MultiMedQA suite, beating the purpose-built Med-PaLM 2 by a significant margin with an order of magnitude fewer calls. [30] That is one domain, one comparison and one vendor, so it settles less than it looks like it does. What it does suggest is that the interesting axis is not generalist-versus-specialist but how much domain adaptation — retrieval, fine-tuning, careful prompting — sits on top, and that a strong general model plus adaptation is a serious contender wherever the comparison has actually been run.

Conclusion
Simple Objective, Complicated Consequences

The whole edifice rests on predicting the next token. Everything else — the architecture that made it trainable at scale, the second stage that made it usable, the reinforcement learning that made it work step by step — is engineering built on top of that one objective, and each layer is legible if you look at it directly.

What is worth carrying away is where the uncertainty actually sits. Not in the architecture, which is well understood and openly published. It sits in whether lower loss reliably becomes capability, whether these systems reason or perform a convincing imitation, and whether we can ever explain a particular output. Those are open questions, and the field disagrees about them in print.

This article was rewritten in August 2026 after a fact-check found the earlier version carried a quotation attributed to a real paper that does not appear in it, and presented a 2020 result as current six years and two corrections later. Both are noted here rather than quietly fixed, because a page about machines that produce confident falsehoods is a poor place to be quiet about having produced one.

Sources & References

[1]
Jurafsky, D. & Martin, J. H. Speech and Language Processing, 3rd ed., ch. 3 — N-gram Language Models (draft, January 2026). stanford.edu
[2]
Bengio, Y., Ducharme, R., Vincent, P. & Jauvin, C. A Neural Probabilistic Language Model. Journal of Machine Learning Research 3, 1137–1155 (2003). jmlr.org
[3]
Hochreiter, S. & Schmidhuber, J. Long Short-Term Memory. Neural Computation 9(8), 1735–1780 (1997). doi.org/10.1162/neco.1997.9.8.1735
[4]
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L. & Polosukhin, I. Attention Is All You Need. NeurIPS 30 (2017). Source of the quotation above, of the causal-masking description, and of the path-length argument. arxiv.org/abs/1706.03762
[5]
Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F. & Liang, P. Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics 12, 157–173 (2024). aclanthology.org
[6]
Radford, A., Narasimhan, K., Salimans, T. & Sutskever, I. Improving Language Understanding by Generative Pre-Training. OpenAI (2018). Source of “decoder-only transformer with masked self-attention heads.” openai.com
[7]
Devlin, J., Chang, M.-W., Lee, K. & Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. NAACL (2019). aclanthology.org
[8]
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W. & Liu, P. J. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. JMLR 21(140) (2020). jmlr.org
[9]
Kaplan, J., McCandlish, S., Henighan, T. et al. Scaling Laws for Neural Language Models (2020). Note: a preprint, never published at a refereed venue. arxiv.org/abs/2001.08361
[10]
Hoffmann, J., Borgeaud, S., Mensch, A. et al. Training Compute-Optimal Large Language Models (2022) — the Chinchilla paper. Source of “current large language models are significantly undertrained.” arxiv.org/abs/2203.15556
[11]
Besiroglu, T., Erdil, E., Barnett, M. & You, J. Chinchilla Scaling: A replication attempt (2024). Preprint; current version v2, May 2024. Source of the “over 600,000 experiments” figure. arxiv.org/abs/2404.10102
[12]
Ouyang, L., Wu, J., Jiang, X. et al. Training Language Models to Follow Instructions with Human Feedback (2022). Source of the 1.3B-preferred-over-175B result. arxiv.org/abs/2203.02155
[13]
Rafailov, R., Sharma, A., Mitchell, E., Manning, C. D., Ermon, S. & Finn, C. Direct Preference Optimization: Your Language Model is Secretly a Reward Model. Advances in Neural Information Processing Systems 36, 53728–53741 (2023). papers.nips.cc
[14]
Bai, Y., Kadavath, S., Kundu, S. et al. Constitutional AI: Harmlessness from AI Feedback (2022). arxiv.org/abs/2212.08073
[15]
Wei, J., Wang, X., Schuurmans, D. et al. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 35, 24824–24837 (2022). proceedings.neurips.cc
[16]
Guo, D., Yang, D., Zhang, H. et al. DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning. Nature 645, 633–638 (2025). doi.org/10.1038/s41586-025-09422-z
[17]
Shojaee, P., Mirzadeh, I., Alizadeh, K., Horton, M., Bengio, S. & Farajtabar, M. The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity. Apple Machine Learning Research (2025). machinelearning.apple.com
[18]
Lawsen, A. Comment on “The Illusion of Thinking” (2025). Preprint, not refereed; current version v2, which removed an LLM co-author per arXiv policy and corrected sections 4 and 6 of v1. Source of the unsolvable-instances objection. arxiv.org/abs/2506.09250
[19]
Kalai, A. T., Nachum, O., Vempala, S. S. & Zhang, E. Why Language Models Hallucinate (2025). arxiv.org/abs/2509.04664
[20]
Xu, Z., Jain, S. & Kankanhalli, M. Hallucination is Inevitable: An Innate Limitation of Large Language Models (2024). arxiv.org/abs/2401.11817
[21]
Omiye, J. A., Lester, J. C., Spichak, S., Rotemberg, V. & Daneshjou, R. Large language models propagate race-based medicine. npj Digital Medicine 6, 195 (2023). nature.com
[22]
Salinas, A., Haim, A. & Nyarko, J. What’s in a Name? Auditing Large Language Models for Race and Gender Bias. Stanford (2024). Source of the 42-template finding. arxiv.org/abs/2402.14875
[23]
Strubell, E., Ganesh, A. & McCallum, A. Energy and Policy Considerations for Deep Learning in NLP. ACL (2019). The origin of the training-cost framing. aclanthology.org
[24]
International Energy Agency. Key Questions on Energy and AI, IEA, Paris (2026). Source of the 485→950 TWh projection and the per-query comparison. Updates the April 2025 Energy and AI report; the IEA states its central data-centre projection “remains close to the trajectory set out in the IEA’s 2025 report.” iea.org
[25]
Shehabi, A., Newkirk, A., Smith, S. J. et al. 2024 United States Data Center Energy Usage Report (2024). Lawrence Berkeley National Laboratory / US DOE, DOI 10.71468/P1WC7Q. US-only, projected to 2028. Source of “the relationship between inference and training energy use continues to evolve.” escholarship.org
[26]
Lieberum, T. et al. Gemma Scope: Open Sparse Autoencoders Everywhere All At Once on Gemma 2. Google DeepMind (2024). arxiv.org/abs/2408.05147
[27]
Lindsey, J., Gurnee, W., Ameisen, E. et al. On the Biology of a Large Language Model. Transformer Circuits Thread, Anthropic (2025). Source of the “about a quarter of the prompts” limitation, stated by the authors themselves. transformer-circuits.pub
[28]
Gu, A. & Dao, T. Mamba: Linear-Time Sequence Modeling with Selective State Spaces (2023). arxiv.org/abs/2312.00752
[29]
Trinh, T. H., Wu, Y., Le, Q. V., He, H. & Luong, T. Solving olympiad geometry without human demonstrations. Nature 625, 476–482 (2024). Correction issued 23 Feb 2024, DOI 10.1038/s41586-024-07115-7. doi.org/10.1038/s41586-023-06747-5
[30]
Nori, H., Lee, Y. T., Zhang, S. et al. Can Generalist Foundation Models Outcompete Special-Purpose Tuning? Case Study in Medicine. Microsoft (2023). arxiv.org/abs/2311.16452
S
Sheldon Valentine
Founder · Dear Tech

The first version of this article, published April 2026, was drafted with AI assistance and shipped without a fact-check. A two-pass review in August 2026 found a fabricated quotation and several claims that had been superseded, and the piece was rewritten from the sources up. Every figure and quotation above is now traced to the primary document listed beside it. AI tools assisted with drafting; the claims, the sourcing and the errors are mine.

Back to Blog