Tags
A brain drawn from blue-to-purple circuit-board lines with LLM in a speech bubble at its centre, on a white card

How a chain of failures produced the LLM (part 1) — from the limits of maths to the geometry of meaning

The LLM as a by-product of unrelated problems: Turing on computability, Shannon on information, the perceptron, backpropagation, GPUs, and Word2Vec.

On this page

Introduction

Large language models (LLMs) like ChatGPT and Claude were not born from the goal “let us build an LLM”.

Someone trying to prove the limits of mathematics, someone trying to reduce noise on a telephone line, someone trying to fix accuracy bugs in machine translation: each solved a completely different problem, and the by-products piled up over 80 years and became the LLM.

This article follows, in order, how those unintended connections fit together. No ML or maths background is assumed.

The trigger was a Fireship YouTube video. Its compact summary of LLM history prompted me to dig deeper into “what problem each invention was actually trying to solve”, and I decided to write this.

In part 1 (this article) I cover the birth of the concept of a computer, information theory, training neural networks, and the technique of turning words into numbers. In part 2 I follow the birth of attention for handling context, Transformers, GPT-3’s scaling revolution, and the present era of alignment and efficiency.

1. What does it mean to “compute”? — Alan Turing (1936)

The problem being solved

In 1930s mathematics there was a dream:

“Every mathematical proposition should be decidable as ‘true or false’ by an algorithm.”

This was called the decision problem (Entscheidungsproblem), posed by the mathematical giant Hilbert. In short, “can mathematics be fully mechanised?”

The British mathematician Alan Turing set out to prove whether this was true.

Turing’s translation: from a maths question to a program question

Turing’s brilliant move was to translate the question into another question.

If an “algorithm that decides mathematical propositions” existed, it would have to work like this:

Keep searching for a proof → halt if a proof is found → loop forever if none is found

So “can mathematics be mechanised?” becomes the same as “can we decide whether a program halts or loops?

Therefore, if you could prove the halting problem is unsolvable, you could prove that mechanising mathematics is impossible too. That is what Turing aimed at.

The “halting problem”: the contradiction that self-reference produces

“For any program, can we build a universal program (a decider H) that decides before running whether it halts or loops?”

The answer is No, and the way to see it is to assume the opposite. Suppose H does exist. It takes two things, a program and that program’s input, and it always answers correctly:

H(P, I) → "halts" or "loops"
Suppose a perfect decider H existsThe assumption the proof starts from. A decider H takes two things, a program P and input data I, and answers whether running P on input I halts or loops forever. It is assumed to answer for every program and every input, and to be never wrong.Suppose a perfect decider H existsProgram PInput data IDoes running P on input Ihalt, or loop forever?it halts ✓it loops forever ↻Assumed: H answers for every program and every input, and is never wrong
Everything below this point sits inside that “suppose”.

The shape of what goes wrong is already familiar from the liar’s paradox:

“This statement is false.” → If true, it is false. If false, it is true. Either way, a contradiction.

Turing built the same trap out of H. If H exists then so does a contrarian program D, because D is only four lines wrapped around it:

D(X):
if H(X, X) == "halts": loop forever
else: halt

D asks H what program X does when X is given itself as input, and then does the opposite.

If H exists, so does D — it is four lines wrapped around HContrarian program D shown as a thin shell around decider H. D takes a program X, asks H what X does when run on X itself, and then inverts the answer: if H says it halts, D loops forever; if H says it loops, D halts. D adds nothing clever, it only reads H’s verdict and does the other thing. Because D is only four lines wrapped around H, assuming that H exists is the same as assuming that D exists.If H exists, so does D — it is four lines wrapped around HProgram D, given XHasks H about X, run on XH: “it halts”H: “it loops”invertinvertso D loops foreverso D haltsD adds nothing clever. It only reads H’s verdict and does the other thing.
D is not a clever program. It is a wrapper whose only job is to disagree.

Now run D with D itself as its input. Its first act is to compute H(D, D), and H has to answer, because H answers for everything:

Run D with D itself as its inputRunning D with D itself as its input, so its first act is to compute H on D and D, and H has to answer. Two rows follow. If H says it halts, D takes the loop branch and loops forever, so H’s answer was wrong. If H says it loops, D takes the halt branch and halts, so H’s answer was wrong. Both rows end in the same place and there is no third row, so H is wrong either way. H was supposed to be correct about every program, and D is one it gets wrong.Run D with D itself as its inputD’s first act is to compute H(D, D), and H has to answerH says “it halts”D takes the loop branchD loops foreverH’s answer was wrongH says “it loops”D takes the halt branchD haltsH’s answer was wrongThere is no third row. H is wrong either way.H was supposed to be correct about every program, and D is one it gets wrong.
The trap is not H’s answer but the fact that D gets to hear it.

There is no third row. H’s answer is a prediction about what D does, and D reads that prediction and does the other thing. What gets falsified is not D’s behaviour but H’s verdict.

That is enough to finish it. H was supposed to be correct about every program, and D is a program it is wrong about, so H is not a correct decider. D is nothing exotic either: if H can be written at all, so can D. Decider H cannot exist in principle.

So the dream of “fully mechanising mathematics” was proven impossible.

The unintended by-product: the concept of a computer that “does everything with one machine”

What matters is not the proof’s conclusion but what the proof required.

To “prove the halting problem”, Turing first had to rigorously define “what it means to compute”. For that the Turing machine was born: an abstract model of a machine that reads and writes symbols on a tape and changes state according to rules.

Turing then noticed a decisive property of this machine. A program is itself data.

What does that mean? You can write “input data” on a Turing machine’s tape. But you can also write “the procedure for how it operates (the program)” on the same tape. So the procedure is a kind of data too. And that means you can build a universal machine that takes any program’s description as input and executes it.

This is the Universal Turing Machine (UTM).

Why this idea was revolutionary is clear compared with the world before it:

What the Universal Turing Machine replacedBefore the Universal Turing Machine, each computing task needed its own dedicated machine: task A required machine A, task B required machine B, task C required machine C. After it, any task runs on the same single machine, with only the program given to it as input changing. This is what a laptop is: the browser, games and LLM inference all run on hardware that never changes, and only the data that is the program changes.What the Universal Turing Machine replacedBefore the UTMTask AMachine ATask BMachine BTask CMachine CAfter the UTMAny taskThe same single machine+ a different program (input)This is your laptop. Browser, games, LLM inference: the hardware never changes.
The machine stopped being the thing you build per problem.

This is your laptop. The browser, games, LLM inference: the hardware does not change. Only the “data” that is the program changes.

John von Neumann read Turing’s paper and, in the 1940s, translated this concept into an actual computer design (the von Neumann architecture). Store the program in the same memory as the data: every computer today follows this design.

Because this design became the industry standard, something decisive happened. Any algorithm expressible on this common architecture runs on any compatible hardware. Anyone can write a program and run it on compatible machines worldwide. Without owning a dedicated machine, you can take part with only the idea of an algorithm. This is the foundation of the software industry, and the reason LLM training code runs on GPU clusters worldwide.

An algorithm written once and run anywhere: a program passes through the common contract of instruction set, operating system and runtime libraries, then runs unchanged on a laptop CPU, a workstation GPU, a data-centre GPU cluster or cloud GPUs, so developers can use machines they do not own

But the 1936 proof settled one more thing. The “limit of computability” Turing himself drew applies to LLMs too. Neither ChatGPT nor Claude can, in principle, solve the halting problem, meaning it is impossible to fully guarantee whether an arbitrary program is correct. The same paper that gave birth to the computer also defined a permanent ceiling for every AI that runs on it.

Trying to prove the limits of mathematics gave birth to the concept of a computer that does everything with one machine.

Aside: 14 years later, in 1950, Turing posed the question “can machines think?” and proposed the Turing test, which checks whether a human and a machine can be told apart. It is the conceptual ancestor of the conversational tests used to evaluate LLM capability. The highest honour in computer science is called the Turing Award (ACM Turing Award), prestigious enough to be called “the Nobel Prize of computer science”. As covered later, the pioneers of deep learning also received it.

2. Can “information” be measured mathematically? — Claude Shannon (1948)

The problem being solved

In the 1940s, Claude Shannon, a researcher at Bell Labs, had a practical worry.

“Over a noise-filled telephone line, how accurately can information be sent?”

A telephone-engineering problem, unrelated to AI or machine learning.

Why “what is information” had to be defined

Telephone engineers of the day dealt with noise intuitively: amplify the signal, improve cable quality, repeat the message. But they could not answer one fundamental question.

“On this noise-filled line, how accurately can information be sent in theory? Where is the limit?”

The reason they could not answer is simple. They could not mathematically define what the noise was breaking.

Consider it. Noise breaks the signal. So “what” part of the signal is a problem when broken?

For example, if the message “THE CAT SAT ON THE MAT” is partly garbled by noise:

  • The “C” in “CAT” is lost → meaning breaks. Fatal.
  • “THE” becomes “TH_” → the reader can restore it. No problem.
  • The second “THE” is lost → the reader already predicts it. Information loss is small.

Here is an important discovery. Not every part of a message carries equal information. Easily predictable parts carry little information; hard-to-predict parts carry much. Noise truly does harm when it breaks the high-information parts.

So to fight noise, you first need to know “what to protect”. To know what to protect, you need to define “what information is”.

Defining “amount of information”

Shannon’s answer: “Information is the reduction of uncertainty. The more something unpredictable happens, the more information it carries.”

“The sun will rise in the east tomorrow too”. Everyone knows it, and the information content is nearly zero. “It snows in Tokyo in midsummer”. Unexpected, and the information content is large.

The formula for this intuition is information entropy. It “computes the overall unpredictability from how likely each event is (its probability)”, giving a larger value the harder it is to predict.

Information as the reduction of uncertainty: a near-certain event carries almost no information while a highly unexpected one carries a lot, and the entropy formula turns that intuition into bits, worked through a four-outcome variable at 0.24, 1.57 and 2.00 bits as the outcomes even out

The unit of information

Incidentally, the word “bit” also appears in this era, but Shannon did not invent it himself. The concept of binary 0 and 1 goes back to Leibniz (1703), and the word “bit” was coined by his colleague John Tukey and popularised by Shannon in his paper. Shannon’s essential invention was not “0 or 1” but the mathematics of quantifying information itself.

Aside: Anthropic’s AI assistant “Claude” is widely said to be named after Claude Shannon. An AI bearing the name of Shannon, who created information theory, is a rather suggestive choice.

The engineering that Shannon’s answer unleashed

By defining information, everything became quantifiable:

  1. You can measure a message: compute how many bits of information it contains
  2. You can measure a channel: compute how many bits per second the line can carry reliably (channel capacity)
  3. You can design redundancy: compute how many bits to add for error correction

And the most important result is the noisy-channel coding theorem: as long as the information rate stays below the channel capacity, no matter how much noise there is, with appropriate coding you can communicate with effectively no errors.

Before Shannon, engineers thought degraded quality was unavoidable on a noisy line. Shannon proved otherwise. Noise sets a limit, but below that limit perfect reliability is achievable, given the right coding.

The connection to compression: low-information parts can be discarded

Shannon’s definition of information produced another revolution: data compression.

By the source coding theorem, the theoretical minimum size to which a message can be compressed equals its entropy (information content). That is:

  • “AAAAAAAAAA”: completely predictable, entropy near zero → compressible to nearly zero
  • Random noise: completely unpredictable, maximum entropy → not compressible
  • Natural language: in between, many patterns → highly compressible

JPEG, MP3 and ZIP files are all this principle. Remove the easily predicted (low-information) parts and keep the hard-to-predict (high-information) parts. On decompression, restore the parts predictable from context.

An LLM’s tokenizer (BPE, or Byte Pair Encoding) is compression in this sense too. Frequent sequences (“the”, “ing”, “tion”) become a single token, and rare sequences stay character-by-character. The tokenizer is literally a Shannon-optimal encoder for natural language.

A BPE tokenizer as Shannon-optimal compression: frequent sequences such as “the”, “ing” and “tion” collapse to single tokens with short codes of about four to six bits, while rare sequences stay character by character and cost twenty bits or more, because an optimal encoder gives each symbol a code length of minus log two of its probability

The connection to LLMs: from training to inference

Training: cross-entropy loss

The core question when training an LLM is “how accurately can the model predict the next word?”

The metric used to measure this “accuracy of prediction” is cross-entropy loss, derived directly from Shannon’s entropy.

loss = -(sum of correct-answer probability × log(model's predicted probability))

When an LLM learns, the model relentlessly tries to make this number smaller. In other words, reducing the “surprise” at the next token is the entire purpose of training. Shannon’s “information = reduction of uncertainty” is directly the learning objective.

Inference: temperature is the entropy knob

Shannon’s notion of “surprise” also connects directly to controlling LLM output. The temperature parameter is a knob that directly manipulates the entropy of the output distribution.

P(token) = softmax(logit / temperature)
Temperature Effect on the distribution Shannon entropy
→ 0 Concentrates on the highest-probability token Entropy → 0 (zero surprise)
= 1 The model’s natural distribution Natural entropy
> 1 Distribution flattens, all tokens more equal Entropy rises (surprise increases)

Low temperature = always pick the most predictable (low-information) token. High temperature = sample from a higher-entropy distribution = creative but possibly less consistent.

When you raise the temperature to “write more creatively”, you are literally raising the Shannon entropy of the output.

The whole connection

One definition, carried through to inferenceA single definition carried through five stages. Shannon in 1948 defines information as surprise, measured as entropy. Compression removes the low-entropy, predictable parts and keeps the high-entropy ones. The tokenizer applies the same principle, with BPE optimally encoding language. The training loss is cross-entropy, which measures the model’s surprise at the correct token. And temperature controls the entropy of the output distribution at inference time. Each stage is the same idea applied at a different point.One definition, carried through to inferenceShannon (1948)defines information = surprise = entropyCompressionremoves low-entropy (predictable) parts, keeps high-entropyTokenizerBPE optimally encodes language by the same principleTraining losscross-entropy = the model’s “surprise” at the correct tokenTemperaturecontrols the entropy of the output distribution at inference
Nobody re-derived this four times. It is one definition, still load-bearing.

One mathematical framework applies to every layer of building and running an LLM. Shannon’s mathematics, which wanted to reduce telephone-line noise, has become 80 years later both the LLM’s “definition of smartness” and its “creativity adjustment knob”.

3. Can machines learn? — optimism, setback, revival

The age of optimism: the perceptron (1958)

The first demonstration that “a machine can learn” was Frank Rosenblatt’s perceptron.

The mechanism is simple. The simplest neural network is a circuit of just one “neuron”.

The perceptron: the simplest possible neural networkA perceptron drawn as a circuit. Three inputs, x1, x2 and x3, each travel along a connection carrying its own weight, w1, w2 and w3. The weighted inputs are summed together with a bias, that sum is compared against a threshold, and the result is a single binary output of 0 or 1. The weights are what learning changes; nothing else in the circuit moves.The perceptron: the simplest possible neural networkinputsweightssumoutputx1w1x2w2x3w3Σ(xi·wi) + biasthreshold0 or 1The weights are what learning changes. Nothing else in the circuit moves.
One neuron, and the only adjustable part is the weights on the wires.
  1. Take several inputs (numbers)
  2. Multiply each by a “weight” and add them
  3. If the sum exceeds a threshold, output “Yes (1)”; otherwise “No (0)”

Look at a concrete example. A perceptron that decides “is this email spam?”:

inputs:
x1 = contains "free prize"? (1 or 0)
x2 = from a known contact? (1 or 0)
x3 = has an attachment? (1 or 0)
learned weights:
w1 = +0.9 (strong spam signal)
w2 = -0.8 (strong non-spam signal)
w3 = +0.3 (weak spam signal)
score = (1)(0.9) + (0)(-0.8) + (1)(0.3) = 1.2
threshold = 0.5
1.2 > 0.5 → "spam"

“Learning” is adjusting these weights. Start with random weights, check against the answers, and correct the weights little by little. Repeat thousands of times and the weights converge to appropriate values.

Before the perceptron, every program ran on rules handwritten by humans. The perceptron demonstrated the revolutionary concept that a machine finds its own rules from data.

The New York Times reported: “the Navy revealed the embryo of a machine that can walk, talk, see, write, and reproduce itself”. An air of optimism prevailed.

Setback: the first AI winter (1969)

Marvin Minsky and Seymour Papert threw cold water on it.

The perceptron has a mathematical limit.

A question may arise here. “As Turing proved in 1936, a universal Turing machine can perform any computation. Why would something like XOR be a problem?”

The answer is that Turing’s universality and the perceptron’s learning are completely different abilities.

  • Turing’s universality: if a human writes the right program, any computation is possible. XOR? A single if line.
  • The perceptron’s promise: the machine discovers the rules itself from data. Humans do not write the rules.

What XOR destroyed was not “computational power” but the “learning mechanism” itself.

Look concretely. XOR (exclusive OR) is the simple rule “0 if both inputs are 1 or both are 0, and 1 if only one is 1”. Plotted on a 2D plane:

XOR (exclusive or) cannot be separated by one straight lineA truth table beside a two-dimensional plot. The table gives XOR: 0 and 0 produce 0, 0 and 1 produce 1, 1 and 0 produce 1, 1 and 1 produce 0. On the plot the two points that output 1 sit at opposite corners, and so do the two that output 0, so any straight line drawn through the square leaves one point on the wrong side. This is the limit of a single perceptron.XOR (exclusive or) cannot be separated by one straight lineTruth tablePlotted in two dimensionsx1x2Output000011101110x1x20101NoYesYesNoNo straight line separates Yes from No. This is the limit of a perceptron.
No straight line splits Yes from No. That is what killed the single perceptron.

The perceptron tries to separate Yes and No with a single straight line. But look at the figure above: separating ● and ○ with one straight line is impossible. However you draw the line, they always mix.

If that were all, “so XOR is a special case” might suffice. But what Minsky and Papert proved was not just about XOR. They showed that an entire class of problems requiring non-linear decision boundaries was impossible for the perceptron: parity (odd/even), symmetry detection, connectivity, and more. XOR is only the simplest, most embarrassing counterexample.

And the reason this was devastating is the gap between expectation and reality. The media reported “a machine that walks and talks”. Mathematicians proved that machine cannot even learn XOR. The funders’ conclusion: “neural networks = a dead end”. This triggered the first AI winter. Research funding froze and many neural-network researchers lost their jobs.

But their book carried one line of note:

“A multi-layer network might solve this problem. But how to train it is unknown.”

This “but” defined the research question for the next 17 years.

Revival: backpropagation (1986)

The “but” was solved by backpropagation (error back-propagation) from Rumelhart, Hinton, and Williams.

A multi-layer network is several perceptrons connected together. Each perceptron has its own weights, grouped into layers.

The structure of a multilayer neural networkThree layers of nodes. Three input nodes on the left, two hidden nodes in the middle, two output nodes on the right, each layer fully connected to the next. The input and output layers are visible from outside; the middle layer is not, which is why it is called hidden. Every connection carries its own weight, and training adjusts those weights.The structure of a multilayer neural networkInput layer(Layer 1)Hidden layer(Layer 2)Output layer(Layer 3)w1w2w5w6ABCDEFGvisiblenot visible (hidden)visibleEvery connection carries its own weight (w). Training adjusts them, and the pattern is what gets learned.
The middle layer is hidden because nothing outside the network sees it.

In this figure the middle Layer 2 is called the hidden layer. “Hidden” does not mean it hides anything. The input layer is where the user hands over data, the output layer is where the user receives the result. Both are “visible” to the user. The middle layer, by contrast, is an internal workspace the user never touches directly. It is “hidden” because it is invisible from outside.

Why “deep” learning?

When layers increase, it is these hidden layers that increase. There is always one input layer and one output layer. How many hidden layers you stack between them is “the depth of the network”, and that is the meaning of “deep” in “deep learning”. This “hidden” concept reappears in chapter 5, so keep it in mind.

The learning flow is intuitive:

  1. Initialise all weights to random values (if not random, every neuron learns the same thing)
  2. Feed in data and produce a prediction through all layers (“this image is a cat”)
  3. Check against the answer and compute how wrong it was
  4. Trace, backwards from output to input, “which weights contributed to this error”
  5. Adjust each weight slightly by its contribution (weights are overwritten; no snapshot remains)
  6. Repeat this millions of times

How is “which weight contributed how much to the error” computed?

Only the final output knows the correct answer. Nobody knows what the intermediate layers “should correctly output”. There is no correct answer for “Layer 1’s correct edge-detection result for a cat image”.

So the error signal is propagated backwards from the output. Using the chain rule of calculus, each layer’s responsibility is computed in turn: if A affects B and B affects C, then A’s effect on C is the product of the two effects.

Backpropagation: one error, split into each layer’s shareBackpropagation shown as two passes over the same three layers. In the forward pass, left to right, an input goes through Layer 1, Layer 2 and Layer 3 to an output, which is compared with the correct answer and comes out wrong. That comparison is the only scoring point, because nobody knows what a middle layer should have output. In the backward pass, right to left, the error is divided into each layer’s share of the blame: Layer 3 is 40 per cent responsible, Layer 2 is 35 per cent, and Layer 1 is 25 per cent, three shares of one error summing to 100 per cent. Each layer then adjusts its weights by its share. The split is computed with the chain rule: if A affects B and B affects C, then A’s effect on C is the product of the two effects.Backpropagation: one error, split into each layer’s shareForward pass (left → right)InputLayer 1Layer 2Layer 3Output vs correct answer↑ the only scoring point — nobody knows what a middle layer should have outputBackward pass (right → left)“wrong!”Three shares of one error: 40 + 35 + 25 = 100%Chain rule: if A affects B and B affects C, A’s effect on C is the product of the two
Nobody knows what Layer 2 should have said, so the only place with a correct answer has to send word backwards.

The error propagates backwards. Hence backpropagation.

It was shown that multi-layer networks can be trained this way, solving the problem Minsky and colleagues called “unknown”.

Why does going multi-layer solve it? The core is the difference between linear and non-linear. A perceptron (single layer) can draw only one straight line. That is the limit of linear. In a multi-layer network, each layer draws its own straight line, and combining them makes curved and complex decision boundaries. That is non-linear.

The more layers, the more complex the boundaryThree plots of the same set of points, in which one class forms a cluster in the middle and the other surrounds it. In the first, a single layer can draw only one straight line, which cuts through the middle and leaves points of both classes on the wrong side. In the second, a few layers combine several straight lines into a triangle around the central cluster, which is much closer but still crude at the corners. In the third, a deeper network combines enough lines that the boundary becomes a smooth closed curve following the shape of the cluster exactly. No individual layer ever draws a curve; a curve is what enough straight cuts look like from far away.The more layers, the more complex the boundaryOne layer: one straight linepoints left on the wrong sideA few layers: lines combinedcloser, corners still crudeDeeper: many lines combineda boundary that follows the shapeNo layer ever draws a curve. A curve is what enough straight cuts look like from far away.
Same points in all three. Only the number of straight cuts available changes.

The more layers, the more complex the decision boundary. This is the foundation of deep learning.

But there was a large wall between theory and practice. Training multi-layer networks needs enormous computation, and 1980s–90s hardware could not run training at practical speed.

Breaking the speed wall: the arrival of GPUs (2012)

Even with backpropagation established, multi-layer networks stayed far from practical for a while. Not enough data. Computation too slow.

In 2012, the situation changed at ImageNet (a contest to classify over a million images into 1,000 categories). A model called AlexNet posted an overwhelming result. Against the second-place error rate of 26.2%, AlexNet scored 15.3%, a gap of about 11 points. In machine learning a 1–2 point year-on-year improvement is normal, so 11 points was an understatement even called “crushing”. Many computer-vision researchers switched to deep learning en masse the next year, and the industry’s common sense was rewritten.

What AlexNet used was the GPU (graphics chip). Why was the GPU so effective? Training until then was done on CPUs, but CPUs and GPUs differ fundamentally in design philosophy.

A CPU has a few high-performance cores (4–16) and is designed to handle complex tasks sequentially. A GPU has thousands of simple cores (over 4,000) and is designed to run many simple computations simultaneously.

Training a neural network is, for the most part, matrix multiplication: the simple repetition of multiplying thousands of weights by thousands of inputs and summing. And each multiplication is independent; the result of w3×x3 need not wait for the result of w1×x1.

ImageNet 2012: the same maths, run all at onceAt ImageNet 2012 the runner-up scored a 26.2 per cent error rate and AlexNet scored 15.3 per cent, a gap of about 11 points in a field where 1 to 2 points a year was normal. Both figures are from the same 2012 contest. The reason is the difference between a CPU and a GPU. A CPU has a few fast cores working in sequence, like four expert mathematicians solving hard problems in turn: it computes w1 times x1, finishes, then w2 times x2, and so on up to w1000 times x1000, taking a thousand steps. A GPU has thousands of simple cores working at once, like four thousand primary-school children doing additions simultaneously: it computes all thousand products in a single step. This works because each product is independent, so w3 times x3 never has to wait for w1 times x1. Training that would take weeks to months on a CPU finished in days on a GPU.ImageNet 2012: the same maths, run all at onceImageNet 2012 error rateRunner-up: 26.2%AlexNet: 15.3%about 11 points, where 1–2 a year was normalCPU — a few fast cores, in sequence4 expert mathematicians solving hard problems in turnw1×x1 → done → w2×x2 → done → … → w1000×x1000total: 1000 stepsGPU — thousands of simple cores, at once4,000 primary-school children doing additions all at oncew1×x1, w2×x2, w3×x3, … w1000×x1000total: 1 stepEach product is independent: w3×x3 never waits for w1×x1. Weeks to months on a CPU, days on a GPU.
Nothing about the maths changed. Only how many of it could happen at the same moment.

Training AlexNet would have taken weeks to months on a CPU but finished in days on a GPU. Same maths, same result, just massively parallelised. The GPU broke the training-speed wall and proved that the combination “GPU + large data + multi-layer network” works at a practical level.

But AlexNet was an 8-layer network. “Deeper (more layers) should be smarter”, but trying to deepen the layers raises another wall.

Aside: one of AlexNet’s authors, Geoffrey Hinton, is also named on the 1986 backpropagation paper. Across the AI winter, the same person led deep learning’s revival 26 years later. Hinton received the Turing Award in 2018 alongside Yann LeCun and Yoshua Bengio, and the three together are called “the fathers of deep learning”.

Aside: NVIDIA, which made the GPUs, was originally a gaming-graphics company. 3D rendering in games is also “running the same computation in parallel over a huge number of pixels”, which is structurally the same as a neural network’s matrix operations. The AI boom made NVIDIA one of the most valuable companies in the world. A gaming chip becoming the optimal tool for AI training is another of the “unintended connections” this article has followed.

Deeper still: overcoming vanishing gradients (2010s)

Even after GPUs solved the speed problem, deepening the network itself had another wall: the vanishing gradient problem.

As seen with backpropagation, the only scoring point is the final output. The error signal can only travel backwards up the layers. And each time it passes a layer, the signal shrinks by multiplication. Each multiplication’s coefficient is typically below 1 (e.g. 0.3), so repeatedly multiplying small numbers rapidly approaches zero.

3 layers: 0.3 × 0.3 × 0.3 = 0.027 ← small but usable
10 layers: 0.3^10 ≈ 0.000006 ← nearly zero
50 layers: 0.3^50 ≈ 0.00000000000000000000000... ← effectively zero

The closer to the final layer, the stronger the feedback; the earlier the layer, the more the feedback vanishes:

Why the earliest layers stop learningThe vanishing gradient problem. An error signal enters at the output, the only place that knows the correct answer, and is multiplied by a coefficient of about 0.3 at every layer it crosses on the way back. What each layer actually hears therefore differs enormously. Layer 50, close to the output, hears that it is 30 per cent wrong and can learn from that. Layer 25 hears that it is 0.000001 per cent wrong and barely learns. Layer 1 hears a figure indistinguishable from zero and cannot move at all. Layer 1 is where the basic features live, so the foundation is broken and unreachable, and nothing stacked on top of it means anything.Why the earliest layers stop learningThe error enters at the output and is multiplied by ×0.3 at every layer it crossesLayer 1Layer 25Layer 50Outputerror!×0.3×0.3What each layer actually hearsLayer 50“you are 30% wrong, adjust”can learnLayer 25“you are 0.000001% wrong”barely learnsLayer 1“you are 0.0000000000% wrong”cannot move at allLayer 1 is where the basic features live. The foundation is broken and unreachable, so nothing stacked on it means anything.
Same error, same instruction. What differs is how much of it is left by the time each layer hears it.

This is like a building’s foundation being broken but unfixable. Layer 1 should learn basic features (edges, simple patterns), but feedback does not reach it, so it cannot learn. With the foundation left nonsense, nothing stacked on top means anything.

This wall was overcome in stages by a combination of techniques.

Why the signal was shrinking “×0.3”: the sigmoid activation function

I said each layer’s multiplication coefficient is below 1, like “0.3”. Where does this coefficient come from? The answer is the activation function, the function by which each neuron transforms its output.

Long in use was the sigmoid. The sigmoid was designed to mimic biological neurons. Real neurons are not simple on/off; they activate smoothly according to stimulus strength. The sigmoid is a smooth S-curve that reproduces this, converting any input to the range 0–1.

But in backpropagation, each layer’s “responsibility coefficient” is determined by the slope (gradient) of this activation function. The sigmoid’s slope is at most about 0.25, usually less.

Where the shrinking coefficient came from: the sigmoid’s slopeThe sigmoid activation function drawn as its S-curve, squashing any input into the range 0 to 1. The slope of that curve is what becomes each layer’s coefficient during backpropagation. Where the input is extremely large or extremely small the curve is nearly flat and the slope is close to 0. At its steepest, where the input is near 0, the slope reaches only about 0.25. So even the best case multiplies the signal by a quarter, and every layer applies that multiplication again.Where the shrinking coefficient came from: the sigmoid’s slope−10+101.00.0input near 0, the best case → slope ≈ 0.25Any input, squashed into the range 0 to 1input extremely large → slope ≈ 0.0input extremely small → slope ≈ 0.0The best case is still a quarter. Every layer multiplies by it.
The steepest point on the curve is still a quarter. There is nowhere better to stand.

Biological plausibility and mathematical elegance: the very reasons the sigmoid was thought “clever” were what killed the gradient. Its strength was its weakness.

ReLU: why “crude” won

ReLU (Rectified Linear Unit) is astonishingly simple. “Pass through if positive, zero if negative”. That is all. Mathematicians at first dismissed it. Too crude. It has a non-differentiable point. Nothing like a neuron.

But ReLU’s slope for positive values is exactly 1.0. Not 0.25, not 0.1, but 1.

Sigmoid against ReLU: the same ten layersA comparison of what the sigmoid and ReLU activation functions do to a signal crossing ten layers. The sigmoid’s slope is at most about 0.25, so the signal is multiplied by 0.25 at each of the ten layers: 0.25 to the tenth power is roughly 0.000001, and the signal dies. ReLU’s slope for positive input is exactly 1.0, so the signal is multiplied by 1.0 at each of the ten layers: 1.0 to the tenth power is 1.0, and the signal survives intact. ReLU does not amplify anything; it merely stopped killing the signal. At the two or three layers typical of the 1980s the difference never surfaces, and only depth makes it fatal.Sigmoid against ReLU: the same ten layersSigmoid — slope at most 0.25×0.250.25¹⁰ ≈ 0.000001the signal diesReLU — slope exactly 1.0 for positive input×1.01.0¹⁰ = 1.0the signal survivesReLU does not amplify anything. It merely stopped killing the signal.At 2–3 layers, as in the 1980s, the difference never surfaces. Only depth makes it fatal.
Ten identical hops in both rows. Only one of them still has a signal at the end.

ReLU does not “amplify” the signal. It merely stopped killing it. The sigmoid actively compressed the signal at each layer. ReLU passes it through.

In the 1980s networks had only 2–3 layers, so the sigmoid’s problem never surfaced. Only when layers deepened did the hidden cost of the “clever design” become fatal. At scale, the crudeness that preserves the signal beats the elegance that breaks it.

But the sigmoid was not “wrong”. It was right, but could not withstand scale. Like training wheels on a bicycle: the right design for a beginner, an obstacle for a racer. In fact the sigmoid is still used for specific purposes: Yes/No classification in the output layer (where a 0–1 probability is needed) and gate control inside memory cells. But in the hidden layers of a deep network, ReLU is now standard.

Residual connections (ResNet, 2015): another solution

Where ReLU curbed each layer’s signal decay, residual connections (ResNet) attacked vanishing gradients from a completely different angle.

In an ordinary network, each layer is required to “take an input and produce a complete output”. With a residual connection, the input passes through a shortcut path and is added directly to the output.

What does this change? The layer’s job changes fundamentally. The layer’s role changes from “produce a complete output” to “learn a small correction (residual) to the input”. Hence the name residual connection.

Think of a familiar example. To weigh a dog too light for the scale, hold the dog, step on the scale together, and subtract your own weight. Because you have a known baseline (your own weight, the input), the small difference (the dog, the residual) can be measured accurately. A residual connection is the same: by keeping the input as a baseline, the small correction the layer must learn becomes detectable.

And for the gradient there is a decisive difference too. In backpropagation, the gradient flows through both paths:

Residual connections: the layer only learns the differenceResidual connections, in two parts. First, what the layer is asked for. On the ordinary path an input of 5 with an expected output of 5.3 means the layer must learn to produce 5.3 in full. With a residual connection, the input travels a shortcut and is added to the layer’s output, so the layer must learn only 0.3, a small correction, and 0.3 plus 5 gives 5.3. Second, what the gradient finds on the way back. It flows through both paths: through the layer path, where it may shrink to 0.001 times or far less, and through the shortcut path, where it arrives intact at 1.0 times. The total is about 1.001, so it never reaches zero. A layer that finds no useful correction outputs 0, and the input passes through untouched, which is why adding depth stopped costing accuracy.Residual connections: the layer only learns the differenceWhat the layer is asked forOrdinary pathinput = 5expected = 5.3[ Layer ]must learn: “output 5.3”the whole thingWith a residualinput = 5expected = 5.3[ Layer ]+shortcut: the input added as-ismust learn: “output 0.3”a small correction; 0.3 + 5 = 5.3What the gradient finds on the way backlayer path — may shrink to ×0.001, or far lessshortcut path — arrives intact at ×1.0total ≈ 1.001, so it never reaches zeroA layer with no useful correction outputs 0, and the input passes through untouched. That is why depth stopped costing accuracy.
Keeping the input as a baseline turns “produce 5.3” into “produce 0.3”, and gives the gradient a road that never narrows.

Even if the gradient shrinks to 0.001 on the layer path, the shortcut path adds 1.0. The total is about 1.001. The shortcut works as insurance, and the signal does not die. And because the gradient flows on the layer path too, the layer itself can still learn, because the feedback does not vanish.

What if the layer finds no useful correction? Output 0. Output = 0 + input = the input passes through unchanged. Because a layer has the option of “doing nothing”, adding deep layers does not degrade performance.

ResNet trained a 152-layer network successfully with this mechanism and won ImageNet 2015.

ReLU and ResNet: different approaches, the same goal

ReLU and ResNet are solutions from different angles to the same vanishing-gradient problem. ReLU prevents gradient decay inside each layer (keeping the coefficient at 1.0); ResNet secures a bypass for the gradient across layers. In modern deep learning, combining both made networks of over 100 layers practical.

The GPU broke the speed wall, and ReLU and ResNet broke the depth wall. With both the speed and depth walls down, modern deep learning became possible.

The vanishing-gradient problem beside its two remedies: ReLU holding the gradient at 1.0 inside each layer, and a ResNet skip connection carrying it across layers, which together make networks of over 100 layers practical once GPUs have removed the speed wall

4. What does it mean to turn words into numbers? — the geometry of meaning

Computers handle only numbers

The story so far has been “how to make learning accurate”. And every success so far handled data that was numbers from the start. Images are pixel values (each pixel a 0–255 colour value). Audio is waveform values. Stock prices, temperatures, sensor data: all numbers from the start. You can feed them straight into a neural network.

But words are not numbers. “Cat”, “economy”, “beautiful”: these are symbols and cannot be fed as-is into a neural network’s matrix computation. To build an LLM, you first had to solve the fundamental problem “how do we convert words into numbers?”

The simplest method: assign numbers, “cat = 1, dog = 2, sky = 3…”. But this leaves no semantic relationship between “cat” and “dog”. The information “cat and dog are similar”, “cat and spaceship are far apart” is not in the numbers.

Word2Vec: meaning as coordinates in space (2013)

The idea Google’s Mikolov and colleagues showed: represent a word as “coordinates (a vector)” in a high-dimensional space.

What does “high-dimensional” mean? The maps we use daily are 2D (east-west, north-south); inside a building, 3D (+ up-down). Word2Vec represents one word as 300-dimensional coordinates. Humans cannot picture a 300-dimensional space, but mathematically you can compute distance and direction just as in 2D or 3D.

Why 300 dimensions? Because the meaning of language is multifaceted. The word “cat” is characterised by countless axes: “animal?”, “pet?”, “size?”, “dangerous?”, “cute?”. Two or three dimensions cannot express this rich range of meaning. With 300 dimensions, each dimension can capture a different facet of meaning.

The training method is simple. Learn so that “words appearing in similar contexts get close coordinates”. “Cat” and “dog” are both used in contexts like “pet”, “food”, “walk”, so their coordinates become close.

The resulting “map of meaning” had a surprising property:

coordinates of "king" − coordinates of "man" + coordinates of "woman" ≈ coordinates of "queen"

You can do arithmetic on meaning. Language became mathematics.

One word held along many axes of meaning at once: “cat” scored for animal, pet, wild, dangerous, cute, soft, nocturnal and indoor, the same idea then scaled from two dimensions to three to three hundred, and the vector arithmetic king − man + woman ≈ queen drawn in that space

Aside: the idea that “meaning lies in relationships” had a precursor. In 1998, Stanford graduate students Larry Page and Sergey Brin proposed PageRank in the paper “The Anatomy of a Large-Scale Hypertextual Web Search Engine”. Search engines of the day ranked by keyword frequency within a page, but PageRank measured importance by how much a page was linked from other pages, the structural relationships of the web. The view that “the surrounding relationships express the essence more than the content itself” is remarkably similar to Word2Vec’s “a word’s meaning is determined by its surrounding context (co-occurring words)”. And the Google born from PageRank later founded Google Brain and produced the 2017 “Attention Is All You Need” (Transformer) paper. A search-engine company invented the core architecture of the LLM. Another “unintended connection”.

How do you measure “close”? — cosine similarity

I said “cat and dog are close”, “cat and spaceship are far”, but what does “close” mean in a 300-dimensional space?

Intuitively you want to use the distance between two points (Euclidean distance). But in high-dimensional space, direction captures semantic similarity better than distance.

See the reason with a concrete example. Suppose there is a long document and a short document about “cat”.

Why “close” means direction, not distanceWhy closeness in a high-dimensional space is measured by direction rather than distance. A short document mentioning cat five times and a long document mentioning it fifty times produce vectors of very different magnitude, so Euclidean distance calls them far apart even though both documents are about cats; their direction, however, is identical. Cosine similarity measures the angle instead: 1.0 means exactly the same direction and the same meaning, 0.0 means a right angle and no relation, and minus 1.0 means the exact opposite direction and opposite meaning. As an illustrative example, dog scores about 0.9 against cat because it points in almost the same direction, while spaceship scores about 0.1 because it points somewhere completely different.Why “close” means direction, not distanceThe problem with Euclidean distanceshort document: “cat” appears 5 timeslong document: “cat” appears 50 timesEuclidean distance: far apartDirection: identicalBoth documents are about cats. Distance calls them unrelated.Cosine similarity measures the angle instead1.0exactly the same direction — same meaning0.0right angle — unrelated−1.0exact opposite — opposite meaningWorked example (illustrative)“dog”≈ 0.9almost the same direction as “cat”“spaceship”≈ 0.1a completely different direction
Two documents about cats, one ten times longer. Distance calls that a difference in meaning.

Both are “documents written about cats”, yet measured by distance they are judged “far”. Measured by direction they are “the same”, and that is correct.

Cosine similarity measures how much two vectors point in the same direction.

The scale runs from 1.0 for exactly the same direction, through 0.0 for a right angle, to −1.0 for the exact opposite. The figure above carries both the scale and a worked example.

This is the foundation of today’s RAG (retrieval-augmented generation) and semantic search. Vectorise the user’s question, compute cosine similarity against the vectors of documents in a database, and retrieve the document closest in direction. The idea “measure meaning by direction”, which began with Word2Vec, is now the search engine of AI applications.

This technique is called Embedding.

Why Embedding is indispensable to an LLM

Embedding matters not only for RAG and search. It is the very entrance through which an LLM processes language.

An LLM’s interior is a neural network, a chain of matrix multiplications. Matrix multiplication needs vectors of numbers. You cannot put the string “cat” straight into a neural network.

The Embedding layer: an LLM’s front doorWhat happens to a sentence at an LLM’s front door. The sentence "the cat is sleeping" is first tokenised into the pieces the, cat, is, sleep and ing, which become the token IDs 12, 4521, 8834, 67 and 2201. Each ID is then converted by the Embedding layer into a 300-dimensional vector: 4521 becomes a list beginning 0.12, minus 0.34, 0.56 and ending 0.78, which is the meaning vector for cat, and 12 becomes a similar list which is the meaning vector for the. Only then do these vectors enter the neural network. A network can only multiply numbers, and every step before this one exists to produce them.The Embedding layer: an LLM’s front doorStep 1 — tokenise“the cat is sleeping”“the”12“cat”4521“is”8834“sleep”67“ing”2201Step 2 — Embeddingeach ID becomes a 300-dimensional vector4521[0.12, −0.34, 0.56, …, 0.78]the meaning vector for “cat”12[0.01, −0.02, 0.03, …, 0.01]the meaning vector for “the”Step 3 — into the networkA network can only multiply numbers. Everything before this step exists to produce them.
Nothing here is intelligent yet. It is the step that makes intelligence possible.

Without Embedding, an LLM cannot even receive input. The technique Word2Vec established, “convert words into meaningful vectors”, is built into the LLM’s literal entrance: its first layer.

We have now solved “how to turn words into numbers”. But the next problem waits. Converting words to vectors alone loses the order of the words (context). “The dog chased the cat” and “the cat chased the dog” have the same word vectors, but opposite meanings.

How do you handle context? That question is the theme of the next chapter. And the first to tackle it seriously were researchers in machine translation.

Summary

Part 1 followed the birth of the computer through Word2Vec, and the through-line was that each invention was solving a completely different problem:

  • Turing (1936): trying to prove the limits of mathematics gave birth to the concept of the universal computer, and to a permanent ceiling that applies to LLMs too.
  • Shannon (1948): defining “information = the reduction of uncertainty” to fight telephone-line noise became the LLM’s cross-entropy training loss and its temperature knob.
  • The perceptron to backpropagation (1958–1986): XOR triggered the first AI winter, and the “multi-layer but how to train it” question was answered by propagating error backwards.
  • GPUs and ReLU/ResNet (2012–2015): breaking the speed wall and the depth wall together made modern deep learning practical.
  • Word2Vec (2013): representing words as coordinates in space turned language into mathematics and became the LLM’s entrance, the Embedding layer.

The next problem is context: converting words to vectors loses their order, and “the dog chased the cat” and “the cat chased the dog” become indistinguishable. Part 2 picks up there, following the birth of attention, the Transformer, GPT-3’s scaling revolution, and the present era of alignment and efficiency. That is the second half of how the LLM was completed “without being designed”.

Share this article