ContentsThe library

How a Model Picks Its Next Word

Two Different Questions

Last timeWhat the Model Actually Hands You

Taking the best token at every step answers one question, and finding the best sequence answers another. They have different answers, and the gap between them is where search algorithms live.

There are two questions that sound like the same question. Which token is most

likely here, and which continuation is most likely overall. Answering the first

one repeatedly does not answer the second.

A case where greedy loses

Take two tokens available at the first step, and look at what each makes

possible at the second.

FIG 1A two-step choice where the better first token is the worse one
Nothing unusual is happening here. A is a common word that could be followed by many things, and B is a rarer word that commits to a phrase. The model knows this, and greedy has no way to ask.
FIG 2The two paths, scored
stepfirst stepsecond stepprobability of the pairwhat happened
10.60.30.18What greedy produces. It wins the first step and loses the product.
20.40.80.32The better sequence, which greedy never sees, because it discarded B before the second step existed.
2 steps
The gap is a factor of 1.8 on a two-token decision. Over a sentence the same effect compounds, and there is no bound on how far apart the greedy sequence and the best sequence can be.

The condition for greedy to be right at this step is simple enough to write

down, and it involves a quantity greedy does not have access to.

The lesson stops here

7 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 Questionsyou are here
  3. 03What a Beam Keeps, and What It Costsopening only
  4. 04What Temperature Actually Doesopening only
  5. 05Throwing Away the Worst Optionsopening only
  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