Natural Language Processing · TEE · read

Character-model perplexity: keep exact probabilities

Perplexity, log probabilities and smoothing

Unit 3, pages 121–156

Question. A unigram character model gives P(A)=0.25, P(B)=0.50, P(C)=0.25. Find the perplexity of AAA and ABC. Then find both perplexities when the three characters are equally likely.

Given

Each test string contains 3 scored characters, so N=3. Initial distribution 0.25,0.50,0.25; comparison distribution 1/3,1/3,1/3.

To find

Both sequence probabilities and perplexities under each distribution.

Formula and why it applies

P(c_1c_2c_3)=P(c_1)P(c_2)P(c_3),\qquad PP=P(W)^{-1/3}LaTeX: P(c_1c_2c_3)=P(c_1)P(c_2)P(c_3),\qquad PP=P(W)^{-1/3}

Characters, not words, are the model's prediction units in this question. Use exact 1/3 for uniform probabilities, rather than rounded 0.33.

Solution

Step 1. Score AAA
P(AAA)=0.25^3=\frac1{64}=0.015625LaTeX: P(AAA)=0.25^3=\frac1{64}=0.015625
Step 2. Find AAA perplexity
PP(AAA)=64^{1/3}=4LaTeX: PP(AAA)=64^{1/3}=4
Step 3. Score ABC
P(ABC)=0.25(0.5)(0.25)=\frac1{32}=0.03125LaTeX: P(ABC)=0.25(0.5)(0.25)=\frac1{32}=0.03125
Step 4. Find ABC perplexity
PP(ABC)=32^{1/3}\approx3.174802LaTeX: PP(ABC)=32^{1/3}\approx3.174802
Step 5. Change to an exactly uniform model
P(AAA)=P(ABC)=(1/3)^3=1/27LaTeX: P(AAA)=P(ABC)=(1/3)^3=1/27
Step 6. Find both uniform-model perplexities
PP=27^{1/3}=3LaTeX: PP=27^{1/3}=3
Final answer. Original model: AAA→4, ABC→3.174802. Uniform model: both→3. These values follow the stated formulas without intermediate rounding.

M2 06 — Perplexity, logarithms and calculator working

id
nlp-m2-06-perplexity-logs-calculator
title
M2 06 — Perplexity, logarithms and calculator working
title_confirmed
false
topic_title
Perplexity, logarithms and calculator working
mode
m2
kind
focused
status
queued
duration
reviewed
false
notebook_url
https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
youtube_url
corrected_visuals
false
upload_pending_correction
false
correction_note
related_topic_ids

    These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.

    NLP M2 — Perplexity | Reviewed formulas and solved numericals

    id
    overview-perplexity-logs
    title
    NLP M2 — Perplexity | Reviewed formulas and solved numericals
    title_confirmed
    true
    topic_title
    NLP M2 — Perplexity | Reviewed formulas and solved numericals
    mode
    m2
    kind
    supplemental
    status
    available
    duration
    9:35
    reviewed
    true
    notebook_url
    https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
    youtube_url
    https://www.youtube.com/watch?v=OPlh9cXnfTA
    corrected_visuals
    true
    upload_pending_correction
    false
    correction_note
    Readable formulas and all worked examples; corrected comparison conditions and context claims. Full transcript and detected slides checked; short voice corrections included.
    related_topic_ids
    • nlp-m2-06-perplexity-logs-calculator

    These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.