The History of Language AI

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.

Read "bank" four ways

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

Language Is Ambiguous at Every Level

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".

Flip the meaning with one word

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.

The road

  1. Lookup: 1950 to 1969, translation as code-breaking, and its six rules.
  2. Rules: 1970 to 1992, small worlds written by hand.
  3. Counting: 1993 to 2012, a language model made of counts.
  4. Features: people design the clues, the machine learns the weights.
  5. Vectors: 2013, a word becomes a point, learned from its neighbours.
  6. Attention: reach back across a long sentence.
  7. Self-supervised: 2018, the text labels itself.
  8. Meaning: do these models understand, and what can go wrong?
  9. Showcase: feed all four machines and race them.
  10. Field guide: the eras, the dates and the code.
"The trophy doesn't fit in the suitcase because it is too big / small." Why can a system that ignores the last word score at most 50% on such pairs?

Chapter 1

1950 to 1969: Translation as Code-Breaking

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.

Run the 1954 translator

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).

What did the 1966 ALPAC report conclude?

Chapter 2

1970 to 1992: Small Worlds, Written by Hand

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:

Person: Pick up a big red block.
SHRDLU: OK.
Person: Grasp the pyramid.
SHRDLU: I DON'T UNDERSTAND WHICH PYRAMID YOU MEAN.
Person: Find a block which is taller than the one you are holding and put it into the box.
SHRDLU: BY "IT", I ASSUME YOU MEAN THE BLOCK WHICH IS TALLER THAN THE ONE I AM HOLDING. OK.

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.

Command the blocks world

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.

SHRDLU handled complex English inside its blocks world. Why could this approach not scale to open text?

Chapter 3

1993 to 2012: Count the Words

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.

Build a language model from counts

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:

Say it aloud

P of w given v equals c of v, w, divided by c of v.

P(w | v)
P of w given v the probability that word w comes next, when the word before it is v.
c(v, w)
c of v, w how many times the pair "v then w" appears in the corpus.
c(v)
c of v how many pairs start with v: how often any word comes after v.
In plain words

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.

With numbers

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:

Say it aloud

P of w-one through w-n is about the product over i of P of w-i given w-i-minus-one.

P(w1 … wn)
P of w-one through w-n the probability of the whole sentence, word 1 to word n, with <s> before it and </s> after it.
∏i
the product over i multiply one factor for each position i, the end mark included.
P(wi | wi−1)
P of w-i given w-i-minus-one the bigram probability of word i after the word just before it.
In plain words

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.

With numbers

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.

In the corpus, "ate" is followed by a word 6 times: "lunch" 3 times, "a" twice, "dinner" once. What is P(a | ate)?

Chapter 4

People Design the Clues, the Machine Weighs Them

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.

Train a tagger on hand-made features

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:

Say it aloud

s equals theta-zero plus the sum over j of theta-j times f-j.

s
s the score. If s is above 0 the tagger says verb; otherwise it says noun.
θ0
theta-zero the bias: a learned weight that counts for every phrase.
Σj
the sum over j add one term for each of the four features.
θj
theta-j the learned weight of feature j. Positive pushes toward verb, negative toward noun.
fj
f-j feature j for this phrase: 1 if its clue is true, 0 if not. A person wrote the clue.
In plain words

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.

With numbers

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).

Compared with the rule era, what did this era hand to the machine, and what stayed with people?

Chapter 5

2013: A Word Is the Company It Keeps

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.

Do arithmetic with meaning

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:

Say it aloud

Cos of u and v equals u dot v, over the length of u times the length of v.

cos(u, v)
cos of u and v the cosine of the angle between the two vectors: 1 means the same direction, 0 means unrelated, −1 means opposite.
u · v
u dot v multiply matching numbers of u and v, then add the products.
‖u‖
the length of u the square root of u dot u.
‖v‖
the length of v the square root of v dot v.
In plain words

Take the dot product of u and v. Divide by both lengths, so only direction counts.

With numbers

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:

Say it aloud

w-star equals the argmax over w of the cosine between v-king minus v-man plus v-woman, and v-w.

w*
w-star the answer word.
argmaxw
the argmax over w try every word w in the vocabulary and keep the one that makes the cosine largest. The three input words are left out.
vking − vman + vwoman
v-king minus v-man plus v-woman start at king, then take the step that leads from man to woman.
vw
v-w the learned vector of candidate word w.
In plain words

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.

With numbers

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.

What did word2vec show that surprised researchers?

Chapter 6

Reaching Back Across the Sentence

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.

Keep the subject in view

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.

8 words
0.90

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:

Say it aloud

m equals a to the k.

m
m the share of the subject's signal left in the memory when the reader reaches the verb, from 0 to 1.
a
a the fraction the memory keeps at each step, between 0 and 1.
k
to the k the number of steps between subject and verb: multiply by a once per step.
In plain words

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 numbers

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.

Why does attention handle "The keys … are" better than a simple recurrent memory?

Chapter 7

2018: The Text Labels Itself

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.

Hide a word and predict it

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:

Say it aloud

L equals minus one over N times the sum over i of the log of P of w-i given its context.

L
L the loss: how surprised the model is by the true words, on average. Lower is better.
−(1/N)
minus one over N average over the N hidden words, and flip the sign so the loss is positive.
Σi
the sum over i one term for each hidden word.
log
log the natural logarithm. A probability near 1 gives a log near 0; a small one gives a large negative number.
P(wi | context)
P of w-i given its context the probability the model gives the true word: both sides for BERT, the left side for GPT.
In plain words

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.

With numbers

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.

Why was self-supervised pretraining a breakthrough for NLP?

Chapter 8

Do These Models Understand?

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."

Grow a word's meaning network

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).

In Manning's view, what is meaning?

Chapter 9

Showcase: Four Eras, One Word

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.

Feed the four machines

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

Field Guide

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 wroteLearned from dataSignature systemFails on
1950 to 1969dictionary entries, word-choice codesnothingGeorgetown-IBM, 1954: 250 words, 6 rulesany sentence the codes did not foresee
1970 to 1992grammars, rules, world modelsnothingSHRDLU (1968 to 1970); LUNAR, 78% in 1971anything outside its small world
1993 to 2012features and labelsweights, countsPenn Treebank taggers, about 97%clues nobody wrote; unseen pairs
2013 to nowarchitecture, objective, choice of textvectors and all weightsword2vec, Transformer, BERT, GPT-3careful reasoning; confident falsehoods; bias
YearMilestoneWhy it matters here
1949Weaver's memo "Translation"language as a code to break
1954Georgetown-IBM demo, 7 Januarymore than 60 sentences, 250 words, 6 rules
1966ALPAC reportUS machine translation funding mostly stops
1968 to 1970SHRDLU at MITunderstanding inside a blocks world
1971LUNAR at the Lunar Science Conference78% of live questions on one database
1993Penn Treebank4.5 million tagged words to learn from
2003Bengio's neural language modellearned word vectors inside a language model
2013word2vecfast vectors; analogies as directions
2014sequence-to-sequence; attentionneural translation that looks back
2017The Transformerattention only, trained in parallel
2018GPT and BERTself-supervised pretraining, then adapt
2020GPT-3new tasks from a prompt and a few examples
2022ChatGPT, 30 Novembera 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.

Keep going

Read next

The habit. For any language system, ask what people had to write by hand, and what it learned from data. The hand-written part is where it will break.
Which sentence best sums up the four eras?

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.

The History of Language AI · Stanford CS224N, Lecture 1
Next: Word Vectors · Course site · Back to Gleams