Skip to main content

The Lab · Learn

How AI actually works

Small pages that run on this device. Read the plain version, move the sliders, watch what changes, then say what you saw. Tap any word you do not know.

Lesson 5

Picking the next token

AI writes one chunk at a time by guessing what comes next, with a dial for how safe or adventurous each guess is.

It is like
Like finishing someone’s sentence. Play it safe and you say the obvious word; loosen up and you might say something surprising.
Why it matters at work
This is why the same question can get different answers. For facts and forms, safe is better; for brainstorming, looser helps.
The exact idea

A model scores every possible next token, softmax turns scores into chances, and temperature and top-k shape the draw.

Words on this page

Try this

  1. Set temperature to 0.2 and press Draw 20. Nearly every draw is “mat”.
  2. Set temperature to 2 and draw 20 again. Unlikely words like “moon” start to turn up.
  3. Keep temperature at 2 and set top-k to 2. Only the two best candidates can be drawn.

Change it

In the Workshop, press Pick a part, then tap the temperature slider and ask for it to go up to 5, then draw 20 and see what breaks.

Now with a real model

Same dial, real AI

The page above uses eight made-up words. Type the start of a sentence and a real model (Gemini) finishes it six times: three with temperature low, three with it high.

What happens to the chances when you raise the temperature, and what does that do to the text?

Pick the one that fits what you saw.

Field notes

Reading the notes.