JA EN
LearnInformation Theory
·★ MEMBER·PAPER·11 min read

Mutual Information — Putting a Number on What You Know

How much does knowing one thing shrink your uncertainty about another? Mutual information turns that into a single number. We build it from entropy subtraction, work through conditional MI, the data processing inequality and why estimation is hard, and end at why the InfoNCE loss behind modern contrastive learning is called a lower bound on mutual information.

ModalitytextTaskmath

Representation Learning with Contrastive Predictive Coding


Putting a number on "how much does knowing help?"

You're standing at the door wondering whether to take an umbrella. Someone says: "By the way, the pressure dropped sharply this morning." How much clearer did that one sentence make your picture of whether it's going to rain?

Mutual information (MI) is exactly that "how much clearer" turned into a number. Knowing one variable shrinks your uncertainty about another by some amount; the bigger the shrinkage, the stronger the relationship. That's the whole idea.

Correlation plays a similar role, but it only measures whether two things rise together in a straight line. Take y=x2y = x^2 with xx wandering between 1-1 and 11: the correlation is essentially zero, because yy grows the same way whether xx is positive or negative, and no straight line fits that. Yet knowing xx pins down yy completely. Mutual information correctly reports that the relationship is as strong as it gets. It picks up dependence of any shape, and that is its main selling point.

This article sits next to Information Theory and AI, but assumes no prior background.

An analogy: what one question is worth in Twenty Questions

Someone thinks of a word and you have to guess it with yes/no questions. If there are 1024 candidates, your uncertainty is worth ten questions (since 210=10242^{10} = 1024). That "amount of uncertainty" is entropy, measured in bits.

Now you ask "is it a living thing?" and the field narrows to 256 words. Your uncertainty went from 10 bits to 8. That question was worth 2 bits.

Mutual information is precisely that worth — except it isn't one lucky question, it's the average over every way the answer could come back, weighted by how likely each one is. A question that only narrows things down when the answer is "yes" is worth almost nothing on average if "yes" is rare. A question that splits the field in half either way earns a clean bit every time. A good question is one whose answer you can't predict — that's what this average is saying.

The mechanism: MI is a subtraction of uncertainties

Put plainly, mutual information is a subtraction. Take your uncertainty about YY when you know nothing, and subtract the uncertainty about YY that remains after you're told XX. Being a difference of that kind, it's always at least zero — being told something never makes you more uncertain on average. And if the difference is zero, XX says nothing whatsoever about YY. That is independence, stated in information-theoretic terms.

Let's build it up. First, uncertainty itself — entropy. Here p(x)p(x) is the probability that XX takes the value xx.

H(X)=xp(x)logp(x)H(X) = -\sum_{x} p(x)\log p(x)
(1)

In words: take how surprising each outcome is, logp(x)-\log p(x), and average it using how often that outcome actually happens. If the same few outcomes keep showing up, entropy is small; if you have no idea what's coming, it's large. Use base-2 logs and the unit is bits; use natural logs and it's nats.

Next, the uncertainty left after learning XXconditional entropy.

H(YX)=xp(x)H(YX=x)H(Y \mid X) = \sum_{x} p(x)\, H(Y \mid X = x)
(2)

That is: "how uncertain am I about YY in the world where XX turned out to be xx," averaged over how likely each xx is. The more XX narrows down YY, the smaller this gets.

Read the vertical bar as "given that you've been told": in words, H(YX)H(Y \mid X) is the uncertainty about YY that survives even after someone hands you XX.

Mutual information is the gap between the two.

I(X;Y)=H(Y)H(YX)=H(X)H(XY)I(X; Y) = H(Y) - H(Y \mid X) = H(X) - H(X \mid Y)
(3)

Spelled out in words: start with the uncertainty you walked in with, subtract whatever is still left after the tip-off, and the leftover difference is I(X;Y)I(X;Y).

Two equals signs in a row is a real claim: you get the same number from either direction. What XX tells you about YY always equals what YY tells you about XX. It's counterintuitive but follows straight from the definition, and it's why the quantity is called mutual.

A peaked distribution means low uncertainty, a flat one means high. Getting that correspondence into your hands makes everything below easier.

FIG 1Lower the temperature and the bars spike into one; raise it and they flatten out. Spiked means "I basically know the answer already" — low entropy. Flat means "I still know nothing." Mutual information is the average amount by which learning X spikes these bars.

A second face: distance from independence

So far we defined MI as a subtraction. The very same quantity can be written from a different angle.

I(X;Y)=DKL ⁣(p(x,y)    p(x)p(y))I(X; Y) = D_{\mathrm{KL}}\!\left(p(x,y)\;\middle\|\;p(x)p(y)\right)
(4)

Here p(x,y)p(x,y) is how the two actually show up together, and p(x)p(y)p(x)p(y) is a fictional distribution describing how they would show up if they were unrelated. DKLD_{\mathrm{KL}} measures the gap between two distributions (KL Divergence from Scratch), so this equation reads: "how far is the real pairing from the pairing you'd get under independence?"

Put another way, you lay the table of pairs you actually observed next to the table you'd expect if the two had nothing to do with each other, and the size of the mismatch *is* the strength of the relationship — which says dependence and "distance from independence" are the same measurement.

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. Representation Learning with Contrastive Predictive Coding. arXiv:1807.03748Paper page·PDF
  2. MINE: Mutual Information Neural Estimation. arXiv:1801.04062Paper page·PDF
  3. On Variational Bounds of Mutual Information. arXiv:1905.06922Paper page·PDF
  4. On Mutual Information Maximization for Representation Learning. arXiv:1907.13625Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment