How Language Models Work

Lesson 01

Next-token prediction

It guesses the next word. Then it does it again. That’s the whole trick.

An AI does not look up answers. It reads the words in front of it, guesses the next small chunk of text, adds that chunk, and guesses again. Every AI answer you have ever read was built that way, one guess at a time. Below, you get to make the guesses.

A crane folded from crimson paper, wings open, caught mid-stroke.
One fold at a time, and not one of them undone. The bird exists only because every crease was made in order — which is exactly how the answer gets written.

1Pick a sentence to finish

Your turnIn step 3 below, tap any row to add that word to the sentence. Then try one of the unlikely ones and watch where the sentence ends up.

2The sentence so far (this is everything the model has to work with)

3Its five best guesses for the next word (the bar shows how likely each one is)

4How big a risk it takes (slide it and watch the bars in step 3 move)

Engineers call this dial temperature. Slide it and watch the bars in step 3 change: low means it almost always takes the top guess, high means the long shots get a real chance.