The setup. Elman’s lexicon has 13 kinds of word, such as humans (man, woman, boy, girl), food (cookie, bread, sandwich), and verbs that take a food (eat) or a fragile object (break, smash), and 16 sentence templates such as human eat food or animal move; some words belong to two kinds (lion is an animal and an aggressor). Each word is a one-hot input, so “man” and “woman” start out exactly as different as “man” and “plate.” Hidden units are sigmoids, the context units copy the previous hidden layer, the output is a softmax over the 30 words, and training is Elman’s one-step backprop, online, for 6 passes over about 27,000 words. The n-gram lines are the error of counting models fit to the same sentences and tested, like the network, on held-out ones: the trigram (two words of context) is close to the best possible, because a sentence is at most three words long. Beating the bigram requires memory: after eat, whether a human, animal or food comes next depends on who was eating.
What the tree shows, and what it does not. Elman reported a top split into nouns and verbs. Here the tree splits by what each word predicts: animate nouns (a verb comes next), transitive verbs (an object comes next), and everything that ends a sentence, both inanimate nouns and intransitive verbs like sleep (a new subject comes next). Within those the categories are clean: humans, animals, aggressors, food, fragile things. That is the point Parth and Ardhra raised. The averaged hidden state is shaped by the prediction task, and co-occurrence counts of the neighboring words recover much of the same tree with no network at all, so the structure is in the data; what the network adds is learning it from prediction, and compressing it. The untrained network shows no categories: a random network can only tell the words apart, not group them. And the tree itself is a choice: switch to average linkage and the same vectors make a different tree, which is why Teoman wants a test rather than a picture.
The zog test. Elman added a novel word, zog, replaced every man with it in new sentences, and found zog’s hidden state among the humans, with no training on zog. Zog’s own input weights are random and untrained, so its hidden state comes almost entirely from the words before it, and zog lands wherever its positions put it: with the humans where man was, with the foods where cookie was, among the sentence-ending words at random places. Ankit’s worry is right: the test shows the representation reflects context, which is useful, but it is built into how zog was placed, and it is not evidence the network learned anything about zog.
Probe, control, intervention. The probe is a logistic regression reading “is the current word a noun?” from the hidden state. It is fit on most words and tested on words it never saw (woman, dog, rock, plate, bread, chase, sleep, smell, break), because on the words it was fit on a probe can simply memorize which of the 29 one-hot words are nouns. Even so, the probe needs a control: an untrained network with random weights also scores well above chance on held-out words, because its context units carry the previous word forward, and the previous word hints at the current one’s category (after a verb, a noun is likely). The evidence is the gap between the two networks, not the trained network’s accuracy alone. Then the causal test: push the hidden state along the probe’s direction and watch the prediction. After “… man” the network expects a verb; push the state toward the verb side and it expects a noun instead, as if it had just read a verb. The distinction is not only readable, the network uses it.