Loading...

Build your own Tokenizer

Learn about byte-pair encoding, UTF-8, and more

COMING SOON

This is a preview of a CodeCrafters challenge that is launching soon.

Follow us on Twitter to be notified when this challenge is available.

Why do language models miscount the r's in "strawberry"? GPT-2 never sees the letters. Its tokenizer hands it three pieces: st, raw, and berry. A tokenizer is the program that splits text into pieces like these before a model reads it. In this challenge, you'll build one that splits text exactly like GPT-2's.

Along the way, you'll learn about byte-pair encoding, UTF-8, and more.

What exactly will I build?
What exactly will I learn?
Why should I build such a project?
What are the prerequisites for this challenge?

Stages

UTF-8 bytes
Login via GitHub to view this stage
Most frequent pair
Login via GitHub to view this stage
Merge a pair
Login via GitHub to view this stage
Learn merges
Login via GitHub to view this stage
Encode
Login via GitHub to view this stage
Decode
Login via GitHub to view this stage
Split like GPT-2
Login via GitHub to view this stage
Match GPT-2
Login via GitHub to view this stage