In 1954 a machine translated Russian with 250 words and 6 rules that people wrote. In 2018 BERT learned from 3.3 billion words of plain text and no rules. In between, each era of NLP moved one more job from people to data.
Pick an era and watch its machine read the word bank in eight sentences. Count what people had to write, and what it gets right. Then we build each machine from zero, from the 1954 dictionary to a model that labels its own text.
You need a little Python and what a probability is. We build the rest from zero.
Lecture 1, "History of NLP", of Stanford CS224N, Natural Language Processing with Deep Learning (Winter 2026, Diyi Yang and Yejin Choi). Its reading, and the source of the four eras, is Christopher Manning's essay "Human Language Understanding & Reasoning" (Daedalus, 2022). Next: Lecture 2, Word Vectors.
Illustrative toy, computed live in your browser. The sentences, the rule, the 12 labelled lines and the 29 raw lines are ours. Each machine is a tiny version of its era's method (Chapter 9 lets you feed them). The scores show the pattern, not history's numbers.
Chapter 0
Change one word, watch the meaning flip, and see why a machine must know the world to keep up
Read this: "The trophy doesn't fit in the brown suitcase because it is too big." What is too big? The trophy. Now change one word: "because it is too small." Now "it" is the suitcase. You did the work without noticing. A machine has to do all of it.
Language is ambiguous at every level. A word can have several senses: a bank holds money, or it lines a river. A sentence can have two structures: in "I saw her duck", duck is a bird or a quick bend of the knees. A pronoun like "it" can point at different things, and the text often does not say which.
The trophy sentences are a Winograd schema: a pair of sentences that differ in one word, where the answer flips. Hector Levesque, Ernest Davis and Leora Morgenstern built a test from such pairs in 2012. They named it after Terry Winograd. His 1972 book used the pair "The city councilmen refused the demonstrators a permit because they feared violence" and "because they advocated violence".
The arrow shows what the pronoun means. Pick a pair, then switch the one word. Then turn on the guesser that ignores that word.
The two pairs are the published examples. The "nearest noun" guesser is ours: it points the pronoun at the closer of the two nouns, whatever the sentence says.
Here is the worked number. A system that does not use the changed word gives the same answer to both sentences of a pair. One of those answers is wrong. So on a test made of such pairs, it can score at most 50%: no better than a coin.
CS224N opens with this problem and with history. Its first lecture is "History of NLP", and its reading is Christopher Manning's essay on human language understanding (Daedalus, 2022). Manning splits 75 years into four eras. This lesson builds one machine from each era, and asks the same question of each: what did people have to write by hand?
Symptom: a system scores well on a test set, then fails when one word of a sentence changes.
Measure: build pairs that differ in one word and score both halves. A method that ignores the word is right on at most half.
Fix: test on minimal pairs, and prefer methods that use the whole context, not just which words are present.
Chapter 1
Run the 1954 translator on its own demo sentence, and see what six hand-written rules can and cannot do
In 1949 Warren Weaver of the Rockefeller Foundation wrote a memo called "Translation". He quoted a letter of his own: "When I look at an article in Russian, I say: 'This is really written in English, but it has been coded in some strange symbols. I will now proceed to decode.'" If language is a code, translation is code-breaking: look up each symbol.
On 7 January 1954, Georgetown University and IBM showed the idea at work. An IBM 701 translated more than 60 Russian sentences into English. It used a dictionary of 250 words and six rules (Hutchins, 2004). The next day the demo was on the front page of the New York Times. A Georgetown professor forecast that in "five, perhaps three, years" such translation "may well be an accomplished fact".
Manning calls the systems of this era "little more than word-level translation lookups". The device runs one demo sentence with the codes and rules that W. John Hutchins reconstructed.
The Russian sentence is 13 dictionary entries, each with a rule number a person wrote. Press Step or Play. Then turn the rules off.
Real data: entries, English choices and rule numbers for demo sentence 5 follow Hutchins (2004), after Sheridan's account of the program. The transliteration is the one the 1954 team used.
Rule 2 picks between two English words for the stem ugl-, "coal" or "angle", by reading a code that a person wrote on the next entry. Rule 3 chooses a word and may swap it with its neighbour: "angle of" becomes "of angle".
The worked number: in this sentence, 8 of the 13 entries need a rule to choose a word or to swap two words. The other 5 pass through unchanged. With the rules off, the output is "magnitude coal of is determined relation by length of arc of to radius to". People wrote every code with the demo sentences in view.
The forecast failed.
In 1964 the US agencies that paid for the work asked the National Academy of Sciences for a review. The committee, chaired by John R. Pierce, was ALPAC. Its 1966 report found machine translation slower, less accurate and about twice as costly as human translation. It saw "no immediate or predictable prospect of useful machine translation". US funding mostly stopped.
Symptom: the demo sentences translate well; new sentences come out as word salad.
Measure: test on sentences the rule writers never saw.
Fix: this era had none. The next era shrank the world until rules could cover it (Chapter 2). The one after learned from text (Chapter 3).
Chapter 2
Shrink the world until rules can cover it, and find the edge where every rule runs out
After ALPAC, researchers asked a smaller question. Can a computer understand language if its whole world is small and known? Manning names the famous systems of this era, among them SHRDLU and LUNAR, and calls them "hand-built, rule-based systems".
Terry Winograd wrote SHRDLU at MIT from 1968 to 1970. Its world was a table with blocks, pyramids and a box, moved by a simulated hand. A person typed English; SHRDLU acted and answered. Here is the start of its famous dialogue:
Each answer comes from a pipeline that people wrote. It parses the sentence, turns the parts into a meaning, checks the meaning against the world, then acts. SHRDLU resolves "it" and asks when "the pyramid" fits three objects. Inside its world, it looks like understanding.
Pick a command. The parser tries its hand-written rules in order. Watch which rule fires and what the hand does. The last command steps outside the world.
Illustrative toy of our own: a scene, four rules and a word list that replay four lines of Winograd's published dialogue and its "steeple" reply. SHRDLU itself was a large Lisp and Micro-Planner program. Block colours here are the blocks' own colours, not roles.
LUNAR, built by William Woods at BBN, answered geologists' questions about the Apollo 11 moon rocks. It turned an English question into a database query. At the Second Lunar Science Conference in January 1971, scientists typed live questions. Woods reports that LUNAR answered 78% of them, and that 90% fell within its scope. Its dictionary began as a NASA list of 3,000 words, including every chemical element and every word in the first conference's papers. Woods then added grammar features and meaning rules to it by hand.
That is the worked number, and the catch. The 78% came from hand work fitted to one database. A new subject meant a new dictionary, new rules and new meaning procedures, written by people from the start.
Symptom: asked "What is a breccia?", LUNAR replied "S10046". That sample is a breccia, but the answer is useless.
Measure: Woods: LUNAR "had no model of the purpose behind the user's question". It found the thing the words named, and stopped.
Fix: more rules for more question types, written by hand, one at a time. That is the cost that would not scale.
Chapter 3
Stop writing rules, count which word follows which, and meet the zero that breaks the count
By the early 1990s, text was online in quantity. Manning describes the third era's method: "get hold of a reasonable quantity of online text" and learn from it. In 1993 the Penn Treebank appeared (Marcus, Santorini and Marcinkiewicz). It held over 4.5 million words of American English tagged with parts of speech. More than half was also bracketed into sentence structure.
The simplest thing to learn from text is which word tends to come next. A language model gives a probability to each possible next word. A bigram model looks at only one word back, and gets its probabilities by counting pairs.
Pick a sentence to score: each step multiplies one probability. Switch on add-one to fix the zero, or press Generate.
Illustrative toy: eight sentences of ours; <s> and </s> mark the start and the end.
How likely is "lunch" after "ate"? Count the pair "ate lunch". Call that c(ate, lunch). Count every pair that starts with "ate". Call that c(ate). Their ratio is the estimate:
P of w given v equals c of v, w, divided by c of v.
Find every place where v appears with a word after it. Count them: that is c(v). Count the places where the next word is w: that is c(v, w). Divide.
From the device: a word comes after "ate" 6 times, and 3 of those are "lunch". So P(lunch | ate) = 3 / 6 = 0.5. "dinner" follows "ate" once, so P(dinner | ate) = 1 / 6 = 0.17.
A sentence is a chain of such steps. The bigram model multiplies one probability per word:
P of w-one through w-n is about the product over i of P of w-i given w-i-minus-one.
Walk through the sentence one word at a time. At each word, look up its bigram probability after the previous word. Multiply all of them. The "about" sign is there because the true probability of a word depends on more than one word back.
From the device: "i ate lunch" is P(i | <s>) × P(ate | i) × P(lunch | ate) × P(</s> | lunch) = 0.625 × 0.8 × 0.5 × 0.75 = 0.1875. The model gives this exact sentence a chance of about 1 in 5.
Symptom: "tom likes dinner" gets probability 0, though it is a fine sentence.
Measure: c(likes, dinner) = 0, and one zero factor makes the whole product 0.
Fix: smoothing. Add-one adds 1 to every pair count and the vocabulary size V = 11 to every row count. Then P(dinner | likes) = (0 + 1) / (1 + 11) = 0.083, and the sentence scores 0.00034.
Chapter 4
Hand-made features, weights learned from labelled data, and the clue nobody thought to write
Counting pairs works for predicting words. Most tasks need more: is "book" a noun or a verb here? Is "Paris" a person or a place?
The third era answered with supervised learning. People label examples. People also write features: yes-or-no clues such as "the word before is the". The machine learns one weight per feature from the labelled examples.
So the job split in two. Rules were gone; features and labels stayed with people. This toolkit reached about 97% accuracy at tagging each word's part of speech in Penn Treebank news text (Manning, 2011). The device trains a tiny tagger that decides noun or verb for a word from the word before it.
Each yellow switch is a feature a person wrote. Training learns the purple weights from ten labelled phrases. Pick a test phrase, then switch a feature off and watch the weights retrain.
Illustrative toy: ten labelled phrases of ours, trained with the perceptron rule (add the features on a mistake). Real taggers of the era used hundreds of thousands of features and the whole Treebank.
The model adds up the weights of the features that fire. Call feature j's value fj (1 if it fires, 0 if not) and its learned weight θj. A bias weight θ0 always counts. The score is:
s equals theta-zero plus the sum over j of theta-j times f-j.
Check each feature's clue against the phrase. For every clue that is true, add its weight θ-j. Add the bias θ-zero. If the total s is above 0, say verb.
From the device, with all four features on, training learns θ0 = 0 and weights −2, +1, +1 and −1. For "to book" only the second clue is true: s = 0 + 1 = 1, so verb. For "the bank" only the first: s = −2, so noun.
Symptom: the tagger calls "she runs" a noun. It is a verb.
Measure: nobody put "she" in the pronoun list, so that clue stays 0. The only clue that fires is "ends in s", weight −1: s = −1.
Fix: a person adds "she" to the list, and the next missing clue waits. Era 4 removed this job: the model learns its own features (Chapter 5).
Chapter 5
Turn each word into a point learned from its neighbours, then do arithmetic with meaning
The linguist J. R. Firth wrote in 1957: "You shall know a word by the company it keeps." "Loan" and "mortgage" both sit near "bank", "interest" and "paid", and they mean similar things. So let a machine learn, for each word, a list of numbers that predicts its neighbours. That list is a word vector.
Manning dates the fourth era from 2013: "words and sentences are represented by a position in a real-valued vector space". Yoshua Bengio's team learned word vectors inside a neural language model in 2003. In 2013 Tomas Mikolov and colleagues at Google released word2vec, fast enough to read billions of words.
Purple points are word vectors. Pick an analogy and watch the step get added. Then let the input words compete.
Illustrative: we placed these six-word spaces by hand in 2 dimensions to show the geometry. Google's released word2vec vectors have 300 numbers each.
How alike are two vectors u and v? Multiply them number by number and add: that is the dot product, u · v. Divide by both lengths, ‖u‖ and ‖v‖. The result is the cosine similarity:
Cos of u and v equals u dot v, over the length of u times the length of v.
Take the dot product of u and v. Divide by both lengths, so only direction counts.
With the device's made-up 2-number vectors: king = (1.2, 3.0) and queen = (1.0, 3.9). u · v = 1.2 × 1.0 + 3.0 × 3.9 = 12.9. The lengths are 3.23 and 4.03. So cos = 12.9 / (3.23 × 4.03) = 0.99: nearly the same direction.
The surprise: directions carry relations. The step from "man" to "woman" roughly matches the step from "king" to "queen". Add that step to "king" and find the nearest word:
w-star equals the argmax over w of the cosine between v-king minus v-man plus v-woman, and v-w.
Subtract the vector of man from the vector of king and add the vector of woman. Compare the result with every other word's vector by cosine. The largest cosine wins.
Made-up vectors from the device: king (1.2, 3.0) − man (3.0, 0.5) + woman (3.0, 1.1) = (1.2, 3.6). Its cosine is 0.997 with queen and 0.978 with prince, so w* = queen. Mikolov's 2013 paper reports the same result with real learned vectors.
Symptom: vectors learned from news text complete "man is to computer programmer as woman is to" with "homemaker".
Measure: that is the title result of Bolukbasi and colleagues (2016), on word2vec vectors trained on Google News. Vectors copy the text's patterns, biases included.
Fix: measure bias directions and reduce them; choose training text with care. Neither removes bias fully.
Chapter 6
Watch a fading memory lose the subject of a long sentence, and let attention look straight back at it
"The keys to the old cabinet in the hall ___ on the table." Is the missing word "is" or "are"? It agrees with "keys", eight words back. A bigram model sees only "hall" and says "is". Word vectors alone do not help: they say what each word means, not how far back the subject sits.
A recurrent neural network (RNN) reads one word at a time and carries a hidden state: a vector that sums up the words so far. Each step mixes the new word in, and older words fade. Long short-term memory networks (LSTMs, Hochreiter and Schmidhuber, 1997) add gates that slow the fading. In 2014 Ilya Sutskever and colleagues used two such networks to translate: one reads the sentence, one writes the output.
The verb must agree with "keys". Drag the gap: more words sit between them. The three bars show how much of "keys" each reader still has when it reaches the verb.
Illustrative toy. The fading memory keeps a fraction a of the subject at each step; a real RNN's loss is messier but follows this shape. The attention bar gives "keys" a score of 4 and every other word 0, then shares weight with a softmax.
How much of a word survives k steps of fading? If each step keeps a fraction a of it, call what is left m:
m equals a to the k.
Start with the whole signal, 1. At each of the k steps, keep only the fraction a. After k steps, m is a multiplied by itself k times.
With made-up a = 0.9: after k = 10 words, m = 0.910 = 0.35. After 20 words, m = 0.12. Nine-tenths per step sounds safe; twenty steps keep about an eighth.
Attention removes the chain.
At the verb, the model scores every earlier word for relevance. It turns the scores into weights that sum to 1 and takes a weighted mix. "Keys" can get most of the weight at any distance. Dzmitry Bahdanau and colleagues added attention to translation in 2014. In 2017 the Transformer (Vaswani and colleagues, "Attention Is All You Need") dropped recurrence and built the whole model from attention. Manning: since then "the dominant neural network model for NLP applications has been the transformer".
Symptom: a recurrent model gets "the keys … is" wrong once the gap is long.
Measure: score agreement as the gap grows. With a = 0.9 the subject's share is 0.35 at 10 words and 0.12 at 20.
Fix: gates (LSTMs) slow the fade; attention reads the subject directly, at any distance.
Chapter 7
Hide a word and predict it, so every sentence ever written becomes a training example
Every machine so far needed something written by people: rules, features or labels. The Penn Treebank's 4.5 million tagged words took years. The 2018 answer: hide part of the text and train the model to fill it in. The text supplies its own answers. This is self-supervised learning.
Manning describes the two main forms. "Mask out occasional words in a text" and predict them: that is BERT (Devlin and colleagues, October 2018). It masks 15% of tokens and reads both sides of each gap. Or predict "each next word in the text given the previous words": that is GPT (OpenAI, 2018), which reads only the left side. Both are Transformers.
Tap a word to mask it. Blue bars are the model's guesses. Switch between both sides and the left only.
Illustrative toy: a count model over 12 sentences of ours stands in for the Transformer. It multiplies the left-pair count by the right-pair count.
Training pushes up the probability of the true hidden word. Call the model's probability for the true word at position i P(wi | context), and the number of hidden words N. The loss to make small is:
L equals minus one over N times the sum over i of the log of P of w-i given its context.
For each hidden word, look up the probability the model gave the true word and take its log. Average the logs over the N words and flip the sign. Training changes the weights to make L smaller.
From the device: in "the [MASK] sat on the mat", reading both sides gives P(cat) = 0.76, so the loss is −log 0.76 = 0.27. Reading the left only gives P(cat) = 0.30 and a loss of 1.21. The right side, "sat", is worth almost a whole unit of loss here.
Now count the labels. BERT trained on 3.3 billion words (BooksCorpus and English Wikipedia). Masking 15% gives about 495 million fill-in questions per pass, 110 times the Penn Treebank's hand-tagged words, and nobody labelled any of them. GPT-3 (2020) read 300 billion tokens. BERT set new best results on eleven NLP tasks. Manning calls such models foundation models: pretrained once by self-supervision, then adapted "via fine-tuning or prompting".
Symptom: a model pretrained with [MASK] tokens never sees one in use, so real inputs do not look like training.
Measure: the [MASK] token appears in 15% of pretraining positions and in 0% of real text.
Fix: BERT's 80-10-10 rule: of the chosen tokens, 80% become [MASK], 10% become a random token and 10% stay as they are.
Chapter 8
Treat meaning as a network of connections, see which ones text can supply, and name the risks
A model that predicts words well can write a fluent paragraph about a sunset. Does it know what a sunset is? Two classic answers pull apart. The denotational view says a word's meaning is the things in the world it picks out. The use view says a word's meaning is a description of the contexts it appears in. Word vectors are the use view, built by machine.
Manning offers a middle path: "meaning arises from understanding the network of connections between a linguistic form and other things". Those other things include other words, facts, sights, sounds and actions. His example is the shehnai, a double-reed wind instrument of North India. Someone who has held one has connections a reader lacks; a reader who met the word in a story about a wedding has some the holder lacks. "Meaning is not all or nothing; in many circumstances, we partially appreciate the meaning of a linguistic form."
The warm word sits in the middle. Each switch adds one kind of experience, with its connections. Then show what a model trained on text alone can reach.
Illustrative: the connections and their counts are ours. Manning's essay uses the shehnai to make this point; it gives no counts.
The worked number, from the device: all four kinds of experience give 16 connections. A text-only model reaches the 6 that text describes. Text can also describe sounds and touch, so the line is not sharp; it is partial, as Manning says. His verdict: "there can be no doubt that pretrained language models learn meanings". He also writes that they lack "a human-level ability for careful logical or causal reasoning", and that their knowledge of the world is "often very incomplete".
The essay names two risks of foundation models. The groups that can build them "may have excessive power and influence". Users "might suffer from any biases present in these models". John Searle's Chinese Room argument (1980) is the classic case against calling any symbol shuffling understanding. The debate is open; the measurable questions are which connections a model has, and where it fails.
Symptom: a model states a false fact in fluent, confident prose. This is often called hallucination.
Measure: check its claims against a source. Fluency is not a signal of truth: the training objective rewards likely words, not checked facts.
Fix: ground answers in retrieved sources, train the model to say when it does not know, and evaluate it on facts (later lectures: post-training, evaluation).
Chapter 9
Feed the four machines from the hero, each in its own currency, and race them on your sentence
These are the hero's four machines, opened up. Each era is paid in a different currency. The lookup gets one dictionary entry. The rule gets cue words. The counter gets labelled sentences. The vector model gets raw text that nobody labelled, plus one name for each sense.
Type a sentence with "bank". Each column shows one era's verdict and its evidence. Below, feed any era and watch its score on the eight test sentences.
Illustrative toy, computed live. Lookup always answers "money". The rule fires on any cue word. The counter is naive Bayes with add-one smoothing. The vector model squeezes each word's co-occurrence counts into 8 numbers and compares the sentence with the words "money" and "river".
Things to try. Type "The flood reached the bank." and see the rule and the counter fail. Add "flood" as a cue word: the rule now gets one more test sentence right, and nothing else changes. Then type "A heron stood on the bank.": the vector model has never met "heron" and gives no answer. Add the raw line "A heron waded in the river." and it says river, though nobody labelled anything.
Check yourself. Which era can learn a word that no person ever linked to a sense? Why do the rule, the counter and the vectors all miss "The bank by the river approved our mortgage"? The lookup gets it right only by luck. Each machine checks which words are present; none reads who did what to whom. That is the job of the attention in Chapter 6.
Chapter 10
Keep the four eras, the dates, the code, and where the course goes next
Language is ambiguous, so a machine must use context and knowledge of the world. Over 75 years, NLP moved the work of supplying that knowledge from people to data. First people wrote dictionaries and rules. Then they wrote features and labels, and machines learned the weights. Then machines learned their own representations from raw text, with the text as its own label.
| Era (Manning, 2022) | People wrote | Learned from data | Signature system | Fails on |
|---|---|---|---|---|
| 1950 to 1969 | dictionary entries, word-choice codes | nothing | Georgetown-IBM, 1954: 250 words, 6 rules | any sentence the codes did not foresee |
| 1970 to 1992 | grammars, rules, world models | nothing | SHRDLU (1968 to 1970); LUNAR, 78% in 1971 | anything outside its small world |
| 1993 to 2012 | features and labels | weights, counts | Penn Treebank taggers, about 97% | clues nobody wrote; unseen pairs |
| 2013 to now | architecture, objective, choice of text | vectors and all weights | word2vec, Transformer, BERT, GPT-3 | careful reasoning; confident falsehoods; bias |
| Year | Milestone | Why it matters here |
|---|---|---|
| 1949 | Weaver's memo "Translation" | language as a code to break |
| 1954 | Georgetown-IBM demo, 7 January | more than 60 sentences, 250 words, 6 rules |
| 1966 | ALPAC report | US machine translation funding mostly stops |
| 1968 to 1970 | SHRDLU at MIT | understanding inside a blocks world |
| 1971 | LUNAR at the Lunar Science Conference | 78% of live questions on one database |
| 1993 | Penn Treebank | 4.5 million tagged words to learn from |
| 2003 | Bengio's neural language model | learned word vectors inside a language model |
| 2013 | word2vec | fast vectors; analogies as directions |
| 2014 | sequence-to-sequence; attention | neural translation that looks back |
| 2017 | The Transformer | attention only, trained in parallel |
| 2018 | GPT and BERT | self-supervised pretraining, then adapt |
| 2020 | GPT-3 | new tasks from a prompt and a few examples |
| 2022 | ChatGPT, 30 November | a chat model used by the public |
The core of era 3, as code. We ran it: it prints the same numbers as Chapter 3.
python from collections import Counter import math corpus = ["i ate lunch", "i ate dinner", "i ate lunch with tom", "tom ate lunch", "tom ate a pear", "i like tom", "tom likes lunch", "i ate a pear with tom"] pairs, firsts = Counter(), Counter() for s in corpus: w = ["<s>"] + s.split() + ["</s>"] for a, b in zip(w, w[1:]): pairs[(a, b)] += 1 # c(v, w) firsts[a] += 1 # c(v) V = len({x for s in corpus for x in s.split()}) + 1 # 10 words + </s> = 11 def p(v, w, add=0): return (pairs[(v, w)] + add) / (firsts[v] + add * V) def sentence_prob(s, add=0): w = ["<s>"] + s.split() + ["</s>"] return math.prod(p(a, b, add) for a, b in zip(w, w[1:])) print(p("ate", "lunch")) # 0.5 print(sentence_prob("i ate lunch")) # 0.1875 print(sentence_prob("tom likes dinner")) # 0.0: one unseen pair print(round(sentence_prob("tom likes dinner", add=1), 6)) # 0.000344
Where the course goes next. Lecture 2 builds word vectors properly: word2vec's objective and its gradient. Then neural networks and backpropagation, recurrent language models, the Transformer, and pretraining. Each later lecture is one row of the timeline, opened up.
Now teach it: press Present or Teach. Explain what people wrote by hand in each era, and why self-supervision removed the last of it. Then go back to the eight sentences and predict which era misses "The flood washed soil off the bank" before you tap it.