Type “A good location for a romantic honeymoon is…” and a language model must decide what comes next. Next-token prediction is the training task of guessing the next token—a unit of text—from the words that precede it. During training, the model makes many such guesses and adjusts its weights when the correct token differs from its prediction. section 2.3
For text generation, the model cannot look ahead at words that have not yet been written. This is called autoregressive prediction: each new prediction depends on what came before. A bidirectional model instead uses words on both sides of a missing token. In “They flew to _____ and had dinner in front of the Eiffel Tower,” the later words make “Paris” easier to infer. That approach helps with understanding context, but it differs from generating a continuation. section 2.3
Next-token prediction serves both pretraining and supervised fine-tuning. In fine-tuning, curated examples of prompts and desired responses steer the same prediction task toward particular outputs, such as following instructions, rather than merely producing coherent text. section 2.9
A plausible answer to an impossible question
Asked when the Golden Gate Bridge was transported across Egypt, GPT-3 gave a confident date instead of challenging the premise. Predicting a plausible continuation can produce an answer-shaped response even when the question describes something that never happened. Next-token prediction helps explain this risk; a fluent completion is not, by itself, evidence that a claim is true. section 5.7
Figure 5.9 The probabilities produced by an LLM in predicting the next token in a sentence
A figure shows probabilities produced while an LLM predicts the next token in a sentence. section 5.7








