Now that we understand that LLMs operate on patterns in text, let’s look at the most fundamental unit they work with. They don’t see words or letters as we do; they see ‘tokens’. Understanding this concept is the next step to mastering how to communicate with them effectively.


What Are Tokens?

Tokens are the smallest units of the text that an AI model processes. They’re not always whole words - they can be:

For example, the sentence “Hello, world!” might be tokenized as: [“Hello”, “,”, “world”, “!”] - that’s 4 tokens.

Why Are Tokens Integral to LLMs?

Tokens are crucial because:

  1. Computational Efficiency: Models work with numbers, not text. Each token maps to a numerical ID that the model can process mathematically.
  2. Vocabulary Management: Instead of trying to handle every possible word combination, models work with a fixed vocabulary of tokens (typically 50,000-100,000+ tokens).
  3. Handling Unknown Words: By breaking words into subword pieces, models can understand new or rare words by recognizing familiar components.
  4. Consistent Processing: Every piece of text gets converted to the same numerical format, allowing consistent mathematical operations.

The Tokenization Process

  1. Raw text → Tokenizer → Token IDs → Model processing
  2. Models learn relationships between these token IDs during training
  3. Output token IDs → Detokenizer → Human-readable text