Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Glossary › Byte-pair encoding

What is byte-pair encoding?

A way of building a tokeniser: start from single characters and repeatedly merge the most frequent neighbouring pair into one new token.

Where it is taught

How tokenisers are built. Real models do not read letters or whole words. They read word pieces, found by an algorithm that merges the most frequent pairs again and again.

What the lesson leaves you with

  • BPE starts from characters and repeatedly merges the most frequent neighbouring pair.
  • Common words become single tokens. Rare words are built from pieces.
  • Models see token ids, not letters, which explains some of their odd weaknesses.
Open the lesson

Questions

What is byte-pair encoding?
A way of building a tokeniser: start from single characters and repeatedly merge the most frequent neighbouring pair into one new token.
Where is byte-pair encoding used in AI?
Real models do not read letters or whole words. They read word pieces, found by an algorithm that merges the most frequent pairs again and again.
What is the key idea to remember about byte-pair encoding?
BPE starts from characters and repeatedly merges the most frequent neighbouring pair.
Where can I learn byte-pair encoding step by step?
In the lesson “How tokenisers are built” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.

Related terms

  • Attention
  • Attention head
  • Autoregressive
  • Causal mask
  • Context length
  • Layer normalisation