Deutsch

A tokenizer is the component that splits text into tokens and assigns each token a numeric ID from a fixed vocabulary. A language model can only process these numbers. In SEO and GEO, the term mostly comes up around context limits and the cost of AI applications.

How does a tokenizer work?

The Hugging Face course names three basic approaches. Word-based tokenizers split at word boundaries and need a very large vocabulary, and they treat “dog” and “dogs” as unrelated. Character-based tokenizers need a small vocabulary but produce many tokens per word. Subword methods keep frequent words whole and split rare ones into meaningful parts, for example “annoyingly” into “annoying” and “ly”. Current language models mostly use subword methods such as byte-pair encoding (BPE), WordPiece or SentencePiece. Microsoft notes that GPT models use BPE.

A tokenizer works in two directions. Encoding turns text into token IDs, and decoding turns IDs back into text. Libraries also offer functions for counting tokens and for adding special tokens such as a padding token.

Why does it matter for AI visibility?

Every model brings its own tokenizer, so the same page can produce a different token count depending on the model. OpenAI gives a rough guide of 4 characters or 0.75 words per token for English text. Because prompt and output together must fit the context window, the token count decides how much of a document a model can see at once.

Example

Take the English sentence “Text tokenization is the process of splitting a string into a list of tokens.” It has 14 words. A subword tokenizer keeps frequent words such as “the” and “of” as single tokens and may split “tokenization” into two pieces. Punctuation counts as well. The exact count depends on the model.

FAQ

What is a tokenizer? A program that converts text into tokens and token IDs, and back again.

How much text is 1,000 tokens? Roughly 750 English words, going by OpenAI’s rule of thumb. The real number depends on language and model.

Sources

  1. Tokenizers - Hugging Face LLM Course, chapter 2huggingface.co
  2. Tokenizer - Hugging Face Transformers documentationhuggingface.co
  3. Understanding tokens - Microsoft Learn (.NET)learn.microsoft.com
  4. Key concepts: tokens - OpenAI Docsdevelopers.openai.com

Last updated: