- What is a token?
- How tokenization works
- Why subword tokenization became standard
- Why tokenization affects cost
- Why tokenization affects model behavior
- Tokens become outputs
- Final takeaway
Before a large language model can generate anything useful, it has to do something much simpler first: break your text apart.
That process is called tokenization, and it’s one of the most important — and most overlooked — parts of how modern AI systems work.
Most people think models read words. They don’t.
They read tokens: small chunks of text that can represent full words, parts of words, punctuation, spaces, or even individual symbols. Those tokens are then converted into numerical IDs that the model can process internally.
Understanding tokenization helps explain a lot of things:
- why prompts cost money
- why context windows have limits
- why some languages are more expensive than others
- why models sometimes behave in strange ways
Tokenization sits at the very start of the AI pipeline — and it quietly shapes everything that comes after.
What is a token?
A token is the smallest unit of text a model works with.
It is not always the same as a word.
For example:
| Text | Possible token split |
| hello | hello |
| tokenization | token + ization |
| unbelievable | un + believ + able |
| 2026! | 202 + 6 + ! |
This matters because models count tokens, not words.
A short-looking sentence may use more tokens than expected, especially with uncommon words, code, emojis, or non-English languages.
How tokenization works
At a high level, tokenization follows a simple pipeline.
Step 1: Split the text
The tokenizer breaks raw text into chunks based on its vocabulary rules.
Modern LLMs usually rely on subword tokenization, not full-word tokenization.
This gives them flexibility to handle:
- rare words
- typos
- names
- multilingual input
- code
Step 2: Convert tokens into IDs
Each token maps to a number inside the model’s vocabulary.
Example:
| Token | Token ID |
| The | 791 |
| model | 4382 |
| works | 2921 |
The model never “sees” the text directly. It only sees these numeric representations.
That’s the bridge between human language and neural computation.
Step 3: Convert IDs into embeddings
After token IDs are created, they’re transformed into vector embeddings.
This is where meaning starts to emerge.
At this point:
- similar tokens can occupy nearby positions in vector space
- relationships between concepts become measurable
- context starts to matter
Tokenization gets the data into the system. Embeddings make it interpretable.
Why subword tokenization became standard
Older NLP systems often split text by words.
That worked — until they hit words they had never seen before.
Modern LLMs usually use methods like Byte Pair Encoding (BPE) or similar subword strategies.
BPE works by repeatedly merging frequent character patterns into reusable units. This improves compression and vocabulary efficiency.
Why subword models are better
| Method | Main problem |
| Word-level | Too many unknown words |
| Character-level | Too slow, too long |
| Subword-level | Best balance of flexibility and efficiency |
This is why most modern models use some version of subword tokenization.
Why tokenization affects cost
This is where tokenization becomes practical.
Most AI APIs bill based on:
- input tokens
- output tokens
That means tokenization directly affects price.
For example:
| Input type | Approximate token density |
| Simple English | Low |
| Code | Medium–high |
| Legal text | High |
| Chinese/Japanese | Often higher |
| Emoji-heavy text | Surprisingly high |
Two prompts with the same character count can have very different token counts.
This is one of the most common hidden cost drivers in production AI systems.
Why tokenization affects model behavior
Tokenization also explains many “weird” model behaviors.
For example:
- why models struggle with letter counting
- why rare words behave unpredictably
- why formatting changes can affect outputs
- why prompt order matters
A model doesn’t think in letters or grammar the way humans do. It predicts token sequences.
That difference creates many of the quirks users notice.
Community discussions often point to token structure as one reason models fail at character-level reasoning.
Tokens become outputs
Once the input is tokenized:
- Tokens go into the transformer
- The model predicts the next token
- That token gets appended
- The process repeats
This continues until:
- a stop token appears
- the token limit is reached
- the system interrupts generation
This means AI generation is fundamentally a token-by-token prediction loop, not sentence-level reasoning.
Final takeaway
Tokenization looks like a small technical detail, but it shapes almost everything in modern LLM systems.
It affects:
- cost
- speed
- context limits
- multilingual performance
- model behavior
- output quality
If you’re building with AI, understanding tokenization gives you a much better intuition for why systems behave the way they do.
Before there are embeddings, transformers, or outputs — there are tokens.
And everything starts there.cab usage and token counts match your cost and quality goals. The payoff is fewer weird completions, lower bills, and a model that actually understands the way your users write.
