Menu

1 / 5

NLP #5: Perplexity and Test Sets

DEV Community: nlp·GradientGym·21 minutes ago
#gu3Hfgnx
#devtonlp#devto#dev#model#perplexity
Long article (2861 words) — no AI summary yet.
Reading 0:00
15s threshold

Originally published on almoghagbi.com , where the figures are interactive.

By the end of this post, you'll be able to grade a language model the way

researchers do: hold out text the model has never seen, compute its

perplexity by hand, and say what the number means. In natural language

processing (NLP), perplexity is the standard score for language models. It

works for the n-gram models of the last lesson

and for today's large language models. Sections 3.2 and 3.3 of

Speech and Language Processing

introduce it.

Intuition

Never grade a model on its own homework

Last time we counted bigrams in four café orders:

i want a coffee\

i want a cake\

you want coffee\

i like cake

Here's a puzzle. A second model memorizes these four lines and gives each one

probability 1/4. Our bigram model gave "i want a coffee" only 1/6. Is the

memorizer the better model?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.