Model foundations · about 15 minutes of study

Tokens

A tokenizer breaks text into pieces that a model can represent as numeric IDs. A piece can be a whole word, part of a word, punctuation or bytes.

Before you start: Start here; familiarity with text and basic arithmetic is enough.

Guided concept walkthrough

Follow the mechanism

Text

Start with the exact Unicode input.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

Think of packing a sentence into numbered building blocks. Different sets of blocks can pack the same sentence differently. Counting words does not tell you how many blocks you need.

See a concrete example

If a hypothetical request uses 1,200 input tokens and reserves 300 output tokens, budget at least 1,500 tokens plus any additional framing. These are given counts, not a word-to-token estimate.

A claim to question

One English word is not always one token, and Hindi words do not have a fixed token count.

Try before revealing the answer

Compare a sentence, its Hindi translation and a JSON object in the token counter. Record the encoding and exact strings.

Show the worked answer

Keep the meaning and encoding fixed when comparing edits. Verify the actual token count; shorter character length can still produce more tokens.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Tokenizers documentation

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.