Token Playground

Beginner6 min

See how large language models tokenize text, assign next-token probabilities, and change sampling behavior with temperature.

In one sentence

LLMs generate text by repeatedly estimating probabilities for the next token, selecting one, appending it to the context, and repeating the process.

1 · Prompt
The capital of France is
2 · Tokenization
The capital of France is

3 · Next-token probabilities
Paris
0.91
Lyon
0.03
located
0.02
4 · Temperature
0.70
5 · Example sampled token
Paris
Probability: 0.91
Key takeaways
Tokens are building blocksModels read and write token units.
Probabilities guide choicesCandidate tokens receive different scores.
Temperature changes randomnessHigher values flatten the distribution.
Generation is iterativeThe chosen token becomes new context.
Build challenge

Choose decoding settings for structured output

Would you use the same temperature for creative copy and strict JSON? Explain the trade-off before opening the next lab.

Advanced labs →
Concept guide

How does next-token prediction work?

A large language model generates text by estimating a probability distribution over possible next tokens, selecting a token using a decoding strategy, adding the selected token to the current context, and repeating the process.

What is a token?

A token is a text unit used by the model. It can be a whole word, part of a word, punctuation, whitespace, or another fragment depending on the tokenizer.

What does temperature change?

Temperature changes the shape of the sampling distribution. Lower values concentrate probability around top candidates; higher values give lower-ranked candidates more chance to appear.

Why does this matter in engineering?

Decoding choices affect variability, deterministic behavior, structured-output reliability, and how an application balances creativity with control.

Common questions

Does an LLM choose a whole sentence at once?

No. Autoregressive language models generate incrementally, token by token.

Is a token always a word?

No. Token boundaries depend on the tokenizer and can split words or include punctuation.

Does temperature change model knowledge?

No. It changes sampling behavior, not the model weights or underlying knowledge.

Are the probabilities in this lab from a live model?

No. This MVP uses deterministic educational values so the learning experience stays stable.

AhaFrame learning note · Reviewed 2026-08-13. Interactive values are illustrative; conceptual explanations are the durable learning content.
Token prediction makes sense now.
Next: understand the finite working context around those tokens.
Continue →