Free Preview

The Transformer Revolution

Chapter 3 of More Than Parrots, Less Than Gods

← Back to Home
3 / 3 free preview chapters
← Previous Buy the Full Book

Chapter 3. The Transformer Revolution

The Engine Under the Hood

If Chapter 1 explained what AI does and Chapter 2 explained where it came from, this chapter explains the single most important technical breakthrough that made the current era possible. It is the chapter I least wanted to write and the one you most need to understand.

I say I least wanted to write it because explaining technical architecture in plain English is a special kind of torture. The people who already understand transformers will find my explanation oversimplified. The people who do not understand them will find it abstract. My goal is to thread a needle: give you an intuitive grasp of how transformers work without requiring a mathematics degree, while being honest about what I am simplifying and why the simplification still captures the essential insight.

Here is why this matters. Every large language model you have heard of — GPT-5, Claude 4, Gemini 3, Llama 4, DeepSeek — is built on a single architectural innovation introduced in a paper published in June 2017. Before that paper, the most powerful language models could handle paragraphs. After that paper, they could handle novels. The difference was not more data or faster chips, though both helped. The difference was a new way of processing language that solved a problem researchers had been stuck on for two decades.

That innovation is called the transformer. And understanding it — even at a metaphorical level — is the key to understanding both the power and the limitations of every AI system you will encounter for the foreseeable future.


The Problem: Reading One Word at a Time

To understand why the transformer mattered, you need to understand what came before it. And what came before was a family of approaches called recurrent neural networks, or RNNs.

The word "recurrent" gives away the problem. These networks processed language sequentially, one word at a time, like a person reading a book with one eye and one finger. The network would read the first word, update its internal state, read the second word, update its internal state again, and so on through the sentence. By the time it reached the end, its internal state was supposed to contain a compressed representation of everything it had read.

This approach had a certain biological plausibility. Humans read sequentially too, more or less. But humans have something RNNs lacked: working memory, common sense, and the ability to jump back and forth. An RNN reading a long sentence had a problem that should be familiar to anyone who has walked into a room and forgotten why they went there. By the time it reached the end of a long passage, it had forgotten the beginning.

Researchers tried to fix this with variants called Long Short-Term Memory networks, or LSTMs, and later Gated Recurrent Units, or GRUs. These were clever architectural patches that gave RNNs a kind of selective memory — the ability to hold onto important information and discard trivial details. They worked better than plain RNNs. But they did not solve the fundamental problem.

That fundamental problem was this: distance dilutes meaning. In a sequential processor, the relationship between two words depends on how many words sit between them. The word "it" at the end of a sentence needs to connect back to its referent — the noun it replaces — but if that noun appeared fifty words earlier, the connection is weak. The network's internal state has been overwritten dozens of times. The signal has been lost in noise.

This meant that RNNs and LSTMs worked well for short text — a sentence, a paragraph — but struggled with anything longer. They could translate a short email but not a legal contract. They could summarize a news article but not a research paper. They could generate a coherent paragraph but not a coherent chapter. The limitation was not data or compute. It was architecture.

There was a second problem, equally crippling: RNNs could not be parallelized efficiently. Because each word depended on the processing of the previous word, you had to process them in order. You could not split the work across multiple processors and do it simultaneously. This meant that training large RNNs was agonizingly slow — months of computation on the fastest hardware available — which in turn meant that researchers could not experiment at the scale required to make real progress.

By 2016, the field was stuck. Everyone knew that language models needed to process longer contexts. Everyone knew that sequential processing was the bottleneck. And nobody had a convincing idea for how to escape it.


The Paper That Changed Everything

On June 12, 2017, a team of eight researchers at Google Brain published a paper with the almost aggressively modest title "Attention Is All You Need." The authors — Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin — were not trying to revolutionize AI. They were trying to solve a specific problem in machine translation: how to make translation models faster and more accurate by improving the way they handled relationships between words in different languages.

What they invented was the transformer architecture. And it turned out to be useful for far more than translation.

The central insight of the paper can be stated simply: instead of reading words one at a time, look at all of them at once, and decide which ones matter to each other. This is what the authors called "self-attention," and it is the mechanism that makes transformers work.

The paper was twelve pages long. It has been cited over a hundred thousand times. It is, by any measure, one of the most influential technical papers in the history of computer science. And its central idea can be understood without any mathematics at all.


The Cocktail Party Metaphor

Imagine you are at a crowded cocktail party. Dozens of conversations are happening simultaneously. You are trying to follow what the person in front of you is saying, but you are also aware — at the edge of your attention — of other conversations around you. If someone three meters away mentions your name, your attention shifts instantly. If the person in front of you says something ambiguous — "I told him about it yesterday" — you search your memory for what "it" refers to, drawing on earlier parts of the conversation. If they make a sarcastic comment, you interpret it based on tone, context, and your relationship with them.

Your brain is not processing the party as a sequence of sounds, one after another. It is processing it as a web of relationships, constantly updating which sounds matter to which other sounds based on content, context, and relevance. You are attending to the whole scene at once, not marching through it word by word.

Self-attention does something analogous. When a transformer processes a sentence, it does not read it left-to-right like an RNN. It looks at every word simultaneously and asks, for each word, which other words in the sentence are most relevant to understanding it.

Consider the sentence: "The cat sat on the mat because it was tired."

When the transformer processes the word "it," self-attention allows it to look back at every other word in the sentence and assign a relevance score to each. "Cat" gets a high score because "it" probably refers to the cat. "Mat" gets a low score because mats do not get tired. "Tired" gets a medium-high score because it explains why "it" did something. The transformer computes these relevance scores for every word in relation to every other word, creating a kind of relational map of the entire sentence.

This is why distance no longer dilutes meaning. In an RNN, the connection between "it" and "cat" weakened with every word that came between them. In a transformer, the connection is computed directly, regardless of how many words sit in between. The transformer does not need to remember that "cat" appeared earlier. It can see it.

The metaphor is not perfect. A transformer does not "understand" that cats get tired and mats do not. It computes statistical relationships between word embeddings — numerical representations of words — based on patterns learned from training data. If its training data contains enough sentences where "it" refers to a nearby noun, it learns to make that association. The mechanism is mathematical, not mental. But the effect is transformative: the model can maintain coherent relationships across thousands of words, not just dozens.


Why Context Is Everything

The reason self-attention unlocked large language models is that context is everything in language. The meaning of a word depends almost entirely on the words around it.

Consider the word "bank." It could mean the side of a river, a financial institution, a building where financial transactions occur, a supply of something, or the act of tilting an aircraft. A dictionary cannot tell you which meaning applies. Only context can. "I walked along the river bank" means one thing. "I withdrew money from the bank" means another. "The pilot had to bank sharply" means a third.

Humans resolve this ambiguity so automatically that we rarely notice it. But for a machine, it is a hard problem. The meaning of "bank" in a given sentence depends on its relationship to "river," "money," or "pilot" — relationships that may be separated by many words.

Self-attention solves this by allowing the model to draw direct connections between related words regardless of distance. When the transformer encounters "bank" near "river," the self-attention mechanism highlights "river" as highly relevant to "bank." When it encounters "bank" near "money," it highlights "money" instead. The model does not need to remember that "river" appeared earlier in the sentence. It can see the relationship directly.

This capability scales. In a short sentence, the difference between an RNN and a transformer is modest. In a paragraph, it becomes significant. In a long document — a legal brief, a scientific paper, a novel — it becomes the difference between coherence and incoherence. A transformer can maintain context across thousands of words because it is not trying to compress everything into a single evolving memory state. It is building a map of relationships across the entire text.


Parallelization: The Hidden Revolution

The cocktail party metaphor explains why self-attention produces better language understanding. But it does not explain why transformers enabled the explosion in model size that produced GPT-5 and its competitors. For that, you need to understand parallelization.

Remember the problem with RNNs: they process words sequentially. Word five cannot be processed until word four is done. This meant that training an RNN on a large dataset required feeding it text one word at a time, updating its parameters after each word, and repeating this for millions of examples. Even on the fastest hardware, training a large RNN took months.

Transformers changed this because self-attention is parallelizable. When the transformer processes a sentence, it computes the relationships between all words simultaneously. The calculation for how much "cat" relates to "it" does not depend on first calculating how "the" relates to "cat." All these relationship scores can be computed at the same time, across hundreds or thousands of processors.

This is the hidden revolution. Self-attention made language models better at understanding context. Parallelization made it feasible to train them at a scale that was previously impossible. The two together — better architecture plus faster training — meant that researchers could experiment with models that were ten times, a hundred times, a thousand times larger than anything that had come before.

And size, it turned out, produced emergent capabilities. A transformer with a million parameters could do basic text completion. A transformer with a billion parameters could write coherent paragraphs. A transformer with a hundred billion parameters could engage in sustained conversation, write code, summarize documents, and answer questions in ways that looked — to casual observers — like understanding.

Whether that appearance corresponds to anything like genuine understanding is a question we addressed in Chapter 1. What matters for this chapter is that the transformer architecture made those capabilities possible in a way that no previous approach could have.


The Architecture in Plain English

For readers who want slightly more technical detail without the equations, here is how a transformer works at a conceptual level. Feel free to skip this section if the cocktail party metaphor was enough.

A transformer has two main components: an encoder and a decoder. The encoder processes input text and converts it into a set of numerical representations. The decoder takes those representations and generates output text, one word at a time. In translation systems, the encoder processes the source language and the decoder generates the target language. In large language models like GPT, the decoder is used on its own to generate text based on a prompt.

The key operation happens inside the encoder and decoder layers. Each layer contains a self-attention mechanism followed by a feed-forward neural network. The self-attention mechanism builds the relational map I described above. The feed-forward network applies transformations to each word's representation based on what the self-attention mechanism discovered.

Transformers stack many of these layers on top of each other — typically between twelve and ninety-six layers in modern models. Early layers learn simple patterns: which words tend to appear near each other, basic grammatical relationships. Deeper layers learn more abstract patterns: semantic relationships, logical connections, stylistic conventions. By the time the representation reaches the final layer, it encodes not just the words but their meanings, their relationships, and their implications.

There is a second type of attention in the decoder, called cross-attention, which allows the decoder to look back at the encoder's representations while generating output. And there are various technical refinements — positional encodings that tell the model where words appear in a sentence, layer normalization that stabilizes training, residual connections that help information flow through deep networks — that matter enormously to engineers but are secondary to the core insight.

The core insight remains: look at everything at once, figure out what matters to what, and build a representation that captures those relationships. Everything else is implementation detail.


Why This Is Not Magic

It is tempting — and the AI industry is vigorously tempted — to treat the transformer as a kind of magic. The name itself invites mysticism. But the transformer is not magic. It is an elegant solution to a specific problem, and understanding its limits is as important as understanding its power.

The transformer solved the problem of long-range context in language processing. It did not solve the problem of reasoning. It did not solve the problem of understanding. It did not solve the problem of common sense. It built a better statistical model of how words relate to each other across distance. That is genuinely impressive. It is also genuinely limited.

The transformer's power comes from the patterns it learns from training data. It has no model of the physical world. It has never touched a cat or sat on a mat. When it generates the sentence "The cat sat on the mat," it is not describing an experience. It is predicting which words are statistically likely to follow each other, based on patterns in the trillions of words it has seen.

This matters because the transformer's impressive fluency can mask its profound ignorance. It can write a coherent essay about quantum mechanics without understanding physics. It can generate legal analysis without understanding law. It can produce medical advice without understanding medicine. The coherence is real — the sentences flow, the grammar is correct, the terminology is appropriate — but the understanding is not.

The industry sometimes describes large transformer models as "foundation models" — the implication being that they provide a foundation upon which understanding can be built. This is partly true. These models encode vast amounts of statistical knowledge about language and, indirectly, about the world described in language. They can be fine-tuned for specific tasks, combined with other systems, and prompted in sophisticated ways. But the foundation is statistical, not semantic. It is pattern, not knowledge.


The Weekly Evolution Problem

I want to flag something that will become a recurring theme in this book. The transformer architecture, introduced in 2017, is now nearly a decade old. In AI research terms, that is an eternity. Dozens of modifications, improvements, and alternatives have been proposed since then.

There are "mixture of experts" models that use multiple specialized sub-networks instead of a single massive network. There are "state space models" that claim to handle even longer contexts more efficiently. There are architectures designed specifically for multimodal processing — text, images, audio, and video together. There are compression techniques that allow large models to run on smaller devices. There are alignment methods — RLHF, DPO, and others — that shape model behavior after training.

Some of these innovations will prove lasting. Others will be forgotten. By the time you read this book, the state of the art will have shifted in ways I cannot predict. What will not have shifted is the core insight of the transformer: that parallel, relationship-aware processing of language produces capabilities that sequential processing cannot match. Whatever replaces the transformer will need to preserve that insight or surpass it.

This is the paradox of writing about AI in 2026. The specific technologies change weekly. The underlying principles change slowly. My goal in this book is to give you principles that will outlast the technologies, while being honest about which details are likely to age quickly.


Key Takeaway

The transformer is not magic. It is an elegant solution to a specific problem — the problem of maintaining relationships between distant words in a text — and that elegant solution unlocked a scale of language modeling that was previously impossible. Self-attention allows a model to look at every word simultaneously and build a map of what matters to what. Parallelization allows that process to happen fast enough to train models with billions of parameters on trillions of words.

But the transformer does not think. It does not understand. It builds statistical maps of word relationships. The coherence of its output is real, but it is statistical coherence, not genuine comprehension. Knowing the difference — between statistical pattern and real understanding — is the key to using these systems wisely and to avoiding the trap of trusting them in situations where their statistical brilliance becomes statistical failure.


Want the Rest?

This was Chapter 3 of 19. Get the complete book — ebook, paperback, or hardcover.

Buy the Book