Log inStart free
LESSON 8.02 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

BPE

Watch BPE build a vocabulary by joining the most frequent pair of tokens.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 8.02 · BPE BAY132 CHARACTERS · BASE VOCABULARY 25
01
Stage 1 of 5 · Split the words
Each chunk of the corpus splits into characters. The 25 characters form the base vocabulary.
Explain it simply

On the left you see the six training lines, cut into 26 chunks, each with how often it appears. The chunks are the 26 words, and a space joins the word after it. Each chunk is cut into single characters. The vocabulary on the right starts with the 25 characters the text uses.

26 chunks with their counts, split into 132 characters in all. The base vocabulary has 25 tokens.

corpus tokensmerge rules, vocabularyencoded tokensUNK
corpus · 132 tokensvocabulary · 25 tokenscorpus tokens after each rule×1×1×1×1×3×1×6×2×1×1×2×1×2×1×1×1×1×1×1×1×1×1×1×1×1×1The␣cat␣sat␣on␣the␣mat.She␣likes␣warm␣milkWe␣drink␣at␣homeHe␣will␣some␣tea␣reads␣textI␣split␣bread␣in␣twoThe␣catsonm.SlikwrWdHxIpb1320|V₀| = 25 characterscorpus · 132 tokensvocabulary · 25 tokenscorpus tokens after each rule×1×1×1×1×3×1×6×2×1×1×2×1×2×1×1×1×1×1×1×1×1×1×1×1×1×1The␣cat␣sat␣on␣the␣mat.She␣likes␣warm␣milkWe␣drink␣at␣homeHe␣will␣some␣tea␣reads␣textI␣split␣bread␣in␣twoThe␣catsonm.SlikwrWdHxIpb1320|V₀| = 25 characters
Toy: the 8.C1 English training text, 26 chunks, 36 copies
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
V0={ base units }\sy{v}{param}{V_0} = \{\, \sy{u}{data}{\text{base units}} \,\}
∣V0∣=25,corpus=132 tokens|V_0| = 25,\quad \text{corpus} = 132\ \text{tokens}

The base vocabulary holds every unit a chunk can split into.

Common mix-ups

MYTHBPE splits words into meaningful parts, like roots and endings.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01If training runs 12 merge rules instead of 8, does the corpus need more or fewer tokens?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.