What is a token?

The notes

1. The basic unit of text

The smallest piece of text an AI model can process. It can be a word, part of a word, or punctuation.

Example

  • "Hello, world!" becomes the tokens [Hello], [,], [ world], [!]

2. Not just whole words

Often splits complex or rare words into sub-word units (sub-tokens) for better understanding.

Example

  • "unbelievable" becomes [un], [believ], [able]

3. Mapped to numbers (IDs)

AI models only see these numerical IDs, not the text itself. Each unique token has a unique ID.

Example

  • [Hello] is ID 345
  • [,] is ID 12
  • [ world] is ID 890
  • [!] is ID 5

4. Building blocks of meaning

The sequence of tokens (IDs) allows the LLM to grasp context and generate coherent responses.

Flow

  • Token IDs go into LLM processing, which produces context and understanding

Key takeaway. The sequence of tokens (IDs) allows the LLM to grasp context and generate coherent responses.

AI fundamentals deck

  1. 1. How an LLM is made
  2. 2. What is a token?

and many more

Watch the lesson

Smarter with AI, Lesson 9, from 4:01: What is a token?