Mathematics · advanced
Information & Entropy
Entropy as surprise, cross-entropy as a loss, KL divergence as a distributional distance.
Mental model
Entropy measures average surprise of a distribution. Cross-entropy compares your predicted distribution to the true one — it's the natural classification loss. KL divergence is asymmetric: how many extra nats you pay when you use Q instead of P.
How to study Information & Entropy
Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use Information Theory (MacKay) to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.
Next, compare Information & Entropy with Softmax & Cross-Entropy, Sampling & Decoding, Embeddings. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Compute cross-entropy in bits and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.
Proof of understanding
- Explain the mechanism from first principles and identify the state it reads or changes.
- Give one situation where the concept is the right choice and one where it is not.
- Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
- Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.
Where it matters
Cross-entropy loss, language model training, variational inference, compression.
Common mistakes
- Treating KL as a metric (it's not symmetric)
- Using log base inconsistently (bits vs nats)
- Confusing entropy of data with entropy of a model
Learn from primary sources
Practice and explain it back
Compute cross-entropy in bits
True distribution P=(0.5, 0.5); model Q=(0.9, 0.1). Compute H(P) and cross-entropy H(P,Q) in bits (log base 2). Which term dominates?
Expected evidence: H(P)=1 bit. H(P,Q)=−0.5 log₂0.9−0.5 log₂0.1≈0.47+1.66≈2.13 bits. The Q=0.1 on the true class (prob 0.5) dominates — being confidently wrong is expensive.
Open the interactive drill →Review prompts
- Why is cross-entropy a natural classification loss?
Build evidence
Use a roadmap capstone to turn this concept into working evidence.