← Tokens, Context & Inference
03 · Tokens, Context & Inference · Topic 01

What is a Token?

A token is a small unit of text that an AI model reads and processes.

What is it?

A token is a small unit of text processed by a language model.

A token may be a whole word, part of a word, punctuation mark, number, or another text unit depending on the tokenizer.

AI models process tokens rather than reading text exactly the way humans see words and sentences.

Think of it like...

Think of a sentence like a LEGO model.

Before the model can work with it, the sentence is broken into smaller LEGO pieces.

Those pieces are tokens.

Token ≠ Word. One word may be one token, or it may become multiple tokens.

A sentence represented as LEGO pieces
Tokens are the pieces a model works with.

How it works

1 · TextTextA user enters text.
2 · TokenizerTokenizerThe tokenizer splits the text into model-readable units.
3 · TokensTokensThe text becomes tokens.
4 · Token IDsToken IDsEach token is represented by a number.
5 · ModelModel processingThe model processes these token representations.
6 · OutputGenerated tokensGenerated tokens are converted back to text.
Text → Tokenizer → Tokens → Token IDs → Model processing → Generated tokens → Text

Real-world examples

Example 1 · English

Text: “Artificial intelligence”

It may be split into one or several tokens depending on the tokenizer.

Example 2 · Long words

A long or uncommon word may be split into several tokens.

Example 3 · Chinese

Chinese text is also tokenized, but token boundaries do not necessarily match English-style words.

What it is NOT

Token ≠ Word

Token: A unit chosen by a tokenizer.

Word: A human language unit.

One word may become one or several tokens.

Token ≠ Character

Token: May contain one or more characters.

Character: A single written symbol.

Token ≠ Parameter

Token: Input/output unit processed by the model.

Parameter: A learned numerical value inside the model.

Remember this

AI models process tokens, not text exactly the way humans see words.

Independent explainer

Video

visual explainer

A short visual explanation of tokens.

↑