N-gram Modeling Flashcards

1
Q

Probability of a Sentence

A

Multiplying together the probability of each word occurring after the previous word AND its context.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Count-based Models

A

To get probability of word, using corpus, count up frequency of word occurrence (can include given previous word) and divide by total number of words.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Count-based Model Formula

A

P(wi∣wi−n+1 ,…,wi−1)=
C(wi−n+1,…,wi−1,wi)/ C(wi−n+1,…,wi−1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Probability of a Sentence Formula

A

P(S)=P(w1)⋅P(w2∣w1)⋅P(w3∣w2)⋅…⋅P(wn∣wn−1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Perplexity

A

Inverse probability of the sentence normalized by the number of words in the sentence.
HIGHER means less confident, found more possible words
LOWER means more confident, found less possible words

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Ways to Evaluate Models

A
  1. Log-likelihood
  2. Per-word Log Likelihood
  3. Per-word (cross) Entropy *
  4. Perplexity ***
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Ways to Sample Text with LMs

A
  1. Greedy decoding
  2. Beam search
  3. Nucleus sampling
  4. Top-k sampling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Greedy Decoding

A

Choose next word with highest probability of occurring after previous word.
Problem: Most probable next word doesn’t lead to most probable sentence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Beam Search

A

Maintain several paths for most probably sentences. 1. Choose two most probable words
2. Calculate total probability of sentence
3. Choose two most probable words for each sentence
4. Eliminate 2 least likely sentences
5. Repeat
Problem: too many similar sequences, too close to optimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Nucleus Sampling

A

Take top p% of distribution, sample within that

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Top-k Sampling

A

Take top k most likely words, sample from those

How well did you know this?
1
Not at all
2
3
4
5
Perfectly