Skip to lesson
How AI Works , back to the course page

One word at a time

The loop a model runs to write every reply.

Module 1, lesson 2 of 4 · 10 min

Key terms: Large language model (LLM) A model that writes text one token at a time by predicting what comes next., Token A piece of text, often a word or part of one, that a model reads and writes.

We gave Claude Haiku 5.5 a file of 40 customer messages from Pinewick, a coffee company we made up for this course, and asked for a summary. In all three recordings, the reply stopped partway through. The video follows one of them to show how a chat model writes: one Token A piece of text, often a word or part of one, that a model reads and writes. at a time. A token is a short piece of text, like a word, part of a word or a punctuation mark.

Video: One word at a time
Video, 1 min 38 s
Read the transcript

Here's everything Claude Haiku 5.5 was given in one of our recordings. First, two sentences of instructions from the app. Then a file with forty customer messages, which we made up. Last, the request: summarize this feedback.

Its reply was eight hundred tokens long. A token is a short piece of text: a word, part of a word, or a punctuation mark.

It wrote them one at a time, in a loop. Here's one real round, recorded from another model, GPT-4.1 mini, asked to copy this sentence and continue it.

First, it reads all the text so far. Then it scores every possible next token, giving each one its odds of coming next.

One token is picked, usually a likely one, and added to the end. Now the text is one token longer, so it all runs again with that token in it.

Claude Haiku 5.5 went round that loop eight hundred times to write the summary, in about four seconds. Each pick could draw on everything before it: the instructions, all forty messages, the request, and the summary so far. It stopped in the middle of a list, because eight hundred tokens was the limit we set.

Each round picks a likely next token, and nothing in the loop makes sure a count was checked. Under shipping, the summary says roughly thirteen messages, then cites ten different ones. Before you repeat a number like that, check it against the messages.

Step 1 of 6 One word at a time