From words to ready-made LLM tokens
Explore how a tokenizer turns a phrase into a sequence of IDs for a language model.
A pretrained language model reads tokens. Its tokenizer splits text into pieces and assigns each piece an ID from its vocabulary. Token boundaries and the meanings of IDs can differ between models.
A small example
Imagine a toy vocabulary containing “walk”, “ing” and “ed”. It can represent both “walking” and “walked” without storing either complete word. These are invented token boundaries. To find how a real model reads the words, run them through that model’s own tokenizer.
What does a token ID mean?
Give “walk” the ID 8, “ing” the ID 2 and “ed” the ID 5 in our toy vocabulary. Then “walking” becomes [8, 2] and “walked” becomes [8, 5]. Using that same vocabulary you can turn [8, 5] back into “walked”.
Now suppose a different vocabulary has “walk” at 8 but “ing” at 5. The same pair of numbers gives a different ending. This is why you keep a model with its own tokenizer. Two sequences of equal length can stand for entirely different text.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Now build your own version
Prepare prompt and answer tokens for LLM training with the correct target mask.
What practice includes and how much it costs
MCP includes the full lesson and a local project with starter files. Work through the task with your agent, ask for a hint and run the checks on your computer.
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress