Natural Language Processing · free preview

Capstone. A Mini Language Model

Train a byte-pair encoding tokenizer from scratch, count an n-gram model over its subwords, evaluate held-out perplexity against smoothing choices, and sample from it.

1. Capstone. A Mini Language Model

Capstone. A Mini Language Model

2. A tokenizer from scratch

A tokenizer from scratch

3. Counts, smoothing, perplexity

Counts, smoothing, perplexity

4. Reading the sample, bridging to the network

Reading the sample, bridging to the network

5. Choosing the first merge

Byte-pair encoding trains on a corpus whose words are split into characters. After eight merge steps the vocabulary contains pieces like er and ing. What decides the very first merge?

6. Counting the subword vocabulary

A tokenizer starts from 2929 distinct symbols, characters plus the word-end marker. After 99 merge steps, each adding exactly one new symbol to the vocabulary, how many distinct subword symbols exist?

7. Why the trigram survived held-out text

In the capstone, the raw trigram counts are far sparser than the bigram counts, yet the trigram system posts the lower held-out perplexity. What property produced that result?

8. Where ferring came from

A sample from the capstone model contains the strings ferring and hourossing, words that never appear in the training corpus. What does their presence demonstrate about the setup?

9. Smoothing one bigram

In a subword model with vocabulary size V=32V = 32, the token ferry occurs 66 times and the pair the ferry occurs 11 times. With add-k smoothing at k=0.1k = 0.1, what is P(ferry∣the)P(\text{ferry} \mid \text{the}), to three decimal places?

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free