Tokenization
The process of converting raw text into tokens—the smallest units an AI model processes. Tokenizers split words, subwords, and punctuation into integer IDs that the model understands. Tokenization determines how much text fits in a context window, how much inference costs (pricing is per-token), and can affect multilingual performance since non-English languages often require more tokens per word. Understanding tokenization helps teams estimate operating costs and optimize prompt length for their agents.
Example
The sentence 'AI agents automate workflows' tokenizes to roughly 5 tokens in most models. A 1,000-word support article is about 1,300 tokens. At $3 per million input tokens, processing that article costs $0.004—but processing 10,000 articles daily adds up to $40/day.
Frequently asked questions
- Why do different models tokenize text differently?
- Each model family uses its own tokenizer trained on different data. GPT models use a BPE tokenizer, Claude uses its own variant, and open-source models often use SentencePiece. This means the same text produces different token counts across models—which affects cost comparisons and context window utilization.
- Does tokenization affect non-English languages?
- Yes, significantly. Most tokenizers are trained primarily on English text, so English words map efficiently to tokens. Languages like Chinese, Japanese, Korean, Arabic, and Hindi often require 2-4x more tokens per word, increasing both cost and context consumption. Some newer models have improved multilingual tokenization.