Information Theory — Interview Grill

40 questions on information theory in ML. Drill until you can answer 30+ cold.


A. Foundations

1. Define entropy. . Average surprise / number of bits (or nats) needed to encode an outcome from . Maximum at uniform distribution; minimum () at deterministic.

2. State the bounds on . . Lower bound at deterministic distributions; upper bound at uniform.

3. Why is concave? Mixing two distributions produces higher entropy than the average of their entropies. Intuitively: averaging adds uncertainty. Formally: Jensen's inequality applied to .

4. Define cross-entropy. . Average code length when encoding samples from using a code optimal for . Equals .

5. Why is cross-entropy bounded below by entropy? because KL . You can't encode samples from more efficiently than (Shannon's source coding theorem).

6. Define KL divergence. . Measures how differs from from 's perspective.

7. Three properties of KL. Non-negative (, with equality iff ). Asymmetric (). Not a metric (triangle inequality fails). Coordinate-invariant under reparameterization.


B. Forward vs reverse KL

8. What's the difference between forward and reverse KL? Forward KL is mean-seeking; reverse is mode-seeking. Forward penalizes being small where is large → spreads to cover all of . Reverse penalizes being large where is small → collapses to one mode. MLE uses forward; variational inference uses reverse.

9. Which one does MLE optimize? Forward KL. Minimizing cross-entropy = minimizing . Mean-seeking — the model tries to cover all of the data distribution.

10. Why do MLE-trained models often produce "average" outputs? Forward KL is mean-seeking. If the data has multiple modes (e.g., translations have multiple correct outputs), the model spreads probability across them. Sampling produces an average-looking output that may not match any single mode.

11. When would you use reverse KL? Variational inference (where you want a tractable to fit the most likely mode of the posterior). Some RL methods. Knowledge distillation in some forms.

12. Why do GANs use Jensen-Shannon? where . Symmetric, bounded . The original GAN (Goodfellow 2014) optimizes a JS-related objective. Provides smoother gradients than KL alone.


C. Cross-entropy as ML loss

13. Why is cross-entropy the standard ML loss? Three views: (a) MLE under categorical distribution (likelihood-justified); (b) Forward KL between data and model (mean-seeking); (c) Compression-optimal code length (Shannon).

14. Cross-entropy gradient w.r.t. logits? Predicted minus actual. . Same form as logistic regression — the GLM canonical-link cancellation (sigmoid/softmax derivative kills the from log).

15. Why don't we use MSE for classification? Two reasons. (a) MLE under Bernoulli/categorical mandates cross-entropy; MSE corresponds to a different (Gaussian) generative assumption. (b) MSE+sigmoid has vanishing gradients on confidently-wrong predictions and is non-convex.

16. Walk me through MLE = forward KL minimization. One-line story: Maximizing log-likelihood = minimizing KL from data to model. Entropy of the data is fixed, so it drops out.

Algebra: . The term doesn't depend on , so MLE = forward KL minimization.


D. Mutual information

17. Define mutual information. . Multiple equivalent forms.

18. What does MI measure? How much knowing reduces uncertainty about . If , MI . If perfectly determines , .

19. Properties of MI? Non-negative. Symmetric . .

20. What's InfoNCE? . Contrastive loss; lower bound on . Used in CLIP, MoCo, SimCLR. Trains representations that have high MI with positives, low with negatives.

21. What's the information bottleneck? Tishby et al. 2000. Train representations to maximize (predictive of label) while minimizing (compress input). Theoretical framework for learning compressed yet predictive representations.


E. Conditional and joint entropy

22. Define conditional entropy. . Average uncertainty about given known . Always between 0 and .

23. Chain rule for entropy. . Joint = marginal + conditional. Same as probability chain rule but for entropy.

24. What's in ML? The irreducible "noise" any model has to contend with — the lower bound on cross-entropy loss when predicting from . If , the input perfectly determines the output (deterministic mapping). Otherwise, there's a fundamental limit on prediction quality.


F. KL in machine learning

25. Where does KL appear in VAE training? ELBO: . The KL term penalizes the variational posterior for being far from the prior .

26. Where does KL appear in RLHF? The objective: . KL anchor prevents the policy from drifting too far from the SFT reference. Bounds reward hacking.

27. Where does KL appear in distillation? Train student to match teacher's distribution: . Student inherits teacher's full confidence pattern, not just hard predictions.

28. Why is the KL from the optimal RLHF policy what gives DPO? Closed-form solution to the RLHF objective: . Solve for and substitute into Bradley-Terry. cancels. Result is DPO loss. See 08_training_techniques/ALIGNMENT_DEEP_DIVE.md.

29. KL between two Gaussians? For :

Closed form in dimensions and means. Famous formula; sometimes asked.


G. Other divergences

30. What's the relationship between KL and total variation? Pinsker's inequality: . Bounds TV by KL. Used in concentration bounds and convergence proofs.

31. What's an f-divergence? A family for convex with . KL: . Reverse KL: . JS, Hellinger, are also f-divergences.

32. What's Wasserstein distance and how is it different? Optimal transport distance: minimum cost to "move" mass to transform into , where cost is integrated over the underlying space. Considers geometry of the space (not just distribution mass). Used in WGAN, optimal transport, distribution matching. Stronger smoothness properties than KL.

33. Why might WGAN beat vanilla GAN? Wasserstein gives smoother gradients than JS, especially when and have disjoint supports. Vanilla GAN's JS-based objective can saturate; WGAN's continuous Wasserstein landscape doesn't.


H. Compression connections

34. State Shannon's source coding theorem. The minimum average code length per symbol for a lossless code is . You cannot compress below entropy.

35. What does cross-entropy tell us about compression? Cross-entropy is the average code length when using a code optimal for to encode samples from . Always . Minimizing cross-entropy = finding a near-optimal code (compressor) for the data.

36. How does this relate to LLMs? LLMs are compressors of their training distribution. Better LM → lower cross-entropy → better compression. Modern LLMs can compress text below traditional methods (gzip, etc.) — Deletang et al. 2023.


I. Numerical and gotcha

37. What's the log-sum-exp trick? For numerical stability: . Without this, large logits overflow . Standard in softmax/cross-entropy implementations.

38. Can KL be infinite? Yes. If but for some , then . (Encoding samples from with 's code is impossible — assigns 0 probability to outcomes that occur.)

39. Is the entropy of a mixture always greater than the average entropy? Yes (concavity). . Mixing increases entropy.

40. Why do KL divergences appear in PAC-Bayes / generalization bounds? KL between learned posterior and prior bounds generalization error. Lower KL (posterior close to prior) = tighter generalization bound. PAC-Bayesian framework underpins much of modern generalization theory.


Quick fire

41. Entropy in bits if log base 2. True. 42. Entropy in nats if log base . True. 43. KL is a metric? No. 44. Cross-entropy = entropy + KL. True. 45. MLE = forward KL minimization. True.


Self-grading

If you can't answer 1-15, you don't know information theory. If you can't answer 16-30, you'll struggle on RLHF/distillation interviews. If you can't answer 31-45, frontier-lab interviews will go past you.

Aim for 30+/45 cold.