An AI model does not read text the way you do. Before it can work with your words, the text is cut into small pieces called tokens. Each token is a piece of text, and the model reads and writes one token at a time.
Why not just use words?
Words are a good start, but they cause problems. Some words are very long. New words appear all the time. Spelling changes between languages. So the model splits text into tokens that can be a whole word, part of a word, or a single symbol.
How text is split
A tokenizer is the tool that does this split. It uses fixed rules that were set before the model was trained.
flowchart LR
A["Text: I love coffee"] --> B["Tokenizer"]
B --> C["Tokens: I, love, coffee"]
C --> D["Numbers the model reads"]
The model never sees letters the way you do. It sees the numbers that stand for each token.
Tokens and cost
Many AI services count tokens to measure how much text goes in and comes out. More tokens mean more work for the model. Short, clear text uses fewer tokens, which usually means lower cost and room for more of your text in one request.
Key points
- A token is a piece of text, not always a whole word.
- The tokenizer splits text before the model sees it.
- The model reads and writes tokens one at a time.