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

WordPiece

Watch WordPiece score letter pairs, grow a vocabulary, then split a word.


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.03 · TOKENIZER BAY26 WORDS · 35 BASE PIECES
01
Stage 1 of 5 · Split letters
WordPiece splits each corpus word into letters. The prefix ## marks a letter inside a word.
Explain it simply

On the left you see the 26 words of the training text, each with how often it appears. WordPiece cuts every word into single letters, and the bars on the right count each piece. A letter inside a word gets two hash marks in front. So it is a different piece from the same letter at a word start.

26 words with their counts, split into letter pieces. Bars show how often each piece appears; ##e appears 15 times.

corpus piecesvocabularyscores, token IDsno match, [UNK]
split into letterscorpus · 26 words · count, then pieceshow often each piece appearsvocabulary · 36 pieces · ID under each×1T##h##e×1c##a##t×1s##a##t×1o##n×3t##h##e×1m##a##t×6.×2S##h##e×1l##i##k##e##s×1w##a##r##m×2m##i##l##k×1W##e×2d##r##i##n##k×1a##t×1h##o##m##e×1H##e×1w##i##l##l×1s##o##m##e×1t##e##a×1r##e##a##d##s×1t##e##x##t×1I×1s##p##l##i##t×1b##r##e##a##d×1i##n×1t##w##o.6H1I1S2T1W1a1b1c1d2h1i1l1m3o1r1s3t6w2##a7##d2##e15##h6##i7##k5##l5##m3##n4##o3##p1##r4##s2##t6##w1##x1[UNK]0.1H2I3S4T5W6a7b8c9d10h11i12l13m14o15r16s17t18w19##a20##d21##e22##h23##i24##k25##l26##m27##n28##o29##p30##r31##s32##t33##w34##x35home → h ##o ##m ##e (## marks a letter inside a word)split into letterscorpus · 26 words · count, then pieceshow often each piece appearsvocabulary · 36 pieces · ID under each×1T##h##e×1c##a##t×1s##a##t×1o##n×3t##h##e×1m##a##t×6.×2S##h##e×1l##i##k##e##s×1w##a##r##m×2m##i##l##k×1W##e×2d##r##i##n##k×1a##t×1h##o##m##e×1H##e×1w##i##l##l×1s##o##m##e×1t##e##a×1r##e##a##d##s×1t##e##x##t×1I×1s##p##l##i##t×1b##r##e##a##d×1i##n×1t##w##o.6H1I1S2T1W1a1b1c1d2h1i1l1m3o1r1s3t6w2##a7##d2##e15##h6##i7##k5##l5##m3##n4##o3##p1##r4##s2##t6##w1##x1[UNK]0.1H2I3S4T5W6a7b8c9d10h11i12l13m14o15r16s17t18w19##a20##d21##e22##h23##i24##k25##l26##m27##n28##o29##p30##r31##s32##t33##w34##x35home → h ##o ##m ##e (## marks a letter inside a word)
Toy: the 26 words of the shared English training text, 1 to 30 merges
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
home=h ##o ##m ##e\sy{w}{data}{\text{home}} = \text{h}\ \text{\#\#o}\ \text{\#\#m}\ \text{\#\#e}
c(##o)=1+1+1=3\sy{na}{data}{c(\text{\#\#o})} = 1 + 1 + 1 = 3

A word becomes its first letter, then the inner letters with ##.

Common mix-ups

MYTHWordPiece merges the most frequent pair, as BPE does.

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

Predict, then reveal
3 CHECKS · PRO
Q01With the BPE count rule, which pair merges first?

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.