ICS 582Lecture 04Part 06
Pointwise mutual information and PPMI
Measuring whether two words co-occur more than chance with PMI, clipping negatives to get PPMI, computing it step by step on a term-context matrix, and correcting PMI's bias toward rare words with alpha-weighted context probabilities.
- Concepts
- 6
- Slides
- 53-60
- Reading
- 36 min
Why this part matters
Part 05 fixed raw counts on the term-document side with tf-idf. Term-context matrices have the same disease: the biggest numbers belong to frequent words such as information and data, which sit next to almost everything. A raw count cannot tell you whether two words genuinely belong together or merely happen to be common.
Positive pointwise mutual information is the standard cure. It rescales every cell of a term-context matrix by what chance alone would predict, keeping only above-chance association, and it turns that matrix into meaningful sparse word vectors. It is also the bridge to the rest of this lecture: skip-gram with negative sampling turns out to factorize a shifted PMI matrix, and the magic number 0.75 you will meet in word2vec first appears here. Outside embeddings, PMI drives collocation extraction, lexicography and feature selection, so it will show up in your research. Exams almost always ask for one PPMI cell by hand.
By the end you can
- Explain PMI as observed versus chance co-occurrence, measured in bits.
- Justify clipping negative PMI to zero to obtain PPMI.
- Compute joint and marginal probabilities from a term-context count matrix.
- Compute any single PPMI cell by hand from counts.
- Explain PMI's bias toward rare contexts and two standard fixes.
- Apply alpha = 0.75 context smoothing and predict its effect on each cell.
Start with numbers. In the small Term-context matrix used throughout this part, the word information accounts for 7703 of the N = 11716 counted word-context pairs, and the context data for 5673 of them. If the two words had nothing to do with each other, how often would you expect to see them together? The full table, with every row and column sum, is in the counts-to-probabilities section below.
Independence answers that. If knowing one word tells you nothing about the other, the probability of the pair is just the product of the separate probabilities: P(information) × P(data) = .6575 × .4842 = .3184. So about 31.8% of all pairs should be (information, data) by chance alone. The observed share is 3982 / 11716 = .3399. The ratio of observed to expected is 1.0676: the pair occurs only 6.8% more often than chance, and log2 1.0676 = .0944 bits. Compare cherry and pie: there the ratio is 20.8, and the log is 4.38 bits. That number is pointwise mutual information.
Read the fraction one piece at a time. The numerator is what actually happened: how often the pair appeared together. The denominator is what independence predicts, because under independence P(x, y) = P(x) P(y). The ratio therefore says how many times more often the pair occurs than chance, and the base-2 logarithm turns that ratio into bits. A ratio of 1 gives 0 bits (independent), a ratio above 1 gives a positive score (attraction), and a ratio below 1 gives a negative score (avoidance). Each extra bit means the pair is twice as over-represented.
Where the measure comes from
Church and Hanks (1989, journal version 1990) brought the measure to lexicography. They estimated P(x, y) by counting how often x is followed by y within a window of w = 5 words, and they read the score exactly as above: well above zero for genuine association, near zero for no relation, well below zero for words in complementary distribution. Their rough rule of thumb was that pairs with a score above 3 tend to be interesting, and they ignored pairs seen 5 times or fewer because the ratio was unstable, an early sign of the rare-event problem later in this part. One subtlety a PhD reader should notice: because their count encoded word order (x before y), their association ratio was not symmetric. The term-context version on these slides counts a symmetric window, so PMI(w, c) depends only on which pair you pick.
Recall
In one sentence, what does PMI(w, c) = 0 mean?
Suppose two words each have probability 10^-6, which is typical of most of the vocabulary. Independence predicts that they appear together with probability 10^-12. To say with confidence that they appear together less than that, you must be able to estimate probabilities well below 10^-12, which takes a corpus on the order of trillions of pairs. With a corpus of a few million tokens you will simply never see them together, and you cannot tell "these words avoid each other" apart from "these words never happened to meet".
That is the first reason negative PMI is unreliable: the evidence needed to estimate below-chance co-occurrence grows with the rarity of the words, and for most word pairs it is never available. The second reason is about evaluation: it is not clear that people can even judge "unrelatedness" reliably, so there is no good gold standard to check negative scores against. The practical answer, used since Church and Hanks and later Dagan and colleagues (1993) and Niwa and Nitta (1994), is to keep only the positive side.
Positive PMI keeps the attraction signal and floors everything else at zero. It has a welcome side effect. A pair that never co-occurs has P(w, c) = 0, so its Pointwise mutual information is log2 0 = -∞, a value that would wreck any later arithmetic. Clipping maps it cleanly to 0. In the slide table this is exactly what happens to strawberry/computer and strawberry/data, both with count 0. The result is a sparse vector per word: long, mostly zero, with a few positive entries for the contexts that really characterise it.
| PMI | PPMI | |
|---|---|---|
| Range | -∞ to +∞ (asymptotically) | 0 to +∞ |
| Unseen pair (count 0) | log2 0 = -∞ | 0 |
| What a value says | Attraction (positive) or avoidance (negative) | Strength of attraction only; 0 means no evidence of it |
| Reliability | Negative side needs enormous corpora | Keeps only the side small corpora can estimate |
| Matrix shape | Dense, with many large negative entries | Sparse: most entries are exactly 0 |
Empirically the choice pays off. Levy, Goldberg and Dagan (2015) report that Bullinaria and Levy (2007) found PPMI outperforms plain PMI on semantic similarity tasks, and PPMI became the default count-based baseline against which neural embeddings were later compared.
Recall
Give two reasons PPMI discards negative PMI.
Quick check
Why does PPMI replace negative PMI values with zero?
Everything so far needs three probabilities per cell: the joint P(w, c) and the two marginals P(w) and P(c). All three come from one count matrix F. Here is the matrix the slides use, taken from SLP3, whose counts come from Wikipedia: four target words as rows, five context words as columns, with the row and column sums added.
| computer | data | result | pie | sugar | row sum | |
|---|---|---|---|---|---|---|
| cherry | 2 | 8 | 9 | 442 | 25 | 486 |
| strawberry | 0 | 0 | 1 | 60 | 19 | 80 |
| digital | 1670 | 1683 | 85 | 5 | 4 | 3447 |
| information | 3325 | 3982 | 378 | 5 | 13 | 7703 |
| column sum | 4997 | 5673 | 473 | 512 | 61 | N = 11716 |
| p(c) | .4265 | .4842 | .0404 | .0437 | .0052 | 1 |
Add every cell and you get the grand total N = 11716. Each probability is then a share of that one total. The joint probability of a cell is the cell divided by N. The marginal probability of a target word is its row sum divided by N, and the marginal probability of a context is its column sum divided by N.
Worked example
Three probabilities for (information, data)
Find the total
Sum all twenty cells, or equivalently the four row sums: 486 + 80 + 3447 + 7703 = 11716.Joint
The cell count is 3982, so p(information, data) = 3982 / 11716 = .3399.Row marginal
The information row sums to 7703, so p(information) = 7703 / 11716 = .6575.Column marginal
The data column sums to 5673, so p(data) = 5673 / 11716 = .4842.Result
- Joint p(information, data)
- 3982 / 11716 = .3399
- Marginal p(information)
- 7703 / 11716 = .6575
- Marginal p(data)
- 5673 / 11716 = .4842
- Chance prediction p(information) p(data)
- .6575 × .4842 = .3184
Because the joint and both marginals come from the same matrix and the same N, they are consistent: each row of joint probabilities sums to its row marginal, each column to its column marginal, and everything sums to 1. SLP3 is candid that this "pretends" the five listed contexts are the only ones in the world. In a real system the matrix has tens of thousands of columns and the same recipe applies unchanged.
Recall
From the count table, compute p(strawberry) and p(sugar).
With the three probabilities in hand, one cell of the Pointwise mutual information matrix is a division and a log. Work it once by hand for information/data, then notice a shortcut that skips the rounding entirely.
Worked example
PPMI(information, data) by hand
Ratio of observed to expected
.3399 / (.6575 × .4842) = .3399 / .3184 = 1.0675.Same ratio straight from counts
The Ns cancel into one: f × N / (row × col) = 3982 × 11716 / (7703 × 5673) = 1.0676. This route avoids rounding the probabilities first.Take log base 2
Most calculators lack log2, so use log2 x = ln x / ln 2: ln 1.0676 / 0.6931 = 0.0654 / 0.6931 = .0944.Clip
.0944 > 0, so the clip changes nothing.Result
PPMI(information, data) = .09, matching the slide.
Repeat for every cell and you get the full PMI matrix below. Every Positive PMI value on slide 58 is this matrix after clipping; SLP3 quotes PMI(cherry, computer) = -6.7 in its figure caption as an example of a large negative value that PPMI discards.
| computer | data | result | pie | sugar | |
|---|---|---|---|---|---|
| cherry | -6.70 | -4.88 | -1.12 | 4.38 | 3.30 |
| strawberry | -∞ | -∞ | -1.69 | 4.10 | 5.51 |
| digital | 0.18 | 0.01 | -0.71 | -4.91 | -2.17 |
| information | 0.02 | 0.09 | 0.28 | -6.07 | -1.63 |
| computer | data | result | pie | sugar | |
|---|---|---|---|---|---|
| cherry | 0 | 0 | 0 | 4.38 | 3.30 |
| strawberry | 0 | 0 | 0 | 4.10 | 5.51 |
| digital | 0.18 | 0.01 | 0 | 0 | 0 |
| information | 0.02 | 0.09 | 0.28 | 0 | 0 |
Now read the PPMI matrix as a set of word vectors. The fruit rows light up only on pie and sugar; the technology rows only on computer, data and result. The two groups share no non-zero dimension, so the cosine similarity between cherry and digital is exactly 0, while cherry and strawberry have a cosine of about 0.96. The raw counts were noisier: cherry co-occurs with computer and data a few times, and in a full-size matrix such incidental counts, scaled by frequent contexts, blur every row. PPMI vectors are still long and sparse; the second half of this lecture learns short dense vectors instead.
Recall
Compute PPMI(cherry, pie) from count 442, row sum 486, column sum 512 and N = 11716.
Quick check
Using the slide counts, what is PMI(information, data)?
Add one more row and one more column to the slide table: a word w and a context c, each seen exactly once, and that once together. The shortcut gives PMI = log2(1 × 11716 / (1 × 1)) = log2 11716 = 13.5 bits. That is more than double strawberry/sugar (5.51), from a single observation that may be a typo or a coincidence. One accident beats thousands of genuine co-occurrences.
The mechanism is the denominator. When a context is rare, P(c) is tiny, so even one co-occurrence produces a large ratio. Levy, Goldberg and Dagan (2015) call this Pointwise mutual information's Achilles' heel, citing Turney and Pantel (2010): a word's highest-scoring dimensions become obscure contexts it met once or twice, and since similar words rarely share those accidents, their vectors look less alike under cosine than they should. Clipping does not help, because Positive PMI only touches negative values and this bias inflates positive ones.
Two fixes
- Give rare contexts a little more probability. If P(c) for a rare context is nudged upward, its PMI falls. This is the alpha weighting of the next concept.
- Add-k smoothing. Add a small constant k to every count before computing probabilities, exactly as in the n-gram language models of Lecture 03. Slide 59 names the simplest case, add-one smoothing, which is k = 1 and lowers strawberry/sugar from 5.51 to 5.41. SLP3 gives k = 0.1 to 3 as common choices, and notes that the larger the k, the more the non-zero counts are discounted. A count of 1 becomes 3 with k = 2, tripling, while a count of 442 barely moves. On the slide table, add-2 lowers strawberry/sugar from 5.51 to 5.31 and leaves the overall pattern intact.
The oldest fix is the bluntest. Church and Hanks simply discarded pairs seen 5 times or fewer. Frequency cut-offs of that kind are still common in collocation tools.
| Add-k smoothing | Context alpha | |
|---|---|---|
| What changes | Every count gets + k before probabilities are computed | Only the context distribution P(c) is reshaped |
| Which counts move most | Small counts, proportionally (1 becomes 3 with k = 2) | Rare contexts gain probability, frequent ones lose a little |
| Typical value | k from 0.1 to 3 | alpha = 0.75 |
| strawberry/sugar | 5.51 → 5.31 (k = 2) | 5.51 → 4.01 |
| Origin | Laplace smoothing, as in n-gram language models | word2vec negative sampling, carried over by Levy et al. (2015) |
Recall
Why does clipping to PPMI not remove PMI's bias toward rare contexts?
Take two contexts with P(a) = .99 and P(b) = .01. Raising both to 0.75 and renormalising roughly triples the rare one, so every Pointwise mutual information involving b falls by about 1.6 bits. The worked example below shows each step.
The exponent Alpha-weighted context probability flattens the context distribution. Because 0 < α < 1 shrinks large counts proportionally more than small ones, after renormalising P_alpha(c) > P(c) for rare contexts and P_alpha(c) < P(c) for frequent ones. A larger denominator means a lower PMI, so rare contexts lose exactly the inflated advantage the previous concept described, and Positive PMI computed with P_alpha(c) keeps fewer spurious rare dimensions. Only P(c) changes; P(w, c) and P(w) stay as before.
On the slide table the effect is easy to predict. Sugar, with only 61 counts, goes from P = .0052 to .0148, so strawberry/sugar drops from 5.51 to 4.01 and cherry/sugar from 3.30 to 1.80. The frequent context computer goes from .4265 to .4019, so digital/computer actually rises from 0.18 to 0.27. Result goes from .0404 to .0686, which pushes information/result from 0.28 to a PMI of -0.48, so its PPMI becomes 0.
| computer | pie | sugar | |
|---|---|---|---|
| P(c) | .4265 → .4019 | .0437 → .0728 | .0052 → .0148 |
| cherry | -6.70 → -6.61 | 4.38 → 3.64 | 3.30 → 1.80 |
| strawberry | -∞ → -∞ | 4.10 → 3.37 | 5.51 → 4.01 |
| digital | 0.18 → 0.27 | -4.91 → -5.65 | -2.17 → -3.67 |
| information | 0.02 → 0.10 | -6.07 → -6.81 | -1.63 → -3.13 |
Worked example
Slide 60's two-context example
Raise to alpha
.99^.75 = .9925 and .01^.75 = .0316.Find the shared normaliser
.9925 + .0316 = 1.0241. Both contexts are divided by this same sum.Renormalise
P_alpha(a) = .9925 / 1.0241 = .97 and P_alpha(b) = .0316 / 1.0241 = .03.Result
The rare context's probability rises from .01 to .03; the frequent one falls from .99 to .97.
Why 0.75, and the road to word2vec
The number is borrowed. Mikolov and colleagues (2013) found that drawing negative samples for word2vec from the unigram distribution raised to the 3/4 power, U(w)^(3/4) / Z, worked significantly better than either the plain unigram or the uniform distribution. Levy, Goldberg and Dagan (2015) carried the trick over to count-based PMI as "context distribution smoothing", tested α ∈ {1, 0.75}, and found that it alleviates PMI's bias toward rare words and consistently improves performance across tasks, methods and configurations.
The connection runs deeper than a shared constant. Levy and Goldberg (2014) showed that Skip-gram with negative sampling with k negative samples implicitly factorizes a word-context matrix whose cells are PMI(w, c) - log k. The sparse analogue is shifted PPMI, max(PMI(w, c) - log k, 0), which they found competitive on word similarity. So PPMI and word2vec are close relatives: Negative sampling is, in a precise sense, a smoothed and compressed way of estimating the same quantity you just computed by hand. Keep this in mind for the skip-gram parts that follow.
Recall
Why does raising context counts to 0.75 lower the PMI of rare contexts?
Recall
Why is "raise the probabilities" the same as "raise the counts" to alpha?
Quick check
With P(a) = .99, P(b) = .01 and alpha = 0.75, what is P_alpha(b)?
Quick check
Applying alpha = 0.75 to the slide's context counts does what to PPMI(strawberry, sugar)?
Recap
If you remember nothing else
- PMI(w, c) = log2 P(w, c) / (P(w)P(c)) measures how far a pair sits above or below chance, in bits. Zero means independent.
- Negative PMI is unreliable without enormous corpora, so PPMI = max(PMI, 0). Clipping also maps unseen pairs from minus infinity to 0.
- All probabilities come from one matrix total N: the joint is the cell over N, the marginals are the row and column sums over N.
- Shortcut: PMI = log2(f_ij × N / (row_i × col_j)). In the slide example, information/data = 0.09 and strawberry/sugar = 5.51.
- PMI favours rare events: one co-occurrence with a rare context can outscore thousands of genuine ones. PPMI does not fix this.
- Fixes: add-k smoothing (add-one on slide 59 is k = 1; SLP3 uses k from 0.1 to 3), or P_alpha(c) with alpha = 0.75, which raises rare-context probabilities and lowers their PMI.
- alpha = 0.75 comes from word2vec negative sampling, and SGNS itself approximates a PMI matrix shifted by log k.
Sources
- Speech and Language Processing, 3rd ed. draft, Section 6.6: Pointwise Mutual Information (PMI)BookJurafsky and Martin, draft of August 20, 2024pp. 114-116: PMI and PPMI definitions, the Fano terminology footnote, the 10^-6 argument, footnote on log 0, the count matrix with N = 11716, the PPMI matrix, add-k values and alpha = 0.75(opens in a new tab)
- Speech and Language Processing, 3rd ed. draft, Chapter 5: EmbeddingsBookJurafsky and Martin, draft of August 2026Keeps alpha = 0.75 for negative sampling; the PPMI section was dropped in this draft(opens in a new tab)
- Word Association Norms, Mutual Information, and LexicographyPaperChurch and Hanks, Computational Linguistics 16(1), 1990The association ratio with log2, window w = 5, the I > 3 rule of thumb, ignoring f(x, y) ≤ 5, and asymmetry from word order(opens in a new tab)
- Word Association Norms, Mutual Information, and LexicographyPaperChurch and Hanks, ACL 1989, pp. 76-83The conference version cited on slide 54(opens in a new tab)
- Co-Occurrence Vectors From Corpora vs. Distance Vectors From DictionariesPaperNiwa and Nitta, COLING 1994Early use of positive PMI co-occurrence vectors(opens in a new tab)
- Improving Distributional Similarity with Lessons Learned from Word EmbeddingsPaperLevy, Goldberg and Dagan, TACL 3, 2015PMI's bias toward rare contexts, context distribution smoothing with alpha in {1, 0.75}, shifted PPMI, and the report of Bullinaria and Levy (2007) that PPMI beats PMI(opens in a new tab)
- Neural Word Embedding as Implicit Matrix FactorizationPaperLevy and Goldberg, NeurIPS 27, 2014SGNS implicitly factorizes a PMI matrix shifted by log k(opens in a new tab)
- Distributed Representations of Words and Phrases and their CompositionalityPaperMikolov, Sutskever, Chen, Corrado and Dean, NeurIPS 26, 2013The unigram distribution raised to the 3/4 power as the negative-sampling noise distribution(opens in a new tab)
- From Frequency to Meaning: Vector Space Models of SemanticsPaperTurney and Pantel, Journal of Artificial Intelligence Research 37, 2010Survey of count-based models, cited by Levy et al. for PMI's rare-event bias(opens in a new tab)