Token
Abstract
Token — the smallest unit of text that a language model works with. One token is roughly ¾ of an English word or 1–2 characters in Russian.
Why Models Don't Work with 'Letters'
LLM doesn't read text letter by letter. Instead, text is broken into tokens — pieces that can be part of a word, a whole word, or even a punctuation mark. For example, the word 'hello' might be one token, while a longer word such as 'tokenization' might be two.
Tokenization is necessary for the model to work with text as numbers: each token has its own numerical ID in the model's dictionary. Only after this can the math 'see' the text.
Example
| Text | Tokens (approximately) |
|---|---|
| 'Hello' | 1 token |
| 'hello, how are you?' | 4–5 tokens |
| English word | ≈ 0.75–1 token |
| Russian word | ≈ 1–2 tokens |
The Russian language is 'more expensive' in tokens than English because Cyrillic words are generally longer, and tokenizers trained primarily on English tend to break them into more pieces.
Why Know About Tokens
- Model context window is measured in tokens. Knowing how many tokens a text takes up can help estimate if it will fit in the context.
- API cost depends on the number of tokens: you pay for each processed token on input and output.
- Service limits (such as DeepSeek) are also expressed in tokens.