What is tokenization?
The AI Glossary
In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.
Tokenization is the process of dividing information into the units a model can process. For text, these units are called tokens. A token may be a whole word, a word fragment, punctuation or another sequence of characters. The tokenizer is the software that makes those divisions and assigns numerical identifiers to the pieces.
Imagine a set of reusable letter tiles, except that some tiles contain several letters or a complete word. Common words can be represented efficiently, while unfamiliar names can be assembled from smaller pieces. Different tokenizers use different collections of pieces and different rules, so the same sentence can produce different token counts.
The numerical identifier is not a definition of the word. The model uses it to obtain a learned numerical representation, often called an embedding, that is processed by the rest of the network. Tokenization supplies the units; training determines how the model uses them.
This distinction matters when people describe a language model as reading “one word at a time.” Tokens are not necessarily words. Moreover, many transformer models can process multiple input positions in parallel, even though their responses are commonly generated one token after another. Dividing an input into pieces and processing those pieces sequentially are different things.
Tokenization affects how much text fits within the context window—the amount of information the model can use in a single interaction—and often affects cost. It does not directly determine how many actions an agent takes. One search request or file edit may involve many tokens and several model calls.
Clinical language offers a practical example. An unusual drug name, a specialist abbreviation or a sentence in a less well-represented language may require more pieces than familiar English prose. That can increase the space and processing needed without improving understanding. Test the actual terminology and languages the application will encounter. Also note that privacy teams use “tokenization” differently: replacing sensitive identifiers with substitute values. That security practice is not the text-processing method described here.
Sources: Hugging Face — Summary of the Tokenizers
To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.
AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.
For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.
Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy
Lead with AI in Health Care
The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy