AI Glossary Term

What does “SentencePiece” mean?

Definition

A language-agnostic tokenizer that learns subword units directly from raw text without pre-splitting on whitespace.

How SentencePiece works

Diagram for SentencePiece, steps in order: Raw text, spaces included; then Learn pieces from the data; then Treat space as a symbol; then Works for any language.Raw text, spaces includedLearn pieces from the dataTreat space as a symbolWorks for any language

Example

For languages such as Japanese or Thai that do not separate words with spaces, SentencePiece learns its pieces directly from the text without needing a word-splitting step first.

Why it matters

A language-agnostic tokenizer simplifies multilingual models. It is used in several well-known models.

Common questions

Who created it?

Taku Kudo and John Richardson at Google, in 2018.

Which algorithms does it support?

BPE and a unigram language-model method.

SentencePiece vs BPE?

BPE is an algorithm; SentencePiece is a toolkit that can use BPE or other algorithms on raw text.

Learn more in our free guides

Test yourself

See also