Stanford CS336 Language Modeling from Scratch | Spring 2026 | Lecture 1: Overview, Tokenization

Percy Liang's opening Stanford CS336 lecture explains why the course builds language models from scratch under a compute budget, then works through tokenizers: characters, bytes, words, and byte pair encoding, trained, encoded, and decoded step by step.

3 sections ยท 8 lessons

Course outline

Budget and Tokenizer Basics

  1. Building to Understand, Under a Budget
  2. The Tokenizer's Two-Way Contract
  3. Compression Ratio Versus Vocabulary Size

Characters, Bytes, Words

  1. Code Points Are Not Bytes
  2. Full Coverage Versus Short Sequences

Byte Pair Encoding

  1. Training BPE on "the cat in the hat"
  2. Encoding New Text With Frozen Merges
  3. Boundaries: Pre-tokenization and Special Tokens

Start learning with Wondering