The film
About 5:52, hosted by Tallow. It asks you two questions and waits for your answer before it shows you. The guide's voice is not recorded yet, so for now the film plays with captions; the full words are also below.
Nothing loads until you press play.
The lab: the wheel room
Give the model a start, cut the wheel by temperature, top-k or top-p, and spin once or two hundred times; each run is checked against the rules that wrote the guides' sentences. From pylon at temperature 1, 89% of runs follow the rules; at temperature 2, 11%.
Everything is computed on your computer, in this page. Nothing is sent anywhere.
Everything the film says
Decoding
Decoding. Turning guesses into sentences.
In the lesson on next-word prediction, the model's guess was a spread of belief over every word. A sentence needs one word at a time. Tonight, how the choosing is done, and what each way of choosing does.
Always the widest
The simplest way: always take the widest slot. That is called greedy decoding.
Start the model on pylon and let it run. It writes: pylon found a kettle. Pylon put a cone on the kettle. Pylon found a kettle. And again, until the page runs out.
Why the kettle every time? After found a, the rules choose among 10 things equally, but the model leans a little: kettle gets 14 percent. A small lean, taken every time, becomes the only story it tells.
Spin the wheel
The other way: spin a wheel where each word's slot is as wide as its share, and take whatever comes up.
We spun it 1,500 times from the same start. Those runs wrote 1,482 different texts, and 89 percent of the runs could have been written by the rules.
Our check for that is strict. It parses each run with the rules themselves, including the long-range ones: the cone goes on the thing that was found, and the answer to who names the guide who did it.
Temperature
Before the wheel is cut, the scores can be divided by a number called the temperature. Below 1, the wide slots get wider and the thin ones shrink. Above 1, the shares move toward even.
After tallow found a, the kettle's slot is 20 percent of the wheel at temperature 0.5, and 11 percent at temperature 2, where words that make no sense there get bigger slots too.
Turn the temperature up to 2. What share of runs will still follow the rules? (the film pauses here)
At temperature 0.5, 98 percent of runs follow the rules. At 1, 89. At 1.5, 51. At 2, only 11.
And at temperature close to zero, the widest slot takes the whole wheel. In 200 spins at 0.01, every run was the greedy one.
Top-k: only the widest few
Another fix cuts the wheel down to the k widest slots before spinning. Fan and colleagues used ten for writing stories in 2018.
With k at 3, after tallow found a, the wheel keeps 3 slots: kettle, map and crate. The other things that could be found are never written there at all.
The catch is that k never changes. Where only two words make sense, three slots is one too many. Where ten make sense, three is too few.
Top-p: as many as it takes
Holtzman and colleagues, in 2020, cut the wheel by share instead: keep the widest slots until together they reach p, and drop the rest. Where the model is sure, that is one or two words. Where it is torn, it is many.
With p at 0.9, after tallow found a, the wheel keeps 9 slots. Runs that follow the rules: 94 percent.
Push p down to 0.5 and nearly every run follows the rules, 99.7 percent. But its 1,500 runs wrote only 210 different texts. Safe, and samey.
Nearly every run follows the rules. What has it given up? (the film pauses here)
What we did not find
That paper also found that plain spinning, at temperature 1, drifts into nonsense in big models. Thousands of unlikely words each get a sliver of the wheel, and together the slivers add up to far too much.
Ours shows a small version. At temperature 1, 4 percent of runs contain a word pair it never saw in training. Top-p at 0.9 lets none through, and rule-following rises from 89 to 94 percent.
The paper's other warning sign does not show here: scoring its own runs, the model is torn between 1.87 words per step, and scoring the rules' own runs, 1.92. With only 46 words, the tail is short. The full problem needs a bigger model to see.
Goodnight
Greedy tells one story forever. Spinning tells many. Temperature, top-k and top-p decide how wide the wheel's slots are before it spins.
Next in the lighthouse: how to tell whether a language model is any good. Goodnight.
Sources
Every claim in the film, with where it comes from and what that source does not prove. The numbers about the model are computed from its weights, which you can load and check: facts.json.
Night School's attention model, sampled for this film. media/school/decoding/facts.json, written by tools/school/fill_decoding.mjs from system/school/decoding.mjs and corpus-grammar.mjs: 1,500 continuations per setting from three prompts with shared random streams, judged by a parser of the corpus generator's own rules. https://github.com/HarperZ9/HarperZ9.github.io/tree/main/media/school/decoding
Used for: From the prompt 'pylon', greedy decoding writes 'found a kettle . pylon put a cone on the kettle . pylon found a kettle ...'. Grammatical share from 'pylon': temperature 0.5 0.9807, 1 0.8907, 1.5 0.5107, 2 0.106; top-k 3 0.9487; top-p 0.9 0.9447, 0.5 0.9973; uniform 0; generator 1. Distinct continuations per run from 'pylon': temperature 1 0.988, top-p 0.5 0.14. After 'tallow found a': kettle's share is 0.197 at temperature 0.5 and 0.110 at temperature 2; top-k 3 keeps kettle, map and crate; top-p 0.9 keeps 9 words. Temperature 0.01 reproduces greedy in 200 of 200 runs. Model perplexity of its own temperature-1 runs from 'pylon': 1.873; of the generator's runs: 1.921.
Does not prove: That any setting is best for large models or human text.
Fan, Lewis and Dauphin 2018, Hierarchical Neural Story Generation. Fan, A., Lewis, M., Dauphin, Y. (2018). Hierarchical Neural Story Generation. ACL 2018. arXiv:1805.04833. https://arxiv.org/abs/1805.04833
Used for: Stories are generated by sampling from the k = 10 most likely words (top-k sampling); beam search tends to produce common, repetitive phrases.
Does not prove: Anything about this model.
Holtzman and others 2020, The Curious Case of Neural Text Degeneration. Holtzman, A., Buys, J., Du, L., Forbes, M., Choi, Y. (2020). The Curious Case of Neural Text Degeneration. ICLR 2020. arXiv:1904.09751. https://arxiv.org/abs/1904.09751
Used for: Nucleus (top-p) sampling samples from the smallest set of most likely words whose total probability reaches p. Maximization-based decoding such as greedy and beam search produces repetitive text; pure sampling from the full distribution produces incoherent text through the unreliable low-probability tail.
Does not prove: Anything about this model.
What this lesson leaves out
One small model and a 46-word grammar: a setting that does well here is not shown to do well on open-ended text, and the papers' main findings are about large models.
Following the rules is a strict check, but not the only one that matters: a run can follow every rule and still say nothing new.
Before this: Next-word prediction (L9). Next: evaluating a language model (L16), planned.