Let's build the GPT Tokenizer

Andrej KarpathyLength: 2 hours 13 minutesLLMs & generative AI

In brief

Andrej Karpathy builds the GPT tokenizer from scratch, implementing byte pair encoding along with encode and decode. He shows how many odd LLM behaviors trace back to tokenization, and covers Unicode byte encodings along the way.