Generative AI L5: Tokenization (Word piece, unigram tokenization), language related terminologies

Generative AI L5: Tokenization (Word piece, unigram tokenization), language related terminologies

🎙 Agha Ali Raza 👥 3K 📅 April 26, 2026 ⏱ 59 min 👁 151 📄 lecture 🧭 2026-08-15
Available in: English (current) Français

Keywords

tokenizationword pieceunigramBPElanguage model

Summary

This lecture, part of the ‘Foundations of Generative AI’ course at LUMS, focuses on tokenization algorithms, specifically WordPiece and Unigram tokenization. The instructor begins by contrasting WordPiece with BPE, highlighting the difference in scoring functions: BPE uses simple frequency, while WordPiece uses a likelihood ratio based on pointwise mutual information. He walks through a detailed example of WordPiece, showing how the vocabulary is built by iteratively merging character pairs with the highest score, and explains the handling of word-initial vs. word-medial tokens using ‘##’ markers. He then introduces Unigram tokenization, which starts with a large vocabulary of all possible substrings and iteratively prunes tokens based on a loss function (negative log-likelihood) using the Expectation-Maximization algorithm. The lecture also covers language-related terminologies, byte-level processing, SentencePiece, and the efficiency of tokenization in relation to sequence length. The instructor emphasizes the importance of understanding these algorithms for building language models and notes the practical prevalence of BPE over WordPiece and Unigram due to historical and computational reasons.

164 words

Critical Evaluation

Value of the Information & Strength of the Argument

The lecture provides a thorough and rigorous explanation of tokenization algorithms, with clear mathematical formulations and step-by-step examples. The instructor justifies the choice of scoring functions and discusses the trade-offs between different methods, such as the computational cost of WordPiece versus BPE. He also addresses the practical dominance of BPE in the industry, attributing it to historical availability and the ability of neural networks to compensate for its shortcomings. The argumentation is solid, grounded in probability and information theory, and the instructor encourages students to engage with the material hands-on.

Scientific Rigor, Source Quality, Title Accuracy

The lecture is scientifically rigorous, referencing the original papers for each algorithm (e.g., WordPiece from Wu et al. 2016, Unigram from Kudo 2018). The instructor clearly distinguishes between the canonical algorithms and their implementation variants, which is crucial for understanding real-world code. The title accurately reflects the content, and the lecture is well-structured with clear objectives. The sources cited are appropriate and directly relevant to the topic.

172 words

Title / Content Match

The title accurately reflects the content, covering word piece and unigram tokenization along with related terminologies.

Quality & Reliability

8/10

The lecture is part of a graduate course at LUMS, presented by an academic expert. It provides detailed algorithmic explanations with examples and references to original papers. The content is technically accurate and well-structured, though it is a lecture rather than peer-reviewed research.

Chapters

Cited Sources

Concurring Sources

Contribution & Novelties

The lecture provides a clear and detailed pedagogical explanation of WordPiece and Unigram tokenization, bridging the gap between theoretical papers and practical implementation. It highlights the subtle differences between algorithms and their variants, which is often overlooked in other resources. The emphasis on the historical and practical reasons for the dominance of BPE over more theoretically sound methods is a valuable insight.

Pour aller plus loin :

132 words

Radar Profile

The radar profile shows high scores across all dimensions, indicating a well-rounded and reliable educational resource. The lecture excels in providing both theoretical depth and practical insights, making it suitable for advanced learners.

Reliability 8/10