Skip to content
Book a conversation

Tokenization

Understand how tokenization converts text into processing units and what to check when preparing documents for a language model.

Luiz GardelinUpdated Read in Markdown
All terms

A conversation about your organization.

Before recommending any tool, we talk with your teams and map how the work really happens.

Arrange a conversation
On this pageIntroduction

Also used as: text tokenization.

Tokenization is the process of converting a sequence of data into units called tokens. A tokenizer is the system or algorithm that performs this conversion. For text, segmentation may use words, characters, or parts of words. Tokenization prepares a representation for the model to process; it is not, by itself, a complete interpretation of the content. Sources: Google, tokenizer and token.

The process differs from its result

A token is a resulting unit; tokenization is the operation that organizes a sequence into those units. Confusing the two makes it harder to explain why a text has a particular count. Counting visible words is insufficient because a strategy may split a word into parts or work with smaller units.

The glossary describes more than one possible strategy. A division used to illustrate the concept should therefore not be presented as the output of a particular tokenizer. If a team needs to know how a model will process a document, it must check the corresponding tokenizer rather than reuse an estimate made for another system. Source: Google, types of token.

Hypothetical document preparation example

A knowledge team has assembled technical descriptions, abbreviations, and material codes in a manual. Before using the text in a model request, the team wants to count the full input, including the manual, question, and instructions.

The team could test the actual input with the specified tokenizer and check the rules for the context window. For example, OpenAI's documented reasoning models require room for generation, including reasoning tokens. Source: OpenAI, reasoning models. If the planned use exceeds the limits, the team would need to select passages or reorganize the request. Shortening everything indiscriminately may remove information needed for review.

Tokenization should not be confused with data protection. Converting text into processing units does not, by definition, authorize its use or remove sensitive information. Decisions about which data may be sent belong before the request. In the working process, it helps to separate three choices: which information is permitted, which is relevant, and how it will be represented for the model.

Sources

  1. Machine Learning Glossary: Tokenizer Google for Developers

    Text tokenization alone does not determine context-window use. Reserving room for generation and reasoning follows the documented OpenAI example without generalizing to other interfaces.

  2. Machine Learning Glossary: Token Google for Developers
  3. OpenAI: Reasoning models OpenAI

    Scope: reasoning models documented by OpenAI. Reasoning tokens occupy the window and room must remain for generation; this accounting is not a universal rule.

Written by

Luiz Gardelin

Founder and lead consultant at The Company Brain

Luiz Gardelin is the founder and lead consultant at The Company Brain, an AI organizational transformation consultancy based in Brazil. He also founded Webinhood and Tropk.ai.

See all content by this author

A conversation about your organization.

Before recommending any tool, we talk with your teams and map how the work really happens.

Arrange a conversation

Related terms

Continue reading

All resources