Chapter XIII · 24 min
Entropy and Information
Surprise, divergence, and why models train
“Information is the resolution of uncertainty.”
A probability distribution is a complete story about uncertainty. Often you need a number that says how much story is there: how surprised a source is on average, how different two stories are, how much one variable tells you about another. Those numbers are entropy, Kullback–Leibler divergence, and mutual information. They are the native language of modern training losses.
Surprise and entropy
If an event of probability occurs, a natural measure of surprise is . Certain events () are unsurprising; rare events are surprising. The logarithm makes independent surprises add. (The base chooses the unit: base 2 is bits, base is nats. Learning papers usually live in nats because calculus does.)
The entropy of a discrete random variable is expected surprise:
Entropy is non-negative, zero only for a sure (deterministic) variable, and maximised — among distributions on a fixed finite set — by the uniform. A fair coin has entropy 1 bit; a coin with has less, because it is easier to guess.
For a continuous variable the same idea yields differential entropy , which can be negative and is not invariant to changes of units. Treat it as a relative tool, not as a “number of bits in a real number” — that last quantity is infinite.
Joint, conditional, chain
Joint entropy is the surprise in the pair. Conditional entropy is the leftover surprise in once is known. The chain rule is the same shape as probability’s:
Conditioning cannot increase entropy: . Information does not make the world noisier.
Mutual information
The reduction in surprise about upon seeing is the mutual information
It is symmetric, non-negative, and zero if and only if and are independent. Feature selection, representation learning, and “does this embedding know the label?” are all questions about . Unlike correlation, mutual information sees nonlinear dependence.
KL divergence and cross-entropy
Given a true distribution and a model , the extra surprise of using to encode samples from is the Kullback–Leibler divergence
It is non-negative (Gibbs’ inequality / Jensen), and zero if and only if on a set of probability one. It is not a metric: it is asymmetric, and it does not obey the triangle inequality. is large when puts mass where does not; the other direction punishes the reverse.
Cross-entropy is expected surprise under the model, with data from the truth:
For a fixed true distribution , minimising cross-entropy in is exactly minimising KL, which is exactly maximum likelihood. That is why a scored forecast, a multiple-choice model, or a classifier trained with softmax and cross-entropy is doing probability, whether or not the write-up says so.
Forward KL, reverse KL, and mode behaviour
Maximum likelihood minimises — forward KL. The expectation is under the data, so the model is punished for missing mass that the data has: it tends to cover all modes, even if it smears. Minimising the reverse is the variational / GAN-adjacent mood: the model is punished for putting mass where the data has none, and is allowed to drop modes. When a generated sample looks too average, or too sharp and incomplete, you are watching this asymmetry.