The Payoff
You have covered a lot of ground to get here. You know what an agent is, how search and reasoning work, what decision trees are and how they learn, the three categories of machine learning, how neural networks are structured and trained, and how unsupervised pretraining produces rich internal representations of data from unlabeled text. All of that was preparation for this topic.
ChatGPT launched in November 2022 and reached 100 million users faster than any consumer product in history. Claude, Gemini, Llama, Mistral, and dozens of other large language models followed. These systems are the most publicly visible AI technology ever created, and they are already present in your students' lives in ways that range from helpful to concerning to deeply misunderstood.
This reading explains what these systems actually are — not at the level of marketing language, but at the level of mechanism. By the end, you will be able to give an accurate technical answer to the question your students are definitely asking: "How does it actually work?"
A Very Large Neural Network
A large language model is, at its core, a neural network of the type introduced in Topic 6e: layers of neurons, each computing a weighted sum of inputs and passing results forward. What distinguishes an LLM from the networks we have studied is scale and architecture.
Scale: GPT-4 has an estimated 1 trillion parameters (weights). Claude's parameter count is not publicly disclosed, but modern frontier models are in the hundreds of billions to trillions of parameters. These networks were trained on text corpora of hundreds of billions to trillions of words — essentially a significant fraction of all text available on the internet, plus books, code, scientific papers, and other sources. Training a single large model consumes more electricity than a small town uses in a year.
Architecture: LLMs are built on a specific neural network architecture called the transformer, introduced by Google researchers in a 2017 paper titled "Attention Is All You Need." Transformers replaced earlier architectures for language tasks because they could process entire sequences of text simultaneously (rather than one word at a time) and because of a mechanism called attention.
Attention: The Key Mechanism
Earlier neural network approaches to language processed text sequentially, word by word. The problem with this is that language has long-range dependencies: the meaning of a word at the end of a sentence often depends on a word at the beginning. By the time a sequential network reaches the end, information from the beginning has been compressed through many processing steps and is hard to access.
The attention mechanism solves this by allowing every word in a sequence to directly consider every other word when computing its representation. When processing the word "it" in the sentence "The trophy didn't fit in the suitcase because it was too big," attention allows the model to look back across the entire sentence and figure out that "it" refers to "the trophy" rather than "the suitcase" — because the trophy is the thing that was too big to fit.
More precisely, the attention mechanism computes a relevance score between every pair of words in the sequence and uses those scores to create a weighted representation of each word that incorporates context from all other relevant words. Words that are highly relevant to the current word get high attention weights; irrelevant words get low weights.
When processing "it" — which words does the model attend to?
Bar height represents attention weight. "trophy" receives high attention because it is the referent of "it." "suitcase" receives moderate attention as the competing candidate.
This ability to attend to any part of the input regardless of distance is what allows transformers to handle long-range dependencies in language — and why they dramatically outperformed earlier approaches on language tasks.
Pretraining: Learning From Everything
As covered in Topic 7b, LLMs are pretrained using next-word prediction on massive text corpora. Every sentence in the training data generates dozens of training examples: given the first word, predict the second; given the first two words, predict the third; and so on. Across hundreds of billions of words, this produces an enormous number of training signals.
What does the model learn from this process? It learns to predict text accurately. But to predict text accurately across the full diversity of topics in the training corpus, the model must internalize an enormous amount of structure: grammar and syntax, word meanings and relationships, factual knowledge about the world, reasoning patterns, writing styles, conversational conventions, and much more.
None of this was explicitly taught. No one labeled sentences with their grammatical structure or annotated facts as true or false. The model acquired all of this structure because it was useful for predicting the next word. A model that knows that Paris is the capital of France will predict "Paris" as the completion of "The capital of France is ___" more accurately than one that does not. The knowledge emerges as a byproduct of the prediction task.
What Pretraining Produces
After pretraining, an LLM is a very large, very capable next-word predictor. Its billions of weights encode a compressed statistical model of language and the world as represented in its training data. Given any prompt, it computes a probability distribution over all possible next words and samples from that distribution to generate a response.
This is genuinely remarkable — and genuinely limited. The model does not know what it knows. It has no memory of individual training examples. It has no world model in the sense of a structured representation of facts and their relationships. It has statistical patterns — extraordinarily rich ones, captured in billions of weights, but patterns nonetheless.
A pretrained LLM is not a database you can query. It is not a reasoning engine that derives conclusions from premises. It is a learned distribution over language, shaped by everything it has read — and whatever it generates is the output of sampling from that distribution. Whether what it generates is true is a separate question that the model has no reliable way to answer about itself.
That last sentence is important and worth sitting with before you read further. In Reading 2, we look at how raw pretrained models are transformed into the useful assistants that end users actually interact with — and what that transformation does and does not fix.