ContentsThe library

How a Model Picks Its Next Word

Throwing Away the Worst Options

Last timeOne Knob on the Scores

The tail of the distribution holds almost no probability and almost every token. Sampling without removing it is the main reason generated text goes wrong, and there are two standard ways to cut.

Sampling from the model's distribution exactly as it stands sounds like the

honest thing to do. It produces noticeably worse text than sampling from a

truncated version, and the reason is a matter of arithmetic rather than taste.

The tail is visited more often than it looks

Suppose the bottom of the distribution holds eight percent of the mass, spread

across fifty thousand tokens that would each be wrong here. Each step, the

chance of drawing one of them is small. Over a paragraph, it is not.

FIG 1The chance of drawing from the tail at least once
0.000.300.600.901.201.050.8100.5150.3200.0tokens sampled
an eight percent taila two percent tail
After a hundred tokens the upper curve is above 0.999 and even the lower one is near 0.87. A tail that is negligible per step is a near certainty per paragraph, and one visit is usually enough to send the rest of the passage somewhere strange.

Note what makes this bad rather than merely random. The token drawn is not a

reasonable alternative that happened to be less likely. It is one of fifty

thousand tokens the model placed at the very bottom, so the text now contains

something the model itself considered close to impossible, and every subsequent

step is conditioned on it.

The lesson stops here

5 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01The Model Does Not Write Anything
  2. 02Two Different Questionsopening only
  3. 03What a Beam Keeps, and What It Costsopening only
  4. 04What Temperature Actually Doesopening only
  5. 05Throwing Away the Worst Optionsyou are here
  6. 06The Loop Is the Most Probable Continuationopening only
  7. 07Making the Output Fit a Formatopening only
  8. 08Guessing Ahead Without Changing the Answeropening only

Read alongside