25.6 Mutual Information
The previous sections compared two distributions over the same variable, such as a data distribution and a model. Many questions in deep learning concern a pair of variables instead: an image and its caption, two crops of the same photograph, or a sentence and its translation. How much does one variable tell us about the other?
The standard measure of dependence, the correlation coefficient, detects only linear relationships. Consider and let , where is independent noise. Because is symmetric around zero, , so the correlation between and is zero. Yet nearly determines : once we know , varies only by noise of standard deviation , whereas on its own spreads roughly from to . The quantity we define in this section captures this dependence readily—in fact, it credits this pair with more shared information than a bivariate Gaussian with correlation .
What we want is a measure that equals zero if and only if two variables are independent, grows as their dependence strengthens, and remains unchanged when either variable is re-expressed in different coordinates. We already have the exact tool needed to build it: the KL divergence from Section 25.1, which by Gibbs' inequality is always nonnegative and vanishes only when . Taking to be the true joint distribution of the pair and to be the product distribution the pair would follow if its components were independent gives the mutual information .
Defining mutual information is straightforward; its real value lies in what follows from it. We establish three fundamental results. First, processing a variable cannot increase its mutual information with anything else, so no layer of a neural network carries more information about the input than the layer below it. Second, a classifier cannot reach a given error rate unless its input carries a minimum amount of information about the label. Third, the test loss of any probabilistic model directly certifies a lower bound on that information. We then turn to Shannon's two foundational questions (how much information a noisy channel can carry and how little a lossy compressor must keep) and a third question that grows out of compression: what should a learned representation keep? Throughout this section we assume the underlying distributions are known; estimating mutual information from samples alone is a harder problem that we take up in Section 25.7.
As before, we work in nats, where bit nats. All logarithms are natural; we write in general formulas and when evaluating numerical values. We denote the binary entropy by .
25.6.1 Measures of Dependence#
To keep every definition concrete, we evaluate each one first on a single probability table, which will return as a running example throughout the section.
25.6.1.1 Joint and Conditional Entropy#
Let be a fair bit, and let be a copy of that is flipped with probability . We can read as a bit sent over a noisy line and as the bit received, or read as a binary label and as a noisy feature that agrees with it of the time. Because the table is symmetric, nothing below depends on which interpretation we choose. With rows indexing and columns indexing , the joint distribution is
and summing rows and columns gives the marginals . We call this pair the flipped bit. Throughout, subscripts name the variables of a distribution, and we drop them when the arguments already make the distribution clear, as in the conditional .
Beyond the individual entropies and , a pair of random variables has two natural entropies, both introduced in Section 25.1.1.3. The joint entropy is the entropy of the pair viewed as a single random variable—here one with four outcomes:
For our table, nats. That is larger than the nats of a single fair bit, but smaller than the nats of two independent fair bits.
The conditional entropy measures the surprise remaining in once is known. It is the average entropy of the conditional rows :
For the flipped bit, the two rows are and , each with entropy nats, so nats. Even after observing , still retains of its original nats of surprise.
Notice that the three numbers satisfy . This is the chain rule from Section 25.1.1.3: the surprise in the pair equals the surprise in plus the additional surprise in once is known.
25.6.1.2 Mutual Information#
Conditional entropy captures the part of the surprise in that cannot explain. What we want now is the part the two variables share. If and were independent, their joint distribution would be the product of their marginals, , placing in every cell. The mutual information is the KL divergence from the actual joint distribution to that independent product:
For the flipped bit, the product of the marginals puts in every cell. The ratio of the joint probability to the independent product is therefore on the diagonal, where and agree, and off the diagonal, where they disagree. Averaging the log-ratios under the joint distribution gives
Agreements occur times as often as independence predicts, and disagreements one fifth as often; mutual information is simply the expected logarithm of this factor. Because a KL divergence also measures the extra code length incurred by using the wrong model (Section 25.2), is the number of nats per pair wasted by a code that treats and as independent. We encounter this exact penalty in Section 17.9, when a network predicts two masked tokens independently.
We can also read (25.6.3) one row of the table at a time. Dividing numerator and denominator by turns the ratio into , rewriting the expectation over pairs as an average over of the KL divergence between the conditional and marginal distributions of :
In this form, mutual information measures how far, on average, observing shifts the distribution of away from its marginal. For the flipped bit, each conditional row, or , lies nats from the marginal . This asymmetric perspective is especially natural when the two variables play different roles, such as an input and the output of a noisy encoder, and we will return to it in Section 25.6.4.
Proposition (properties of mutual information). For any pair , , with equality if and only if and are independent. When the entropies involved are finite,
Proof. Swapping and leaves the ratio in (25.6.3) unchanged, which proves symmetry. Nonnegativity and the equality condition follow immediately from Gibbs' inequality applied to and : the KL divergence is nonnegative and vanishes if and only if everywhere, which is the definition of independence. To obtain the entropy identities, split the logarithm of the ratio into three terms and take expectations:
Substituting the chain rule in its two orders, , yields the remaining two forms.
Thus says exactly as much about as says about . The final identity interprets mutual information as a reduction in uncertainty: observing lowers the surprise in from to —for the flipped bit, from down to nats. Nonnegativity also implies the subadditivity bound , with equality only at independence: a pair never carries more surprise than its components taken separately. Figure 25.6.1 illustrates these relationships visually; each identity in the proposition is simply a different way of reading off the area of the overlap.
Mutual information as the overlap of the entropies and : the crescents are the conditional entropies and , the union is the joint entropy , and the three equivalent expressions for follow by reading off the areas.
The function mutual_information below implements the divergence form for any
discrete joint table, and we will reuse it throughout the section. The cell
also checks the identity by averaging the row
entropies.
p_xy = np.array([[0.45, 0.05], # rows x, columns y: a fair bit X and
[0.05, 0.45]]) # its copy Y, flipped with probability 0.1
def entropy(p):
"""Entropy of a p.m.f. of any shape, in nats (0 log 0 = 0)."""
p = p[p > 0]
return float(-(p * np.log(p)).sum())
def mutual_information(p_xy):
"""I(X;Y) of a discrete joint p.m.f. (rows x, columns y), in nats."""
p_x = p_xy.sum(axis=1, keepdims=True)
p_y = p_xy.sum(axis=0, keepdims=True)
m = p_xy > 0 # 0 log 0 = 0
return float((p_xy[m] * np.log(p_xy[m] / (p_x * p_y)[m])).sum())
p_x, p_y = p_xy.sum(axis=1), p_xy.sum(axis=0) # marginals from the joint
H_rows = sum(p_x[i] * entropy(p_xy[i] / p_x[i]) for i in range(2)) # H(Y|X)
I = mutual_information(p_xy)
print(f'I(X;Y) = {I:.4f} nats (KL form) = {entropy(p_y) - H_rows:.4f} '
f'(H(Y) - H(Y|X)) = {I / np.log(2):.3f} bits')
I(X;Y) = 0.3681 nats (KL form) = 0.3681 (H(Y) - H(Y|X)) = 0.531 bits
Both expressions return nats, or bits: a copy that flips one time in ten still conveys just over half a bit about the original.
25.6.1.3 The Gaussian Pair#
So far we have worked with discrete tables, whereas most variables in deep learning (activations, gradients, and embeddings) are continuous. One continuous case can be computed completely by hand: the bivariate Gaussian. It will serve as our second running example and form the foundation for both the rate–distortion curve and the information bottleneck later in this section. For continuous densities, discrete entropies are replaced by the differential entropies of Section 25.1.4.1, which can be negative and depend on the units of measurement. The KL definition of mutual information suffers from neither drawback. Because the chain-rule algebra never relied on discreteness, whenever these quantities are finite, where denotes the differential entropy of the conditional density , averaged over .
Proposition (Gaussian mutual information). If is bivariate Gaussian with variances and correlation coefficient , , then
Proof. We use . A Gaussian variable with variance has differential entropy (Section 25.1.4.3), so . Conditioned on , remains Gaussian with variance , regardless of . This is the variance of the residual left after subtracting the best linear prediction of from , and for a bivariate Gaussian that residual is independent of (Section 24.3.3.3). Hence , and subtracting gives .
The result depends solely on , the fraction of 's variance left unexplained by . Notice that the units of have cancelled out—our first glimpse of the coordinate invariance proved in Section 25.6.1.5.
When , the variables are independent and . As , the joint density collapses onto a straight line and . Between those extremes, yields nats, yields nats, and yields nats. The bivariate Gaussian with standard normal marginals and will reappear throughout this section; we refer to it as the Gaussian pair at .
As the limit shows, mutual information can indeed be infinite. This phenomenon will come up twice later—for deterministic layers of a neural network and for the encoder of the information bottleneck. If for a continuous random variable , knowing pins down to infinitely many decimal places, and the same holds whenever is a deterministic function of that takes no single value with positive probability. By contrast, infinite mutual information is impossible when is discrete with finite entropy: then regardless of , where averages the entropy of over . For a standard normal , for instance, the sign of carries exactly nats. This same ceiling caps the Jensen–Shannon divergence of Section 16.1 at : as shown there, it equals the mutual information between a sample and the binary label identifying its source.
25.6.1.4 Pointwise Mutual Information#
Mutual information averages over all pairs of outcomes, which hides which specific pairs drive the dependence. Often a single pair is what we care about: does seeing the word new make the next word york much more likely than chance? The summand inside (25.6.3) answers this directly. It is the pointwise mutual information,
which compares how often the specific pair occurs with how often it would occur if and were independent. A positive pmi indicates that the two outcomes attract (they co-occur more often than chance predicts), a negative pmi indicates that they repel, and is their average attraction. For the flipped bit, the pmi is on the two agreeing cells and on the two disagreeing cells—the exact logarithms we averaged earlier.
Pointwise mutual information is a classic tool in natural language processing (Church and Hanks, 1990), where it separates collocations, word pairs that naturally belong together, from words that co-occur simply because both are common. Suppose we count consecutive word pairs (bigrams) in a small corpus and tally how often each of new, machine, and the is followed by york, learning, or day:
| count | york | learning | day |
|---|---|---|---|
| new | 38 | 3 | 9 |
| machine | 1 | 46 | 3 |
| the | 11 | 21 | 168 |
Raw counts are misleading here. "The day" is by far the most frequent pair ( occurrences versus for "new york") simply because the and day are both high-frequency words. The code below divides each joint frequency by the product of its two marginal word frequencies, prints the resulting pmi for four pairs, and reports the mutual information of the full table.
counts = np.array([[38., 3., 9.], # new york / new learning / new day
[1., 46., 3.], # machine ...
[11., 21., 168.]]) # the ...
first, second = ['new', 'machine', 'the'], ['york', 'learning', 'day']
p = counts / counts.sum()
pmi = np.log(p / (p.sum(axis=1, keepdims=True) * p.sum(axis=0, keepdims=True)))
for (i, j) in [(0, 0), (1, 1), (2, 2), (2, 0)]:
print(f'pmi({first[i]}, {second[j]}) = {pmi[i, j]:6.3f} nats '
f'(count {counts[i, j]:.0f})')
print(f'I(first; second) = {float((p * pmi).sum()):.4f} nats')
pmi(new, york) = 1.517 nats (count 38)
pmi(machine, learning) = 1.372 nats (count 46)
pmi(the, day) = 0.336 nats (count 168)
pmi(the, york) = -1.109 nats (count 11)
I(first; second) = 0.4146 nats
Once we correct for the marginals, the true collocations rise to the top: "new york" scores nats and "machine learning" scores , whereas the frequent pair "the day" reaches only . Meanwhile, "the york" is negative at nats, occurring roughly three times less often than independence would predict. The mutual information of the table, nats, summarizes how strongly the first word constrains the second on average. This same marginal correction reappears in learned word embeddings (Section 18.1): by training a skip-gram model to distinguish observed pairs of neighboring words from random pairs, we implicitly factorize the matrix of shifted pointwise mutual informations, (Levy and Goldberg, 2014), as Exercise 7 of Section 25.7 derives.
25.6.1.5 Mutual Information and Correlation#
The correlation coefficient of Section 24.2 detects only linear dependence: having does not imply independence. Mutual information, by contrast, vanishes if and only if the variables are independent. Returning to our opening example makes this difference concrete.
Let and with independent , a pair whose correlation is . Writing lets us evaluate the mutual information using one-dimensional integrals. Conditioned on , the only randomness left in is the additive noise, and shifting a distribution by the known constant leaves differential entropy unchanged, so nats. Before computing numerically, we can bound it analytically: has variance , and among all densities with a given variance the Gaussian maximizes differential entropy (Section 25.1.4.3), giving nats and thus nats. Because the marginal density of is a continuous mixture over , , with no closed form, we integrate it numerically to obtain .
normal = lambda t, var: np.exp(-t**2 / (2 * var)) / np.sqrt(2 * np.pi * var)
xs = np.linspace(-6, 6, 6001) # quadrature grid for X
ys = np.linspace(-2.5, 30, 6501) # grid for Y = X^2 + 0.3 eps
dx, dy = xs[1] - xs[0], ys[1] - ys[0]
p_Y = np.concatenate([ # p_Y(y) = int N(x;0,1) N(y;x^2,0.09) dx
(normal(xs, 1) * normal(c[:, None] - xs**2, 0.09)).sum(axis=1) * dx
for c in np.array_split(ys, 13)]) # 13 chunks keep memory small
h_Y = float(-(p_Y[p_Y > 0] * np.log(p_Y[p_Y > 0])).sum() * dy)
h_noise = 0.5 * np.log(2 * np.pi * np.e * 0.09) # h(Y|X) = h(0.3 eps)
print(f'h(Y) = {h_Y:.3f}, h(Y|X) = {h_noise:.3f}, '
f'I(X;Y) = h(Y) - h(Y|X) = {h_Y - h_noise:.3f} nats')
h(Y) = 1.356, h(Y|X) = 0.215, I(X;Y) = h(Y) - h(Y|X) = 1.141 nats
The pair shares nats. This sits well below our Gaussian upper bound of nats because the density of —concentrated near zero with a long right tail—is far from Gaussian. At the same time, it exceeds the nats of the Gaussian pair at , even though its linear correlation is zero. Figure 25.6.2 compares all three cases side by side.
Three pairs compared by correlation and by mutual information. (a) A Gaussian pair with correlation . (b) , whose correlation vanishes by symmetry even though nearly determines ; note the different vertical scale in (b). (c) An independent pair. Correlation cannot distinguish (b) from (c), whereas mutual information ranks (b) above (a).
Correlation and mutual information differ in a second fundamental way: their behavior under changes of coordinates. Measuring temperature in Fahrenheit instead of Celsius, or recording a price on a logarithmic scale, changes nothing about how informative that variable is about anything else, so a principled measure of dependence should remain invariant.
Proposition (reparameterization invariance). Let and be invertible maps of the values of and of . Then .
Proof. For discrete variables, invertible maps simply relabel the outcomes: the joint distribution of assigns the same probabilities as that of to the relabeled outcomes, leaving the sum in (25.6.3) unchanged. For continuous variables, we prove the smooth case here to show the mechanism; Section 25.6.2.2 removes the smoothness assumption. Suppose and are continuously differentiable with continuously differentiable inverses, and change variables via . The joint density of the transformed pair at is , while the two marginal densities pick up the factors and . Those Jacobian factors cancel in the density ratio, so the integrand of (25.6.3) takes the same value at corresponding points, and its expectation is unchanged. A set of exceptional points of probability zero, such as the origin for , does not affect the integral.
Differential entropy lacks this invariance because its Jacobian factor has nothing to cancel against, which is why depends on units. Correlation is preserved only by affine transformations (up to sign). Applying the invertible map to the first coordinate of the Gaussian pair at , for example, leaves mutual information fixed at nats, while the correlation drops from to (since and for standard normal ). Mutual information asks whether two variables carry information about each other in any coordinates, not whether they happen to lie along a straight line.
25.6.2 Processing and Prediction#
We now establish the three results promised in the introduction. The first two are fundamental limits: processing data cannot create information, and accurate prediction requires a minimum amount of it. Both follow from a single identity, the chain rule for mutual information. The third result turns the cross-entropy loss of any probabilistic model into a direct lower bound on the information carried by its input.
25.6.2.1 Conditional Mutual Information and the Chain Rule#
Let us extend the flipped bit by one step. Suppose is produced by flipping once more, independently, with probability —a fair bit sent over two noisy lines in series, or a label followed by a noisy feature and a noisy copy of that feature (Figure 25.6.3). Two flips in series act as a single flip: the bit arrives inverted if and only if exactly one of the two lines flips it, which happens with probability . The pair is therefore a flipped bit with , giving nats. The second noisy line has wiped out two thirds of the nats that carried.
Two flips in series: a fair bit is flipped with probability to give , and is flipped with probability to give ; the two flips compose to a single flip with probability . The second flip removes two thirds of the information, and expresses that knows nothing about that does not already know.
With three variables, a new question arises: how much information do and share once is already known? Just as entropy has a conditional version, so does mutual information:
where is the conditional entropy of given the pair . Writing each conditional entropy as an expectation and combining the logarithms yields the divergence form , which is simply the ordinary mutual information averaged over the conditional distributions for each value of . Because it is an expectation of KL divergences, is always nonnegative, and it equals zero if and only if and are conditionally independent given .
This definition lets us split the information that the pair carries about into two pieces. Subtracting and adding inside gives
This identity is the chain rule for mutual information, and it holds in full generality when each term is written in KL form. In words, what tells us about equals what tells us plus what adds once is known. We can equally well condition on first. For our two flips in series, the two orderings decompose the same total in two ways. Because is generated from and independent noise, once is known adds nothing further about : , so putting first gives nats. Putting first splits the same nats as , leaving nats. Here conditioning on reduced what reveals about , because already holds part of that information. As we will see in the next subsection, however, conditioning can also increase mutual information.
25.6.2.2 The Data-Processing Inequality#
In a neural network, each hidden layer is computed from the layer below it, which in turn is computed from the input. Can such processing ever create information about the input that the earlier layer did not already contain? For the two noisy lines the answer was no, and the reason has nothing to do with bits in particular.
Three random variables form a Markov chain, written , when depends on solely through , meaning . This captures the exact structure of sequential processing: is produced from (a measurement, feature map, or hidden layer), and is then computed from alone, possibly with fresh randomness. Equivalently, and are conditionally independent given , so .
Proposition (data-processing inequality). If is a Markov chain and the entropies involved are finite, then
with equality if and only if , that is, if and only if is also a Markov chain (Cover and Thomas, 1999).
Proof. Expand by the chain rule in both orders:
By the Markov property the last term vanishes, leaving , since conditional mutual information is nonnegative. Equality holds if and only if .
No processing of , whether deterministic or randomized, can increase the information it carries about . For our two flips in series, the inequality simply reads .
Notice that this inequality relies strictly on the Markov chain structure, not on conditioning in general: outside a Markov chain, conditioning can create dependence where none existed. Suppose and are independent fair bits and is their exclusive or. Marginally and share zero information, yet once is revealed, determines completely. The code below computes the mutual informations for both the two flips in series and this XOR triple.
def cond_mi(p_abc):
"""I(A;B|C) of a joint p.m.f. indexed [a, b, c], in nats."""
p_ac, p_bc, p_c = p_abc.sum(1), p_abc.sum(0), p_abc.sum((0, 1))
m = p_abc > 0 # 0 log 0 = 0
ratio = ((p_abc * p_c[None, None, :])[m]
/ (p_ac[:, None, :] * p_bc[None, :, :])[m])
return float((p_abc[m] * np.log(ratio)).sum())
flip = lambda d: np.array([[1 - d, d], [d, 1 - d]]) # p(output | input)
p_xyz = 0.5 * flip(0.1)[:, :, None] * flip(0.2)[None, :, :] # X -> Y -> Z
I_xy, I_xz = mutual_information(p_xyz.sum(2)), mutual_information(p_xyz.sum(1))
I_xz_y, I_xy_z = cond_mi(p_xyz.transpose(0, 2, 1)), cond_mi(p_xyz)
print(f'I(X;Y) = {I_xy:.4f}, I(X;Z) = {I_xz:.4f}, '
f'I(X;Z|Y) = {I_xz_y:.4f}, I(X;Y|Z) = {I_xy_z:.4f}')
print(f'I(X;Y,Z) by the chain rule: {I_xz + I_xy_z:.4f} = {I_xy + I_xz_y:.4f}')
p_xor = np.zeros((2, 2, 2))
for a, b in np.ndindex(2, 2):
p_xor[a, b, a ^ b] = 0.25 # independent fair bits, Z = X xor Y
print(f'XOR: I(X;Y) = {mutual_information(p_xor.sum(2)):.4f}, '
f'I(X;Y|Z) = {cond_mi(p_xor):.4f} nats')
I(X;Y) = 0.3681, I(X;Z) = 0.1201, I(X;Z|Y) = 0.0000, I(X;Y|Z) = 0.2480
I(X;Y,Z) by the chain rule: 0.3681 = 0.3681
XOR: I(X;Y) = 0.0000, I(X;Y|Z) = 0.6931 nats
For the two flips, confirms the Markov property numerically, and both chain-rule decompositions of yield nats. For the exclusive or, conditioning on boosts the mutual information between and from to the full nats of a bit.
When does processing lose no information at all? By the proposition, equality holds if and only if is also a Markov chain, meaning retains everything tells us about . An invertible transformation certainly achieves this, since can be recovered from . Yet a map can also discard part of without losing information about , as long as whatever it discards is unrelated to . For example, the total number of heads in a sequence of coin flips preserves everything the sequence says about the coin's bias, because the order of the flips carries no information about that bias. Any summary with this property (so that depends on only through , and therefore ) is called a sufficient statistic. The sufficient statistics of an exponential family (Section 24.4) are precisely summaries of this kind, with playing the role of the data and the parameter (equipped with a prior so that is well defined).
The data-processing inequality itself requires neither finite entropies nor densities. Because mutual information is a KL divergence, and no map of the data, random or deterministic, can increase a KL divergence (Section 25.3.3.3 proves this for countable sets, and it holds in full generality), Exercise 4 turns that fact into a general proof of the inequality. Applying the inequality once to an invertible map and once to its inverse also yields the reparameterization invariance of Section 25.6.1.5 without needing smoothness.
When applied to deep networks, the data-processing inequality is easy to misread. The layers of a network form a Markov chain , so cannot increase with depth . From here to the end of this part, let denote a prediction label rather than the middle variable of a chain. Whatever a network knows about the label must pass through the input, so is also a Markov chain, and cannot increase with either. No architecture can conjure up label information that was absent from the input, and no later layer can recover information that an earlier layer threw away.
This does not mean depth is unhelpful. Hidden layers do not add information about the label; rather, they reorganize existing information so that a simple final layer can read it out. Suppose the label is a fair bit, and the input is uniform on the circle of radius when and on the circle of radius when . The input determines the label exactly, so , yet no straight line separates two concentric circles. The best linear classifier places its decision boundary tangent to the inner circle: it classifies the entire inner circle correctly, along with the one third of the outer circle that lies beyond the line, achieving an accuracy of . Now apply a single nonlinear feature , which takes only the values and . A simple threshold between them classifies every point perfectly, even though is no larger than . The transformation added no information, yet made all of it linearly readable. Exercise 2 formalizes a notion of usable information that counts only what a restricted family of classifiers can extract.
One final caution applies to the input chain . For a deterministic layer, . If the representation is discrete or quantized, simply reduces to the entropy ; if it is continuous, is typically infinite (Section 25.6.1.3). As a measure of how much a layer retains about its input, is therefore meaningful only when the layer injects noise or produces a discrete output.
25.6.2.3 Fano's Inequality#
Accurate prediction demands mutual information. A classifier that achieves error across classes must receive an input carrying most of the label's entropy, and Fano's inequality tells us exactly how much.
Proposition (Fano's inequality). Let take values in a set of elements, let be any estimate of computed from and taking values in the same set, and let be its error probability. Then
The left-hand side has a clean coding interpretation as the cost of repairing the estimate : it takes nats to specify whether is wrong, and whenever it is wrong (with probability ), at most nats to specify which of the remaining labels is correct. Anyone who has both the estimate and the repair knows exactly, so the repair cannot cost less than the uncertainty about left by —which, by data processing, is at least the uncertainty left by .
The proof turns this intuition into an exact bound using a single device: an indicator variable for whether an error occurred. The rest is just the chain rule.
Proof. Let be the error indicator. We expand , the remaining uncertainty about both the error and the true label given the estimate, in two ways. First, is completely determined by and therefore adds no entropy, so . Second, the chain rule gives , and we bound each term separately:
- Conditioning cannot increase entropy, since . Therefore .
- When , the label equals and has zero uncertainty. When (which happens with probability ), the label must be one of the values other than , so its entropy is at most . Averaging over gives .
Combining both bounds yields . Finally, because is computed solely from , the triple forms a Markov chain, and the data-processing inequality gives , or equivalently .
Notice that the count of remaining labels in the second step relies on taking values inside the same label set. If the classifier is allowed to answer "abstain", then must replace , and the stated inequality breaks down: for a fair bit independent of and a classifier that always abstains, and the left-hand side becomes , which lies below .
In the simplest case, Fano's bound is exact. For the flipped bit with the estimate , we have and , so the left-hand side equals , matching exactly.
No classifier, regardless of architecture or training procedure, can beat Fano's bound. For balanced classes, nats; rearranging (25.6.8) for shows the minimum mutual information required to achieve each target error rate.
H_b = lambda p: -p * np.log(p) - (1 - p) * np.log(1 - p) # binary entropy
k = 1000
for p_e in (0.01, 0.05, 0.2, 0.5):
need = np.log(k) - H_b(p_e) - p_e * np.log(k - 1)
print(f'P_e = {p_e:4.2f}: I(X;Y) >= {need:.3f} of log k = {np.log(k):.3f} nats')
P_e = 0.01: I(X;Y) >= 6.783 of log k = 6.908 nats
P_e = 0.05: I(X;Y) >= 6.364 of log k = 6.908 nats
P_e = 0.20: I(X;Y) >= 5.026 of log k = 6.908 nats
P_e = 0.50: I(X;Y) >= 2.761 of log k = 6.908 nats
Reaching error requires at least of the nats of label entropy ( of the total), and even a classifier that is wrong half the time needs nats, or two fifths of the total.
25.6.2.4 The Loss Certificate#
Fano's inequality turns a classification error rate into a lower bound on mutual information. A language model, however, is not evaluated by hard error rate; like almost every model trained by maximum likelihood, it reports a cross-entropy loss instead. That loss yields a lower bound on mutual information as well, and the proof takes only three lines.
Proposition (a loss certifies information). Let be any model of the label given the input, with cross-entropy loss under . Then
and for balanced classes, .
Proof. By definition, . For each , the cross-entropy of under exceeds the true conditional entropy of by (Section 25.1). Averaging over yields , and subtracting from completes the proof.
Because held-out test loss estimates , the test loss of any classifier or language model directly certifies a lower bound on the information its input carries. For example, a -class classifier on balanced labels with a test loss of nats certifies that its input carries at least of the label's nats. The bound holds even if the model is poorly calibrated or badly trained; a weaker model simply certifies a smaller lower bound. This is the variational bound of Barber and Agakov (2003) with a classifier acting as the decoder, and Section 25.7.3 develops it into a broader family of mutual information estimators.
The certificate is tight if and only if matches the true conditional distribution . On the flipped bit, a model that predicts with confidence has expected loss , which we evaluate below across four confidence levels.
for c in (0.6, 0.8, 0.9, 0.99):
L = -(0.9 * np.log(c) + 0.1 * np.log(1 - c)) # cross-entropy of q
print(f'confidence {c:4.2f}: loss {L:.4f}, '
f'certifies I(X;Y) >= {np.log(2) - L:.4f} nats')
confidence 0.60: loss 0.5514, certifies I(X;Y) >= 0.1418 nats
confidence 0.80: loss 0.3618, certifies I(X;Y) >= 0.3314 nats
confidence 0.90: loss 0.3251, certifies I(X;Y) >= 0.3681 nats
confidence 0.99: loss 0.4696, certifies I(X;Y) >= 0.2236 nats
Only the calibrated model () certifies the full nats. An overconfident model () pays a steep penalty whenever it errs and certifies only nats, while an underconfident one () certifies nats. Yet all four models make identical hard predictions and err of the time, so Fano's inequality, which sees only the error rate, certifies the full nats for every one of them. Cross-entropy loss sees the predicted probabilities as well, and penalizes miscalibration. Both results upper-bound the same conditional entropy (Fano via an error rate and the certificate via a loss), turning each upper bound into a lower bound on . In fact, the two are even more closely connected than they appear: Exercise 6 shows that Fano's bound is itself the loss certificate of one specific model, and that a well-calibrated classifier that knows when it is uncertain can certify strictly more.
25.6.3 Communication and Compression#
Shannon posed two foundational engineering questions whose answers turn out to be a maximum and a minimum of mutual information: how much information a noisy channel can reliably carry, and how little information a lossy compressor must keep. Readers focused on representation learning may skim channel capacity on a first pass, whereas rate–distortion theory is essential because the final part of this section builds directly on it.
25.6.3.1 Channel Capacity#
How much information can survive a communication line that flips each bit independently with probability ? A memoryless channel is specified by a conditional distribution applied independently to each input symbol, with each transmitted symbol counting as one use of the channel. Our flipped bit is exactly such a channel, with input and output . Although the channel noise is fixed, the sender is free to choose the input distribution . The capacity of the channel is the maximum mutual information achievable over all choices of input distribution, measured in nats per use:
A sender who transmits mostly zeros underuses the channel, since such an input carries little entropy to begin with. Shannon's channel coding theorem gives this quantity its operational meaning. Defining the rate of a code as the number of nats of message it delivers per channel use, Shannon showed that by encoding long blocks of symbols one can transmit reliably—with error probability as small as desired—at any rate below , whereas reliable communication is impossible at any rate above (Shannon, 1948; Cover and Thomas, 1999). We state this theorem without proof.
For the bit-flipping channel, known as the binary symmetric channel, computing the capacity takes a single line. Write . Every row of is up to ordering, so regardless of the input distribution. Meanwhile, , with equality if and only if is uniform. Because , whenever the output is uniform if and only if the input is uniform. Hence
achieved by the uniform input. At , this recovers the nats of our flipped bit (whose input was already uniform); for the two lines in series (), capacity drops to nats. At , the output is independent of the input and capacity vanishes. At , capacity returns to the full nats, since a receiver who knows every bit is inverted can simply flip it back: noise destroys information only to the extent that the receiver cannot predict it. The code below first sweeps the input distribution for the channel, and then sweeps the flip probability under a uniform input.
inputs = (0.1, 0.3, 0.5, 0.7, 0.9)
I_in = [mutual_information(np.array([[1 - a], [a]]) * flip(0.1)) for a in inputs]
print('P(X=1):', ' '.join(f'{a:6.2f}' for a in inputs))
print('I(X;Y):', ' '.join(f'{v:6.4f}' for v in I_in))
deltas = (0.0, 0.1, 0.26, 0.5, 1.0)
C = [np.log(2) - entropy(np.array([d, 1 - d])) for d in deltas]
print('delta: ', ' '.join(f'{d:6.2f}' for d in deltas))
print('C: ', ' '.join(f'{c:6.4f}' for c in C))
P(X=1): 0.10 0.30 0.50 0.70 0.90
I(X;Y): 0.1463 0.3160 0.3681 0.3160 0.1463
delta: 0.00 0.10 0.26 0.50 1.00
C: 0.6931 0.3681 0.1201 0.0000 0.6931
An input that sends a only of the time has only nats to offer and gets of them through—two fifths of what the uniform input achieves. The left panel of Figure 25.6.4 plots the capacity as a function of . Neural networks contain channels of their own: dropout erases a feature with probability and passes it through otherwise, and Exercise 7 shows that a binary feature can push at most nats through it.
Shannon's two operational curves, in nats. Left: the capacity of the binary symmetric channel, with the flipped bit () and the two flips in series () marked; a channel that flips with probability carries nothing, while one that always flips carries the full . Right: the Gaussian rate–distortion function for a source of variance ; the rate diverges as and reaches zero once meets the source variance.
25.6.3.2 Rate–Distortion#
Lossless compression requires nats per symbol (Section 25.2), which means an exact lossless code for a continuous source would require infinitely many nats. In practice, an approximate reconstruction is usually all we need: an image codec may perturb pixels slightly, and a learned representation may deliberately discard irrelevant detail. Suppose we choose a nonnegative distortion measure scoring how well reconstructs , and allow an average distortion of at most . How few nats per sample are required? The rate–distortion function answers this as the minimum mutual information an encoder must retain to stay within the distortion budget:
A tighter distortion budget demands more information. Shannon's rate–distortion theorem mirrors the channel coding theorem, with the rate now measuring the nats a code spends per source sample: block codes operating at any rate above can achieve average distortion , whereas no code below can (Shannon, 1959).
In practice, it is usually easier to replace the hard distortion constraint with a penalty, minimizing over all encoders for a multiplier . Every encoder corresponds to a point in the distortion–rate plane lying on or above the curve , and the penalized objective is constant along straight lines of slope . Because is convex, the minimum occurs where a line of slope touches the curve from below: larger selects lower distortion at a higher rate. The information bottleneck of Section 25.6.4 is formulated in exactly this Lagrangian form.
Proposition (Gaussian rate–distortion). For a source under squared error ,
Inverting this formula for distortion gives : every additional bit of rate ( nats) cuts the squared error by a factor of four.
Proof. The lower bound is the main step, and it rests on a single fact from Section 25.1.4.3: among all densities with variance , the Gaussian maximizes differential entropy at , which increases with . Take any encoder satisfying . Then
The second equality holds because subtracting the known value merely shifts the conditional density without changing its entropy. The first inequality uses the fact that conditioning cannot increase entropy, and the second applies the Gaussian maximum-entropy bound, since the reconstruction error has variance at most . When , a constant encoder that transmits nothing and always outputs the mean already meets the budget, so .
It remains to construct an encoder that achieves this bound for . Set and add independent Gaussian noise: with and . Then and , giving squared correlation . Applying (25.6.5) gives the mutual information retained by this encoder:
Now reconstruct using the conditional mean , the optimal linear regression of on with slope . Its mean squared error is the conditional variance , which sweeps across the entire interval as varies. Because is an invertible rescaling of , we have . For a general variance , simply rescale and .
The encoder used in this proof—a signal corrupted by independent Gaussian noise—is known as a Gaussian channel with signal-to-noise ratio , and (25.6.14) is its capacity (Exercise 8). The forward noising process of a diffusion model (Chapter 17) is precisely such a channel: regardless of the data distribution, a coordinate noised to signal-to-noise ratio carries at most nats about its clean value. The code below simulates this encoder on one million samples at , , and (corresponding to , , and ) and verifies its squared error.
rng = np.random.default_rng()
x = rng.standard_normal(1_000_000)
for s2 in (1 / 9, 1.0, 3.0): # sigma^2
z = x + np.sqrt(s2) * rng.standard_normal(x.size) # encoder
x_hat = z / (1 + s2) # E[X | Z]
D = s2 / (1 + s2)
mse = np.mean((x - x_hat)**2)
print(f'sigma^2 = {s2:5.3f}: D = {D:.3f}, MSE {mse:.3f}, '
f'I(X;Z) = R(D) = {0.5 * np.log(1 + 1 / s2):.3f} nats')sigma^2 = 0.111: D = 0.100, MSE 0.100, I(X;Z) = R(D) = 1.151 nats
sigma^2 = 1.000: D = 0.500, MSE 0.500, I(X;Z) = R(D) = 0.347 nats
sigma^2 = 3.000: D = 0.750, MSE 0.750, I(X;Z) = R(D) = 0.144 nats
The empirical squared errors match to within a few thousandths: a distortion of costs nats per sample, costs nats (half a bit), and costs nats.
Keep in mind that this noisy encoder achieves as a mutual information, not yet as an actual file size. A practical code must map samples to discrete bit strings, and it approaches the rate–distortion curve only by coding long blocks of samples jointly. Any scalar code that quantizes one sample at a time stays strictly above the curve. The simplest example keeps only the sign of : it spends nats and reconstructs (the mean of ), incurring squared error , whereas the rate–distortion curve asks only nats for that distortion.
The right panel of Figure 25.6.4 shows the full curve. As , the required rate climbs without bound—reflecting the infinite information in an exact copy of a continuous variable—and drops to once reaches . That steep climb near explains why modern image generators compress images before modeling them: the finest, nearly imperceptible pixel details consume the vast majority of the bits, so Section 17.7 delegates them to an autoencoder.
25.6.4 The Information Bottleneck#
A good representation should keep what predicts the label and discard the rest. At first glance, discarding anything might seem counterproductive, since the data-processing inequality tells us that throwing away information can never improve the Bayes-optimal predictor. In practice, however, irrelevant details carry a real cost. A photograph of a dog also encodes the lighting, the lawn, and where in the frame the dog happens to stand. Storing all of those nuances costs extra nats, and a classifier trained on finitely many images can easily mistake them for genuine cues to the label. The information bottleneck formalizes this trade-off using two mutual informations: it is a rate–distortion problem in which the label itself defines the distortion.
25.6.4.1 The Bottleneck Objective#
Let be a representation of an input generated by a stochastic encoder , and let be the target label. When is continuous, the encoder must be stochastic, because a deterministic map would typically yield (Section 25.6.1.3). The information bottleneck (Tishby et al., 1999) seeks a representation that retains as little of as possible while preserving as much about as possible:
Here is the rate—how much information the representation keeps about the input—while , weighted by , is the information it keeps about the label. Because the encoder sees only , the variables form a Markov chain , and the data-processing inequality constrains . A representation can never know more about the label than the input does, nor can it predict well without keeping input information.
The multiplier governs the trade-off, and its two extremes are easy to understand. Whenever , keeping nothing is optimal: by the inequality above, , and a constant encoder that ignores completely achieves . When the constant encoder is optimal, we say the bottleneck collapses. Conversely, as grows large, the label term dominates and the encoder preserves whatever helps predict . In that limit, approaches its ceiling , and the representation approaches a minimal sufficient statistic: the coarsest summary of that still predicts as well as itself. Of course, when the encoder is restricted to a parametric family—as every neural network is—it may stop short of that ceiling.
Proposition (the bottleneck as a rate–distortion problem). If is a Markov chain, then
Proof. Expand via the chain rule in both orders: . The Markov property gives . Writing the remaining conditional mutual information in KL form yields , and the Markov property simplifies to .
Substituting (25.6.16) into the objective turns (25.6.15) into , with distortion . Since the final term does not depend on the encoder, the information bottleneck is precisely the Lagrangian form of a rate–distortion problem. Instead of asking a designer to hand-craft a distortion metric, the label supplies it automatically: a code is a faithful representation of whenever it predicts just as accurately as does. Unlike ordinary rate–distortion, however, this distortion depends on the encoder itself through , making optimization considerably harder.
25.6.4.2 The Gaussian Information Bottleneck#
In one special setting, every quantity in the information bottleneck can be solved in closed form (Chechik et al., 2005). Take to be our Gaussian pair at , for which nats, and use the additive-noise encoder from Section 25.6.3.2:
parameterized solely by the noise scale . The rate is already given by (25.6.14). For the label, and , so . Applying (25.6.5) gives both mutual informations:
As decreases from to , the representation moves smoothly from knowing nothing about to knowing exactly, and its label information rises from to the data-processing ceiling of nats.
To visualize this trade-off directly, write for the rate (reserving for the rate–distortion function ). Inverting (25.6.17) gives , hence , expressing label information directly as a function of rate:
The derivative decreases monotonically from at toward , so the curve is strictly concave. Leaving the origin with slope , the first nat of input information buys at most nats of label information, and each subsequent nat yields diminishing returns as approaches . Chechik et al. (2005) proved that for a Gaussian pair no encoder, linear or nonlinear, can surpass this curve, making it the exact optimal frontier; we use that result without proof. For any chosen , the minimizer of the Lagrangian selects a single operating point along this frontier.
Proposition (operating point and collapse). In the Gaussian bottleneck with , the Lagrangian is convex in , with derivative at . For its minimum is , the constant encoder. For the minimizer and its label information are
Proof. Because is concave in , the Lagrangian is convex, with derivative . At , this derivative equals . Whenever , the derivative is nonnegative at and strictly increasing, so the minimum over occurs at . Otherwise, setting the derivative to zero gives , or . Substituting into yields the second expression.
Earlier, the general data-processing argument guaranteed collapse for . For the Gaussian pair at , collapse actually extends all the way to . Below that threshold, every nat of rate adds to the objective while reducing it by at most , because the frontier's slope never exceeds its initial value . Above the threshold, increasing slides the operating point up the frontier toward the ceiling: gives nats of rate and nats of label information, while reaches and nats. Figure 25.6.5 plots this frontier and its operating points in the information plane, with rate on the horizontal axis and label information on the vertical axis.
The information plane of the Gaussian bottleneck with . The concave frontier traces the largest attainable at each rate ; the shaded region above it is infeasible, and the dashed ceiling is the data-processing limit nats. The frontier leaves the origin with slope , and the multiplier selects the point where the slope equals ; for that point collapses to the origin.
A phase transition this sharp is worth checking numerically: the proposition predicts that the optimal encoder keeps nothing at yet retains information at . Below, we minimize the Lagrangian directly over a grid of noise scales without invoking the closed-form solution.
rho = 0.9
sigma = np.logspace(-2, 2, 4001) # encoder Z = X + sigma eps
I_xz = 0.5 * np.log(1 + sigma**-2)
I_yz = -0.5 * np.log(1 - rho**2 / (1 + sigma**2))
for beta in (1.2, 1.25, 1.5, 2, 4, 16):
i = np.argmin(I_xz - beta * I_yz) # Lagrangian on the grid
u = (0.5 * np.log(rho**2 * (beta - 1) / (1 - rho**2))
if beta * rho**2 > 1 else 0.0) # closed-form optimum
print(f'beta = {beta:5.2f}: I(X;Z) grid {I_xz[i]:.3f}, closed form {u:.3f};'
f' I(Y;Z) = {I_yz[i]:.3f}')
beta = 1.20: I(X;Z) grid 0.000, closed form 0.000; I(Y;Z) = 0.000
beta = 1.25: I(X;Z) grid 0.032, closed form 0.032; I(Y;Z) = 0.026
beta = 1.50: I(X;Z) grid 0.379, closed form 0.378; I(Y;Z) = 0.281
beta = 2.00: I(X;Z) grid 0.725, closed form 0.725; I(Y;Z) = 0.484
beta = 4.00: I(X;Z) grid 1.275, closed form 1.274; I(Y;Z) = 0.687
beta = 16.00: I(X;Z) grid 2.078, closed form 2.079; I(Y;Z) = 0.798
The grid search and the closed-form solution agree to a thousandth of a nat, confirming the collapse threshold right where the proposition predicts: at the constant encoder is optimal, whereas by the encoder already retains nats. Notice that this exact same encoder with noise scale also achieves the rate–distortion curve for squared error at . Rate–distortion judges the encoder by how well it reconstructs , whereas the information bottleneck judges it by how well it predicts .
25.6.4.3 The Variational Information Bottleneck#
For a Gaussian pair we could compute both mutual informations in the bottleneck objective analytically. On real data we can compute neither, because the true joint distribution is unknown: all we observe are samples paired with an encoder that we choose. The variational information bottleneck (Alemi et al., 2017) makes the objective trainable by replacing each mutual information with a tractable bound that can be estimated from samples.
For the label term, we already have the needed bound. Introduce a decoder (a classifier predicting the label from the representation) with cross-entropy loss . Applying the loss certificate (25.6.9) to the pair immediately gives .
Because we want to minimize the rate , we need an upper bound on it instead. Write the rate in the conditional form (25.6.4), . While the encoder is known, the aggregated marginal is not, since it averages over the unknown data distribution. Replace by any fixed prior density of our choice, such as a standard normal. Using the identity and taking expectations over and gives
Any mismatch between our chosen prior and the true marginal can only inflate the rate bound; Exercise 9 calculates this gap explicitly for a Gaussian encoder. Combining both bounds shows that the KL term on the left-hand side of (25.6.19) plus upper-bounds the bottleneck objective (25.6.15) up to the constant . Because both terms are simple expectations over training examples, a neural network can minimize this bound directly with stochastic gradient descent.
Anyone who has trained a variational autoencoder will recognize the left-hand side of (25.6.19) immediately. A variational autoencoder (Section 17.7) is precisely this same construction with the input serving as its own label: an encoder , a fixed prior , and a decoder that reconstructs from instead of predicting a separate class label. Its training loss is the reconstruction error plus a weighted KL penalty. Viewed through our lens, that KL penalty is an upper bound on the rate, capping how many nats the latent code can store about the input, while the reconstruction error plays the role of distortion. Only the placement of the trade-off weight differs: (25.6.15) multiplies the preserved information by , whereas a variational autoencoder places its weight on the KL rate term, so a large KL weight there corresponds to a small here.
The decoder's cross-entropy loss and the KL divergence to a prior are the only quantities in this section that can be evaluated from samples alone—giving a lower bound on one mutual information and an upper bound on another. Every other number we computed relied on knowing the joint distribution, which we never have for real images or text. In Section 25.7, we ask how much about mutual information can be estimated from samples alone.
25.6.5 Summary#
Mutual information is the KL divergence between a joint distribution and the product of its marginals, ; it vanishes if and only if and are independent and is invariant under invertible reparameterizations of either variable. Unlike linear correlation, it detects nonlinear dependence—assigning nats to and even though their correlation is zero. By the data-processing inequality, sequential processing cannot create information, though neural network layers can rearrange existing information to make it easier for a classifier to read. Fano's inequality turns any target error rate into a minimum requirement on mutual information, and the cross-entropy loss of any probabilistic model certifies . Shannon's channel capacity and rate–distortion function arise as the maximum of mutual information over inputs and its minimum over lossy encoders. Finally, the information bottleneck casts representation learning as a rate–distortion problem whose distortion is supplied by the label: for a Gaussian pair it collapses until exceeds , and in its variational form its rate penalty becomes the familiar KL regularizer of a variational autoencoder.
25.6.6 Exercises#
-
[code] Rare pairs and PMI. Pointwise mutual information (25.6.6) corrects co-occurrence counts for the frequencies of the two words (Section 25.6.1.4).
- Show that . When is each of the two bounds attained?
- Extend
countsby a fourth first word sri and a fourth second word lanka that occur only in the bigram "sri lanka", with count . Recompute the pmi of "new york", "machine learning", "the day", and "sri lanka", and repeat with count . Zero counts give and make(p * pmi).sum()returnnan, so restrict sums to the nonzero cells, asmutual_informationdoes. - Compare the contributions of "new york" and "sri lanka" to . Then add to every count and recompute both pmi values. Which of these scores would you use to rank collocations, and why?
-
Information versus usable information. A label is a fair bit. Given the input is uniform on the circle of radius , and given it is uniform on the circle of radius . A representation computes .
- Show that , although is not invertible. Which condition for equality in the data-processing inequality of Section 25.6.2.2 holds?
- Show that no linear classifier classifies every input correctly, whereas a threshold on does.
- The layers of a network form a Markov chain . Show that the error of the best classifier of any kind that reads cannot fall as grows. The accuracy of a linear classifier fit to often rises with all the same. Why is there no contradiction?
- Xu et al. (2020) measure the information that a family of predictors can extract. Let , and let be the same infimum over the predictors in that ignore their input. The usable information is
Let be logistic regression on the given input. Show that and . For , use that the expected logistic loss is convex in and unchanged when is rotated. Which inequality of Section 25.6.2.2 does violate?
-
Synergy and the Venn diagram. Let and be independent fair bits and their exclusive or, for which the section computed and .
- Which of the Markov chains , , and hold? What does the data-processing inequality therefore say about this triple?
- In a three-variable version of Figure 25.6.1, the area common to all three disks would be the interaction information . Prove that , and conclude that is symmetric in its three arguments.
- Evaluate for the triple of (a) and for three copies of one fair bit. What do the two values imply for a three-disk diagram of entropies?
Adapted from Thomas M. Cover and Joy A. Thomas, Elements of Information Theory, 2nd ed., Exercise 2.25, and David J. C. MacKay, Information Theory, Inference, and Learning Algorithms, Exercise 8.8.
-
[code] Data processing from -divergences. For any channel that maps an input to a random output, and any two distributions and of the input, the output distributions satisfy for every -divergence (Section 25.3.3.3). The KL divergence and are two of them.
- Let be a Markov chain. Take , , and the channel that maps to with . Show that and , and conclude that .
- Which part of the section's data-processing proposition does this route not deliver?
- For the two flips in series, with probabilities and , compute the KL divergence and the divergence of each joint table from the product of its marginals, before and after the second flip.
- Show that for a fair input through the flip channel with probability , , and check your numbers from (c). Conclude that a further flip with probability multiplies this divergence by , here by . Is the ratio from (c) the same factor?
-
Fano and a converse. ● Fano's inequality (25.6.8) bounds from below the error of any estimate of a label with values.
- Let be the most probable label. Show that its error satisfies . Bound from below by , then apply Jensen's inequality once, to .
- An observation carries nats about a balanced -class label . Use (25.6.8) and (a) to bracket the error of the best classifier. The inequality (25.6.8) has no closed-form solution for , so solve it numerically. What does the width of this interval say about predicting a downstream error rate from a mutual information?
-
The loss certificate and Fano. A classifier of balanced classes has test error and test loss nats.
- How many nats of does Fano's inequality (25.6.8) certify, and how many does the loss certificate (25.6.9)?
- For any estimate with error probability , let the model put probability on and spread evenly over the other labels. Show that its cross-entropy loss is , and conclude that Fano's inequality is the loss certificate of this model. Which of the four models evaluated in Section 25.6.2.4 is it?
- The classifier of (a) reports a smaller loss than the model that (b) builds from its decisions. What must its confidences do for that to happen? Give a pair with a binary label and a model with error rate that certifies more than Fano's inequality does.
-
Binary channels. ● Work in nats with the binary entropy .
- A Z-channel passes a unchanged and turns a into a with probability . Compute as a function of , and show that it is largest at , where it equals nats. Why does the best input send the unreliable symbol less than half the time, and why not never?
- A feature takes the values and passes through dropout with rate , which replaces it by with probability and rescales it otherwise. Show that this binary erasure channel has capacity nats.
- Find the flip probability at which the binary symmetric channel has the same capacity as dropout with . Why does a flipped bit cost more capacity than an erased one?
-
The Gaussian channel. Let with noise independent of , and let the input obey the power constraint .
- Show that for any input with a density.
- Among densities with variance , the Gaussian has the largest differential entropy, . Use this to show , and conclude that the capacity is , attained by a Gaussian input.
- Evaluate at signal-to-noise ratios , in nats and in bits. Show that at high signal-to-noise ratio each doubling of adds about nats, half a bit.
- A diffusion model replaces a coordinate of the data, scaled so that , by with and independent . Show that the noised coordinate carries at most nats about , whatever the distribution of , and evaluate the bound at and . For which data is it attained?
-
The rate bound of a variational autoencoder. Let , let the encoder be as in Section 25.6.4.2, so that , and let the prior be . Use .
- Compute the three terms of (25.6.19) and check the identity. By how many nats does the KL penalty overstate the rate at ?
- Rescale the code to . Show that and that the bound is now an equality.
- The rate does not depend on the units of the code, and the bound does. Which prior makes the bound an equality for a given encoder? What does minimizing the KL penalty therefore do to the code, besides lowering its rate?