Module 07
Information Theory
How do we quantify information, uncertainty and the difference between distributions?
- lessons
- 19
- duration
- 34 h 15 min
- concepts
- 83
- available in English
- 19 / 19
- completed by you
0 of 19
Where it fits
Overview
Build information theory from Shannon entropy to its uses at the frontier of machine learning. Combine complete proofs of source and channel coding, rate–distortion and large-deviation theorems with implementations from scratch (Huffman, arithmetic coding, Blahut–Arimoto and mutual-information estimators). Connect every idea to practice: cross entropy as loss, KL in VAEs and RLHF, language models as compressors, MDL and the information bottleneck.
Why it matters
The loss used to train any language model is cross entropy measured in nats, the RLHF penalty and VAE regularization term are KL divergences, and contrastive learning maximizes mutual-information bounds: without this module those pieces remain opaque formulas. For quantitative work it provides the Kelly criterion and large-deviation exponents measuring how unlikely an outcome is by chance; for research it provides the language of compression, MDL and the information bottleneck used to reason about generalization and representations. It also enables real tools: model-guided compressors and information estimators for analyzing networks.
Lessons 19
- 01Shannon entropy: surprisal, uncertainty and the chain ruleA dense review of Shannon uncertainty, surprisal, entropy, units, axiomatic characterization and the extension to joint and conditional entropy and the chain rule. Entropy is interpreted as the minimum average number of yes/no questions, leading to compression and language-model loss.
- 02The Kullback-Leibler divergenceIntroduce relative entropy as a measure of how wrong model q is relative to reality p. Prove nonnegativity (Gibbs' inequality), log-sum inequality, joint convexity and chain rule, and study asymmetry and differing supports. Interpret KL as expected excess surprise and mean evidence per observation for p against q.
- 03Mutual information, data processing and FanoMutual information measures how much one variable reduces uncertainty about another and is defined as KL between the joint and product of marginals. Prove its properties, chain rule, data processing inequality and Fano's inequality, bounding any estimator's error. Study information diagrams and their limitations with three variables, where synergy appears.
- 04Asymptotic equipartition, typical sets and entropy rateApply the law of large numbers to −(1/n) log p(Xⁿ) to show that nearly all probability concentrates on about 2^(nH) typical sequences. Prove the fixed-length block source-coding theorem, then extend entropy to processes with memory. A language model’s loss upper-bounds the entropy rate.
- 05Prefix codes, Kraft's inequality and Huffman codingBuild symbol-by-symbol codes from prefix trees, derive the Kraft–McMillan inequality and the bounds H ≤ L* < H + 1, and prove Huffman optimality. Connect compression to learning by measuring the D(p‖q) extra ideal bits per symbol from coding with a mismatched model q.
- 06Cross-entropy: loss, likelihood and bettingDefine cross-entropy as the expected code length under q and relate it to maximum likelihood and forward KL. Derive the stable softmax cross-entropy loss and its gradient, then interpret log loss as a strictly proper score and through the KL growth difference in Kelly betting.
- 07Arithmetic coding and universal compressionArithmetic coding turns a sequential probability model into a compressor using at most −log₂ q(x₁,…,xₙ) + 2 bits. Study adaptive Laplace, Krichevsky–Trofimov and context models that learn while compressing, and universal Lempel–Ziv coding, which reaches the entropy rate without knowing the source.
- 08A language model is a compressorConnect language modeling and lossless compression, compare perplexity and bits per byte, account for model cost, and analyze compression-based similarity.
- 09Discrete channels and capacityModel noisy communication with a discrete memoryless channel, derive classical capacities, and compute capacity using convex optimization and Blahut–Arimoto.
- 10The noisy-channel coding theoremProve Shannon's noisy-channel coding theorem using joint typicality, random codes, and Fano's inequality; examine separation and practical linear codes.
- 11Differential entropy, Gaussians and the Gaussian channelExtend information theory to continuous variables. Differential entropy may be negative and depends on scale, while KL divergence and mutual information retain their meaning. Derive the Gaussian maximum-entropy property, the Gaussian KL used by VAEs, Gaussian channel capacity, and water filling.
- 12f-divergences, Jensen-Shannon and variational representationsUnify KL, reverse KL, total variation, Hellinger, chi-squared, and Jensen–Shannon as f-divergences. Study data processing, Jensen–Shannon and GANs, Pinsker's inequality, and variational representations that turn divergence estimation into optimization over critics.
- 13Maximum entropy and the Gibbs variational principleFormulate Jaynes's maximum-entropy principle and derive the Gibbs solution, temperature softmax, maximum-likelihood duality, information projection and the Gibbs variational principle used in KL regularization.
- 14Rate-distortion theoryStudy how many bits per symbol are needed to reconstruct a source at average distortion D. Define the rate–distortion function as a mutual-information minimum, derive it for binary and Gaussian sources, implement Blahut–Arimoto and interpret learned compression and β-VAE through an objective that trades rate against distortion.
- 15KL as a regularizer: mode seeking, VAEs and RLHFCompare the mass-covering behavior of forward KL with the mode-seeking behavior of reverse KL. Derive the closed-form optimum of E_q[r] − β D(q‖p), the RLHF policy optimum that underlies DPO, and study the sample-based KL estimators k1, k2 and k3. Interpret a VAE’s KL term as an upper bound on mutual information between inputs and latents.
- 16Method of types, Sanov's theorem and hypothesis testingConnect information theory to classical statistics with the method of types: count sequences of a given composition and bound their probabilities. Derive Sanov's theorem, Chernoff–Stein's lemma, and the local Fisher-information approximation to KL divergence.
- 17Estimating entropy and mutual information from samplesEstimate entropy and mutual information using plug-in, nearest-neighbor and variational methods, and understand their statistical limits.
- 18Minimum description lengthLearning as compression, from uncomputable Kolmogorov complexity to Rissanen’s practical MDL principle. Study two-part and universal codes, regret, BIC, prequential coding, and applications to deep networks and probing.
- 19The information bottleneckExtract from X only what is relevant to Y by minimizing I(X;T) − β I(T;Y). Derive self-consistent equations and iterative annealing, connect rate–distortion and minimal sufficiency, study neural VIB and critically evaluate the information plane and compression hypothesis in deep learning.
Module capstone
Model-guided compression lab
Build a modular lossless compressor and test it against the module’s theory. (1) An integer arithmetic coder with property-based round-trip tests. (2) Three interchangeable models: order-0 KT, an order-k context mixture, and a small pretrained language model running on the GPU with deterministic inference. (3) Evaluate on a Spanish and English corpus: bits per byte, comparison with gzip, bz2 and xz, entropy-rate estimation, and an adjusted rate including model size in the MDL sense. (4) Transmit the compressed stream over a simulated binary symmetric channel using a Hamming or repetition code, measuring residual errors and comparing total rate with capacity (source–channel separation). (5) Classify texts by NCD with each compressor. (6) Report comparing each result with its theoretical bound: entropy, Kraft, H + 1, capacity and adaptive-model regret.
Check what you already know
- Calculate entropy, joint entropy and conditional entropy from a probability table and apply the chain rule.
- Prove KL divergence is nonnegative using Jensen and explain why it is not symmetric.
- Calculate mutual information and apply the data processing and Fano inequalities.
- Explain the typical set and why entropy is the limit of lossless compression.
- Construct a Huffman code and bound its mean length between H and H + 1.
- Derive the gradient of softmax cross-entropy loss with respect to logits and prove its equivalence to maximum likelihood.
- Explain how an arithmetic coder turns a predictive model into a compressor.
- Convert loss in nats per token to perplexity and bits per byte.
- Calculate the capacities of the binary symmetric and erasure channels.
- Calculate closed-form KL between two multivariate Gaussians.
- Prove that with the optimal discriminator, a GAN objective is a Jensen–Shannon divergence.
- Solve a maximum-entropy problem under moment constraints.
- Derive the optimal policy of the KL-penalized RLHF objective.
- Explain why InfoNCE cannot estimate mutual information above log K.
References
- Elements of Information Theory (2.ª ed.)
- Information Theory, Inference, and Learning Algorithms
- Information Theory: From Coding to Learning
- A Mathematical Theory of Communication
- Information Theory and Statistics: A Tutorial
- Probabilistic Machine Learning: Advanced Topics
- MIT 6.441 Information Theory (Spring 2016)
- EE 376A: Information Theory
- Information Theory, Pattern Recognition, and Neural Networks (lecciones en vídeo)