Loading slide

Tokens

  1. 01Tokens
  2. 02Memory card
  3. 03The model can't read
  4. 04Not words. Tokens.
  5. 05The emoji trick
  6. 06Try it yourself
  7. 07How many r's in strawberry?
  8. 08What the model actually sees
  9. 09Some languages cost more
  10. 10Why "cat" and " cat" differ
  11. 11Why not millions of tokens?
  12. 12So why not just use bytes?
  13. 13Context windows are measured in tokens
  14. 14Reinforce your understanding
  15. 15Question: Why not just use words?
  16. 16Question: Weird splits
  17. 17Quiz: answer
  18. 18What to carry out of this chapter
  19. 19Want to go deeper?
6 / 18
BackNext

Try it yourself

This is the real thing: a tokenizer used by real language models, running in your browser. Type anything.

Try your own name. Try "strawberry" and watch it come apart into pieces that have nothing to do with how the word sounds. Invent a word on the spot: the tokenizer has never seen it, but it copes, spelling it out of smaller pieces it does know. Then try a sentence in another language and count how many more tokens it takes.

Keep one eye on the numbers under each piece. The colored chunks are drawn for you. The model gets only the row of IDs.

Citations(2)↓
  1. 1. huggingface.co
  2. 2. github.com
Citations(2)↓
  1. 1. huggingface.co
  2. 2. github.com