1The idea
A language model writes one token at a time. At each step it ranks every possible next word, and plain decoding takes the top one, or samples from the top few. Everything the model knows has to pass through that ranking.
I wanted to know how often the ranking is wrong in a way that can be fixed. If the right word is in the model's top 8 but not first, a second model that can only choose from those 8 should be able to fix it, without writing anything itself.
The picker is Jev, TypeSafe's fast classification model. It takes some text and a list of options and returns one of the options. I gave it the text so far and GPT-2's candidates. The writer is GPT-2 XL: 1.5 billion parameters, from 2019, small enough to run on my laptop. Neither model was trained or fine-tuned for this.
2Facts: the clear win
CounterFact [2] is a set of simple fact prompts like “Beylerbeyi Palace can be found in”. I took 500 of them and looked only at the next word.
- GPT-2 XL's top word
- Jev's pick from GPT-2's top 8
GPT-2's top word
Jev picks from the top 8
Jev, only when the gate fires
correct next word, 500 facts
GPT-2's top word was right 9.8% of the time. With Jev picking from the same top 8, it was right 23.0% of the time. On the 142 prompts where the answer was in the list at all, GPT-2 got 49 and Jev got 115. Jev fixed 69 and broke 3.
The fixes are the interesting part. 52 of the 69 look like this:
| Prompt | GPT-2 said | Jev picked |
|---|---|---|
| Beylerbeyi Palace can be found in | the | Istanbul |
| Unus pro omnibus, omnes pro uno is written in | the | Latin |
| John Landy holds a citizenship from | the | Australia |
| Virtual Hard Disk was created by | the | Microsoft |
| Pacific Jazz Records is known for performing | the | jazz |
GPT-2 was not missing the fact. “The” is a safe way to continue almost any sentence, so it wins the ranking, and the answer sits a few places behind it. Asked to choose, Jev takes the answer.
The other 17 fixes were real corrections. Haakon Lie died in Oslo, not Krakow. The Eiger is in Europe, not Africa. Google Checkout was made by Google, not Amazon.
The three it broke are worth a look too. Jev said Marco Di Vaio is a professional “footballer” (the answer key says “soccer”), and that the Chevrolet Van is made by “GM” (the key says “Chevrolet”). Both are arguably right. In the third, it continued “CBS This Morning is to debut on” with “Monday” instead of “CBS”. Exact matching counts all three as wrong.
3Writing: a failure and a half
A fact is one word. Writing is hundreds. For this I used the open-ended generation benchmark from Su and Xu [1]: 100 WikiText-103 prompts of 32 tokens, 256 new tokens each. It scores diversity, MAUVE (how close the text is to human writing [3]) and coherence with the prompt. Higher is better on all three. Each Jev method has a control that picks at random from the same candidates, so any difference comes from the picking.
Word by word, it does not work. Jev steps in when GPT-2 looks unsure (section 4 has the exact rule) and picks from the top 8 words. It is worse than the random control on all three metrics. The reason is visible in the text: Jev loves full stops. Its text has 47.5 full stops per 100 words. The control has 6.0.
The ship's secondary armament consisted of fourteen 45-calibre 6-inch (152 mm) quick-firing (
Jev picks each word
6-pounder) guns. The ship carried a total of 1,000 rounds of ammunition.
The ship carried a total of 1,000 rounds.
The ship carried a total of 1.
The ship carried a .
The ship carried .
.
. .
. . .
Random pick from the same words
6-pounder) guns, each of which could fire a total of 1,000 rounds per minute. The ship's main armament consisted of a total of eight 6-pounder guns, each of which could fire a maximum of 1,000 rounds per minute. The main armament of the ship was also capable of firing a total of 1,000 rounds per minute. The crew of the ship was made up of 1,200 men.
My guess, which I have not tested, is that ending the sentence is always a defensible choice. A picker judging one word at a time keeps taking the safe one, and each new sentence gives it another chance to.
Sentence by sentence, it partly works. Here GPT-2 samples 6 candidate sentences and Jev picks one, which gives it a whole thought to judge. Jev's text is more coherent than a random pick from the same 6, on 78 of 100 prompts. But it scores lower on MAUVE than that random pick, and it is behind contrastive search on every metric.
| Method | Diversity | MAUVE | Coherence |
|---|---|---|---|
| nucleus sampling (top-p 0.95) | 92.78 | 98.60 | -2.961 |
| contrastive search | 93.60 | 94.59 | -1.576 |
| Jev picks sentences | 92.10 | 91.52 | -2.666 |
| random pick, same 6 sentences | 93.53 | 96.86 | -3.049 |
| Jev picks words | 15.41 | 32.53 | -1.191 |
| random pick, same 8 words | 36.32 | 74.86 | -1.112 |
Table 1. 100 WikiText-103 prompts, seed 0. Every row is scored the same way on the same prompts, so compare rows with each other. Coherence rewards text that stays close to the prompt, which is why repetitive text scores well on it, so read it next to diversity. The full table, with greedy decoding and a GPT-2 self-ranking control, is in the repo.
4The gate threw the gain away
Calling Jev on every word of a 256-token text would be slow, so the word method only calls it when GPT-2 looks unsure: its top word has under 40% probability, or its top two are within 15 points, and its top 8 words hold at least 70% of the probability. That last condition was meant to skip the steps where GPT-2 has no idea, on the theory that the answer is probably not in the top 8 there anyway. (It also steps in when GPT-2 is about to repeat a 4-token phrase.)
I ran the facts through the same gate. It threw away the entire gain: 9.6% correct, a little below GPT-2 on its own.
- GPT-2 XL's top word
- Jev's pick from GPT-2's top 8
Confident
110 prompts
Unsure, probability spread out
362 prompts
Unsure, probability concentrated
28 prompts, the only ones where the gate calls Jev
prompts answered correctly
The theory was wrong. The answer was in the top 8 on 29% of the prompts where GPT-2's probability was spread out, the same rate as on the confident ones. The group the gate picked had the lowest rate: 5 of 28. Most of Jev's fixes, 56 of 69, came from the group the gate skips, and 12 more came where GPT-2 was confident and wrong.
5What I take from it
Knowing a fact and ranking it first are different things. In GPT-2 XL they come apart often enough that a model which never writes a word fixed 69 of the 93 misses it could have fixed, with no training for the task.
A picker needs something to judge. One word in the middle of a sentence is too little: Jev took the safe option and the text collapsed. A whole fact or a whole sentence is enough to choose well.
Looking unsure is the wrong trigger. I assumed GPT-2 is wrong when it looks unsure in a particular way. On facts, its fixable mistakes looked like everything else. Deciding when to ask for help is its own problem, and the obvious rule fails it.
The whole run cost under a dollar in Jev calls.
6Limits
- One writer (GPT-2 XL), one picker, one seed, and 100 writing prompts.
- MAUVE is usually reported on more samples. These scores are on 100 prompts, so compare them with each other, not with the paper's numbers.
- Facts are scored by exact match on one word, which is strict, as the three breaks show.
- Jev is an API, so I can only describe what it does, not why.
References
- [1]Yixuan Su and Jialu Xu. An Empirical Study On Contrastive Search And Contrastive Decoding For Open-ended Text Generation. 2022. arXiv:2211.10797
- [2]Kevin Meng, David Bau, Alex Andonian and Yonatan Belinkov. Locating and Editing Factual Associations in GPT. NeurIPS 2022. arXiv:2202.05262
- [3]Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi and Zaid Harchaoui. MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontiers. NeurIPS 2021. arXiv:2102.01454
- [4]Code, data, logs and every generation from this run: github.com/CodeGeek04/jevgpt