Information Theory

Entropy, Mutual Information, and the Information Bottleneck

Entropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

status: reviewimportance: criticaldifficulty 4/5math: graduateread: 18mlive demo

Concept Structure

Entropy, Mutual Information, and the Information Bottleneck

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Manipulate the mechanism and watch the idea respond.

2prerequisites
3next concepts
3related links

Learner Contract

What this page should let you do.

You are here becauseEntropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

This Information Theory concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.

By the end4/4 sections ready | runnable code expected | live demo

Explain the mechanism, trace the main notation, and test one prediction in the live demo.

Do this firstIntuition

Read the intuition before the notation; the math should name a mechanism you already felt.

Test the linkManipulate one control and predict the visible change.Then continue to Classification Metrics, Thresholds, and Calibration

Claim/source review status

Substantive review recorded

1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.
Claims1/1 reviewed
Sources5 cited
Codeattached
Demolive
Reviewed2026-07-02
Updatedpage 2026-07-02

Learning item flow

4/4 sections readyAsk about thisResearch room
ConceptEntropy, Mutual Information, and the Information BottleneckInformation Theory
5 sources attachedLocal snapshot ready
concept:information-theory/entropy-mutual-information-information-bottleneck
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

Start with two random variables:

  • XX: what you observe, such as an input pattern, token context, image patch, or hidden state.
  • YY: what you care about predicting, such as a label, next token, class, or downstream fact.

Entropy asks how uncertain one variable is by itself. If XX can land in many plausible states, H(X)H(X) is large. If one state dominates, H(X)H(X) is small.

Mutual information asks a different question: how much does knowing one variable reduce uncertainty about the other? If XX and YY move independently, observing XX does not help with YY, so I(X;Y)=0I(X;Y)=0. If some states of XX strongly tilt the distribution of YY, then I(X;Y)I(X;Y) is positive.

The information bottleneck adds a representation question. Suppose you do not want to keep all of XX. You choose a compressed variable TT made from XX. A useful TT should throw away nuisance detail while keeping information about YY.

So the tension is:

keep less about Xwhilelosing as little as possible about Y.\text{keep less about } X \quad\text{while}\quad \text{losing as little as possible about } Y.

This is a useful lens for representation learning, but it is not a magic explanation of every neural network. In real continuous high-dimensional models, mutual information can be hard to estimate and can depend on the stochastic encoder, noise model, and estimator. This page stays with the finite table where every quantity can be computed exactly.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Let XX and YY be finite discrete random variables with joint distribution

p(x,y)=Pr(X=x,Y=y).p(x,y)=\Pr(X=x,Y=y).

The marginals are

p(x)=yp(x,y),p(y)=xp(x,y).p(x)=\sum_y p(x,y), \qquad p(y)=\sum_x p(x,y).

Using base-2 logarithms, entropy is measured in bits:

H(X)=xp(x)log2p(x).H(X)=-\sum_x p(x)\log_2 p(x).

The convention is that terms with p(x)=0p(x)=0 contribute 00, because limp0+plogp=0\lim_{p\to 0^+}p\log p=0.

Conditional entropy measures the uncertainty left in YY after observing XX:

H(YX)=x,yp(x,y)log2p(yx).H(Y\mid X)=-\sum_{x,y}p(x,y)\log_2 p(y\mid x).

Mutual information is the uncertainty reduction:

I(X;Y)=H(Y)H(YX).I(X;Y)=H(Y)-H(Y\mid X).

Equivalently, it is the KL divergence between the true joint table and the independent table formed from the marginals:

I(X;Y)=x,yp(x,y)log2p(x,y)p(x)p(y)=KL(p(x,y)p(x)p(y)).I(X;Y)=\sum_{x,y}p(x,y)\log_2\frac{p(x,y)}{p(x)p(y)} =\mathrm{KL}(p(x,y)\|p(x)p(y)).

That identity is the operational test for dependence. If p(x,y)=p(x)p(y)p(x,y)=p(x)p(y) everywhere, the log ratio is 00 and I(X;Y)=0I(X;Y)=0. If the joint table differs from independence, mutual information is positive.

Now introduce a representation TT produced from XX. In the most general discrete form, an encoder p(tx)p(t\mid x) defines

p(t,y)=xp(tx)p(x,y).p(t,y)=\sum_x p(t\mid x)p(x,y).

The bottleneck objective can be written as a tradeoff:

maxp(tx)I(T;Y)λI(X;T),\max_{p(t\mid x)} I(T;Y)-\lambda I(X;T),

where λ0\lambda\ge 0 controls how much we punish complexity. The relevance term I(T;Y)I(T;Y) says how much the representation keeps about the target. The complexity term I(X;T)I(X;T) says how much detail about the original input survived.

In the deterministic merge used in the demo, T=g(X)T=g(X), so H(TX)=0H(T\mid X)=0 and

I(X;T)=H(T)H(TX)=H(T).I(X;T)=H(T)-H(T\mid X)=H(T).

That makes the tradeoff visible without estimators. A merge can reduce I(X;T)I(X;T), but because TT is computed from XX, it cannot create new information about YY:

I(T;Y)I(X;Y).I(T;Y)\le I(X;Y).

The best bottleneck is therefore not always the representation with maximum relevance and not always the smallest representation. It depends on the penalty and on which distinctions in XX matter for YY.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

joint = np.array([[0.20, 0.10],
                  [0.15, 0.35],
                  [0.05, 0.15]])

def entropy(p):
    p = np.asarray(p, dtype=float)
    p = p[p > 0]
    return float(-(p * np.log2(p)).sum())

def mutual_information(table):
    table = np.asarray(table, dtype=float)
    px = table.sum(axis=1, keepdims=True)
    py = table.sum(axis=0, keepdims=True)
    independent = px @ py
    mask = table > 0
    return float((table[mask] * np.log2(table[mask] / independent[mask])).sum())

def compress(groups):
    return np.array([joint[group].sum(axis=0) for group in groups])

mappings = {
    "keep all X states": [[0], [1], [2]],
    "merge X1 and X2": [[0], [1, 2]],
    "collapse all": [[0, 1, 2]],
}

print("H(X)", round(entropy(joint.sum(axis=1)), 3))
print("H(Y)", round(entropy(joint.sum(axis=0)), 3))
print("I(X;Y)", round(mutual_information(joint), 3))

lam = 0.10
for name, groups in mappings.items():
    t_y = compress(groups)
    complexity = entropy(t_y.sum(axis=1))      # I(X;T) for deterministic T=g(X)
    relevance = mutual_information(t_y)        # I(T;Y)
    score = relevance - lam * complexity
    print(name, round(complexity, 3), round(relevance, 3), round(score, 3))

The same joint table drives all three quantities. Entropy reads the marginals. Mutual information compares the joint table to the independent product table. The bottleneck step merges rows of XX and checks what target information survives.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

Section prompt

The lab gives you a 3×23\times 2 joint distribution p(X,Y)p(X,Y) and three compression penalties.

First inspect the table. Then choose which representation TT should win under the current score:

score(T)=I(T;Y)λI(X;T).\text{score}(T)=I(T;Y)-\lambda I(X;T).

After you commit, the table reveals the complexity, relevance, conditional uncertainty, and score for every merge. Use the low-penalty and high-penalty settings to see the bottleneck move from "keep the target signal" toward "compress aggressively."

Live Concept Demo

Explore Entropy, Mutual Information, and the Information Bottleneck

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 4/5graduatecode-aligned
Demo Prediction Checkpoint

Manipulate one control and predict the visible change.

Commit to what Entropy, Mutual Information, and the Information Bottleneck should make visible before reading the result.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

Entropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

Prediction open01 / Intuition
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Entropy, Mutual Information, and the Information Bottleneck should make visible.

Visual Inquiry

Make the image answer a mathematical question

Entropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

4/4 stages readyLive demo connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Entropy, Mutual Information, and the Information Bottleneck easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

book · 2016Deep LearningGoodfellow, Bengio, and Courville

Grounds entropy, KL divergence, cross-entropy, and the information-theory notation used in deep learning.

Open source
book · 2026Dive into Deep Learning: Information TheoryZhang, Lipton, Li, and Smola

Grounds entropy, joint entropy, conditional entropy, and mutual information identities for ML learners.

Open source
book · 2022Probabilistic Machine Learning: An IntroductionKevin P. Murphy

Benchmark curriculum source for probability, information, and representation-learning prerequisites.

Open source
paper · 1999The Information Bottleneck MethodTishby, Pereira, and Bialek

Introduces the information bottleneck objective: compress X while preserving information about a relevant variable Y.

Open source
paper · 2017Deep Variational Information BottleneckAlemi, Fischer, Dillon, and Murphy

Modern neural variational bottleneck reference; useful for caveats about estimators and learned stochastic encoders.

Open source

Claim Review

Entropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

Status1 substantive review recorded

Claims without a substantive review badge still need exact source-support review.

Sources5 references

goodfellow-2016-deep-learning, d2l-2026-information-theory, murphy-2022-probml, tishby-1999-information-bottleneck, alemi-2017-deep-variational-information-bottleneck

Local checks4 local checks

Use equations, runnable code, and demos to check whether the source support is operational.

Substantively reviewedFor finite variables, entropy measures uncertainty in one marginal, mutual information measures the KL gap between the joint distribution and independent product marginals, and an information bottleneck trades representation complexity I(X;T) against relevance I(T;Y).Claim metadata: source checked

The sources support the finite entropy and mutual-information formulas, the KL interpretation of dependence, and the bottleneck objective as a compression-relevance tradeoff.

Sources: Deep Learning, Dive into Deep Learning: Information Theory, Probabilistic Machine Learning: An Introduction, The Information Bottleneck Method, Deep Variational Information BottleneckThis concept does not claim that information bottleneck universally explains all deep neural networks. The demo uses finite discrete variables and deterministic merges, not continuous neural activations or difficult mutual-information estimation.A bounded review summary is present; still check caveats and exact reference scope.

Checked Goodfellow Ch.3 and D2L information-theory appendix for entropy, conditional entropy, KL, cross-entropy, and mutual-information identities; checked Tishby, Pereira, and Bialek for the compression/relevance variational framing; checked Alemi et al. for the neural variational bottleneck context and caveat that high-dimensional learned bottlenecks are estimator- and modeling-dependent. The local page restricts the interactive contract to finite discrete tables and deterministic merges.

Reviewer: codex-local-source-audit; reviewed 2026-07-02

Practice Loop

Try the idea before it explains itself

Entropy measures uncertainty, mutual information measures dependence in a joint table, and the information bottleneck asks which compressed representation keeps the information that matters.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Entropy, Mutual Information, and the Information Bottleneck.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Grounded research drawerClose
ConceptEntropy, Mutual Information, and the Information BottleneckInformation Theory

Research Room

Attach the question to a claim, equation, code, or demo

Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptInformation Theory

Entropy, Mutual Information, and the Information Bottleneck

Attached question

What is the smallest example that makes Entropy, Mutual Information, and the Information Bottleneck click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays in this browser, attached to the selected learning item.

No local draft saved.
Evidence to inspect
  • References to inspect: attached references on this page.
  • Definition, prerequisite, and contrast concept links
  • The equation or runnable code that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Entropy, Mutual Information, and the Information Bottleneck Selected item key: recorded for copy. Context: Information Theory Page anchor: recorded for copy. Open question: What is the smallest example that makes Entropy, Mutual Information, and the Information Bottleneck click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

View it in context
concept/concept-notebook/information-theory/entropy-mutual-information-information-bottleneck concept:information-theory/entropy-mutual-information-information-bottleneck