1Label the sentiment.2Love it. -> positive3Broke fast. -> negative4Died in a day. ->systemuserassistant12345678CONTEXT WINDOWLLMWEB PAGEtemperature1.0negativepositivebadThetaskex +ex −reviewstepstepstepneg!
Slate tray: the context window, eight token slotsRose block: the language model · cells in front: next-token oddsChips: tokens · violet task, khaki examples, mint review, sand reasoning, salmon injectedAt the back, the prompt card (an instruction, two worked examples and the review) and the three chat roles. In the middle, the context window feeds the language model; in front, the odds it gives four candidate next tokens, and the temperature that reshapes them. Line chips hop into the window; adding examples changes the odds; the picked token hops back into the window and the model runs again. Reasoning chips fill the window before the answer, and a chip from a web page shows how injected text gets in. The four token scores are illustrative, picked by hand; a real model scores tens of thousands of tokens. The softmax and temperature maths applied to them is exact.

Prompt and context

  1. A prompt is the text you give a language model. The model does not run it like code: it predicts what text comes next, one token (a word or piece of a word) at a time. Our task: label a review's sentiment.

Asking the model

Choosing tokens

Prompting in practice

What happens

;; step 1/9 · prompt
a language model only ever does one thing:
  given text, score every possible next token

the prompt is the text we start it with:
  Label the sentiment.
  Died in a day. ->
prompting = writing text whose likely continuation
            is the answer we want

The four token scores are illustrative, picked by hand; a real model scores tens of thousands of tokens. The softmax and temperature maths applied to them is exact. GPT-3 used a 2,048-token context window (Brown et al. 2020). Newer models allow far longer windows, but there is always a limit, and the model keeps no memory between calls.