TExcelTAD
Home › Information Theory › The Information Bottleneck

The Information Bottleneck

A good representation of data should keep what matters for the task and throw away the rest. The information bottleneck (Tishby, Pereira and Bialek, 1999) makes this precise: compress XX into a representation TT that is as small as possible (low I(X;T)I(X; T)) while staying as informative as possible about a target YY (high I(T;Y)I(T; Y)). It is rate-distortion theory where the "distortion" is lost information about YY.

The objective

With the Markov chain Y→X→TY \to X \to T (the representation sees only XX), minimize over encoders P(t∣x)P(t \mid x):

L=I(X;T)−β I(T;Y)\mathcal{L} = I(X; T) - \beta\, I(T; Y)

A small β\beta favours compression (everything collapses into one cluster); a large β\beta favours keeping information about YY. By the data-processing inequality, I(T;Y)≤I(X;Y)I(T; Y) \le I(X; Y) always (The Data-Processing Inequality).

The iterative algorithm

For discrete variables the optimum satisfies self-consistent equations, solved by alternating updates like Blahut-Arimoto (Rate-Distortion Theory):

P(t∣x)∝P(t)exp⁡(−βDKL(P(y∣x)∥P(y∣t)))P(t \mid x) \propto P(t)\exp\left(-\beta D_{\text{KL}}\big(P(y \mid x) \parallel P(y \mid t)\big)\right)

followed by recomputing P(t)P(t) and P(y∣t)P(y \mid t) from the encoder.

python · try it yourself
import numpy as np

def mi(P):
    Q = np.outer(P.sum(axis=1), P.sum(axis=0)); nz = P > 1e-15
    return max(0.0, float(np.sum(P[nz] * np.log2(P[nz] / Q[nz]))))       # clip rounding below 0

def information_bottleneck(Pxy, n_t, beta, rng, iters=300):
    px = Pxy.sum(axis=1); py_x = Pxy / px[:, None]
    enc = rng.dirichlet(np.ones(n_t), size=len(px))          # P(t | x)
    for _ in range(iters):
        pt = px @ enc
        py_t = (enc * px[:, None]).T @ py_x / np.maximum(pt[:, None], 1e-15)
        kl = np.sum(py_x[:, None, :] * np.log(py_x[:, None, :] / np.maximum(py_t[None, :, :], 1e-15)), axis=2)
        logits = np.log(np.maximum(pt, 1e-15))[None, :] - beta * kl
        enc = np.exp(logits - logits.max(axis=1, keepdims=True)); enc /= enc.sum(axis=1, keepdims=True)
    Pxt = enc * px[:, None]
    Pty = Pxt.T @ py_x
    return mi(Pxt), mi(Pty), enc

# 8 values of x; y in {0, 1}; x values come in groups with similar P(y | x)
py1 = np.array([0.05, 0.1, 0.1, 0.5, 0.5, 0.55, 0.9, 0.95])
Pxy = np.column_stack([1 - py1, py1]) / 8
print(f"I(X;Y) = {mi(Pxy):.4f} bits,  H(X) = 3 bits")
rng = np.random.default_rng(0)
for beta in [0.5, 2, 5, 20, 100]:
    Ixt, Ity, enc = information_bottleneck(Pxy, 4, beta, rng)
    print(f"beta = {beta:5}: I(X;T) = {Ixt:.4f}, I(T;Y) = {Ity:.4f}")
I(X;Y) = 0.3729 bits,  H(X) = 3 bits
beta =   0.5: I(X;T) = 0.0000, I(T;Y) = 0.0000
beta =     2: I(X;T) = 0.0000, I(T;Y) = 0.0000
beta =     5: I(X;T) = 0.8966, I(T;Y) = 0.2750
beta =    20: I(X;T) = 1.5572, I(T;Y) = 0.3683
beta =   100: I(X;T) = 1.5613, I(T;Y) = 0.3685

Below a critical value of β\beta (here between 2 and 5) the trivial solution, one cluster that ignores XX, is optimal. As β\beta grows, TT keeps more about XX and more about YY. The relevant information saturates near I(X;Y)I(X; Y) long before TT remembers all 3 bits of XX: most of the identity of xx is irrelevant to yy.

What the bottleneck learns

At moderate β\beta the encoder clusters xx values whose conditional distributions P(y∣x)P(y \mid x) are similar: a representation that is "sufficient" for YY without copying XX.

python · try it yourself
import numpy as np

def information_bottleneck(Pxy, n_t, beta, rng, iters=300):
    px = Pxy.sum(axis=1); py_x = Pxy / px[:, None]
    enc = rng.dirichlet(np.ones(n_t), size=len(px))
    for _ in range(iters):
        pt = px @ enc
        py_t = (enc * px[:, None]).T @ py_x / np.maximum(pt[:, None], 1e-15)
        kl = np.sum(py_x[:, None, :] * np.log(py_x[:, None, :] / np.maximum(py_t[None, :, :], 1e-15)), axis=2)
        logits = np.log(np.maximum(pt, 1e-15))[None, :] - beta * kl
        enc = np.exp(logits - logits.max(axis=1, keepdims=True)); enc /= enc.sum(axis=1, keepdims=True)
    return enc

py1 = np.array([0.05, 0.1, 0.1, 0.5, 0.5, 0.55, 0.9, 0.95])
Pxy = np.column_stack([1 - py1, py1]) / 8
enc = information_bottleneck(Pxy, 4, 20, np.random.default_rng(0))
clusters = enc.argmax(axis=1)
relabel = {c: i for i, c in enumerate(dict.fromkeys(clusters.tolist()))}
for x in range(8):
    print(f"x = {x}  P(y=1|x) = {py1[x]:.2f}  -> cluster {relabel[int(clusters[x])]}")
x = 0  P(y=1|x) = 0.05  -> cluster 0
x = 1  P(y=1|x) = 0.10  -> cluster 0
x = 2  P(y=1|x) = 0.10  -> cluster 0
x = 3  P(y=1|x) = 0.50  -> cluster 1
x = 4  P(y=1|x) = 0.50  -> cluster 1
x = 5  P(y=1|x) = 0.55  -> cluster 1
x = 6  P(y=1|x) = 0.90  -> cluster 2
x = 7  P(y=1|x) = 0.95  -> cluster 2

The eight inputs fall into three clusters, one per level of P(y=1∣x)P(y = 1 \mid x): low, middle and high.

The bottleneck and deep learning

Tishby and colleagues proposed viewing each layer of a neural network as a representation TT on the information plane (I(X;T),I(T;Y))(I(X; T), I(T; Y)), and suggested that training first fits (raises I(T;Y)I(T; Y)) and then compresses (lowers I(X;T)I(X; T)). Later work showed the compression phase depends on the activation function and on how mutual information is estimated, so the picture is debated. The variational information bottleneck turns the objective into a trainable loss with a KL penalty, closely related to the variational autoencoder, and is used as a regularizer.

In software

  • The variational information bottleneck adds β⋅DKL(q(t∣x)∥r(t))\beta \cdot D_{\text{KL}}(q(t \mid x) \parallel r(t)) to a classification loss, with a Gaussian encoder, which is easy to write in any deep-learning framework.
  • For discrete data, the iterative algorithm above clusters words by their context distributions (distributional clustering) and documents by their word distributions.

Exercises

Exercise 1: Extremes

What does the bottleneck solution look like for β→0\beta \to 0, and for β→∞\beta \to \infty?

Answer

β→0\beta \to 0: a single cluster, I(X;T)=0I(X; T) = 0. β→∞\beta \to \infty: TT keeps all relevant information, I(T;Y)=I(X;Y)I(T; Y) = I(X; Y).

Solution

With no reward for relevance, any information about XX is pure cost. With an enormous reward, the encoder separates every pair of inputs with different P(y∣x)P(y \mid x).

Exercise 2: An upper bound

Can I(T;Y)I(T; Y) ever exceed I(X;Y)I(X; Y)?

Answer

No.

Solution

TT is computed from XX alone, so Y→X→TY \to X \to T is a Markov chain and the data-processing inequality applies.

Exercise 3: Sufficient clustering (code)

Merge the inputs of the lesson's example into the three groups {0, 1, 2}, {3, 4, 5}, {6, 7} and compute I(T;Y)I(T; Y) and I(X;T)I(X; T) for this deterministic TT.

Answer

I(T;Y)≈0.369I(T; Y) \approx 0.369 bits, almost all of I(X;Y)≈0.373I(X; Y) \approx 0.373, with I(X;T)≈1.56I(X; T) \approx 1.56 bits: the same point the algorithm found at β=20\beta = 20.

Solution
python · try it yourself
import numpy as np

def mi(P):
    Q = np.outer(P.sum(axis=1), P.sum(axis=0)); nz = P > 0
    return float(np.sum(P[nz] * np.log2(P[nz] / Q[nz])))

py1 = np.array([0.05, 0.1, 0.1, 0.5, 0.5, 0.55, 0.9, 0.95])
Pxy = np.column_stack([1 - py1, py1]) / 8
groups = np.array([0, 0, 0, 1, 1, 1, 2, 2])
Pty = np.array([Pxy[groups == g].sum(axis=0) for g in range(3)])
Pxt = np.zeros((8, 3)); Pxt[np.arange(8), groups] = 1 / 8
print(round(mi(Pty), 4), round(mi(Pxy), 4), round(mi(Pxt), 4))
0.3685 0.3729 1.5613

Test yourself

The information bottleneck trades off…

  1. compression I(X;T)I(X; T) against relevance I(T;Y)I(T; Y)
  2. accuracy against speed
  3. entropy against variance
  4. bias against capacity

Which inequality guarantees I(T;Y)≤I(X;Y)I(T; Y) \le I(X; Y)?

  1. the data-processing inequality
  2. Kraft's inequality
  3. Fano's inequality
  4. the Hamming bound

At moderate beta, the discrete bottleneck tends to…

  1. cluster inputs with similar P(y∣x)P(y \mid x)
  2. copy X exactly
  3. ignore X completely
  4. maximize H(T)