1.2 Module 1 · AI Foundations & Mental Models

How Large Language Models Work

Type any sentence and watch it get broken into tokens. Then simulate how an LLM predicts the next word in a sequence.

Token Visualiser Next-Token Predictor OpenAI Tokenizer

Token Visualiser

Type or paste any text below. The visualiser will approximate how an LLM tokeniser breaks it into tokens — the fundamental units the model processes.

Tokens: 0 Characters: 0

Click "Tokenise" to see the breakdown

Common words
Subwords
Punctuation
Numbers

Why this matters: Every token costs money and uses up your context window. A 1,000-word document might be 1,300 tokens. Understanding tokenisation helps you write more efficient prompts and estimate costs.

Next-Token Predictor

See how an LLM decides what word comes next. Choose a sentence starter and watch the probability distribution — then pick the next token yourself to build a sentence.

Step 0

Key insight: A real LLM has hundreds of billions of parameters and considers ~100,000 possible tokens at each step. This simplified version shows the principle: pick the most likely next word, then repeat. That's the entire mechanism.

Explore Further