Information Theory
Shannon's measure of surprise, the cross-entropy loss every language model minimizes, and the deep equivalence between predicting data and compressing it.
3 lessons • 21 min read

- 01
Entropy: measuring surprise
How much information does an outcome carry, and how few bits can you get away with to describe a random source? Entropy answers both questions at once, and the answer turns out to be the quantity every language model is trained to estimate.
7 min read - 02
Cross-entropy and KL divergence: the language-model loss
What does it cost to describe data with the wrong probability model, and why is that cost the loss nearly every language model is trained on? Cross-entropy measures that cost, and KL divergence isolates the part that comes from the model being wrong.
6 min read - 03
Prediction is compression
Any model that assigns probabilities to data can be turned into a lossless compressor, and any lossless compressor implies a probability model. This equivalence is exact, not a metaphor. It explains why a language model's training loss is literally a file size, and why "compresses well" and "predicts well" are the same claim.
8 min read
Reference videos
32:203Blue1BrownReinventing Entropy | Compression is Intelligence Part 1
Derives entropy from scratch, framed around prediction and compression.
Watch
33:513Blue1BrownBut what is cross-entropy? | Compression is Intelligence Part 2
The loss every language model minimizes, and its link to compression.
Watch
5:13Adian LiusieIntuitively Understanding the KL Divergence
A five-minute intuition for KL as the gap between cross-entropy and entropy.
Watch
30:383Blue1BrownSolving Wordle using information theory
Entropy as expected information gain, applied to a game.
Watch
Series16 videosJakob FoersterInformation Theory, Pattern Recognition, and Neural Networks
David MacKay's Cambridge lectures, the companion to his free textbook.
Open series
