Rate Distortion Theory
Lossy compression — quantization, the rate distortion function for binary and Gaussian sources, reverse water-filling, the converse and achievability proofs, and the Blahut–Arimoto algorithm
Motivation: perfection is impossible, so what is the price of imperfection?
differential-entropy established that describing an arbitrary real number requires an infinite number of bits. So a finite representation of a continuous random variable can never be perfect. That is not a failure of engineering; it is a theorem. The only remaining question is: how well can we do?
To ask that properly we must first define what “well” means — the goodness of a representation of a source. That is done by defining a distortion measure, a measure of distance between the random variable and its representation. Then the basic problem of rate distortion theory is:
ImportantThe two equivalent forms of the question
Given a source distribution and a distortion measure:
- What is the minimum expected distortion achievable at a particular rate?
- Equivalently, what is the minimum rate description required to achieve a particular distortion?
IntuitionThe elephant and the chicken
One of the most intriguing aspects of this theory is that joint descriptions are more efficient than individual descriptions. It is simpler to describe an elephant and a chicken with one description than to describe each alone — and this is true even for independent random variables. It is simpler to describe and together (at a given distortion for each) than to describe each by itself.
Why don’t independent problems have independent solutions? The answer is found in the geometry. Rectangular grid points — which is what independent descriptions produce — do not fill up the space efficiently. This is the same phenomenon as in the AEP: long blocks buy you something that single symbols cannot, and here the gain is geometric rather than statistical.
NoteWhere this sits in the theory
Rate distortion theory applies to both discrete and continuous sources. The zero-error data compression theory (Chapter 5) is an important special case: a discrete source at zero distortion. So lossless compression is the corner of a much larger picture.
Quantization
Before the elegant theory, it is worth seeing how complicated the problem is to solve exactly for a single random variable — which is exactly what motivates going to block lengths.
Let be the source and its representation. Given bits, the function can take on values. The problem is to find the optimum set of values for (the reproduction points or code points) and the regions associated with each.
ExampleOne-bit quantization of a Gaussian
Let with squared-error distortion. With one bit, the bit should clearly distinguish whether . To minimize squared error, each reproduced symbol should be the conditional mean of its region:
With two bits the situation is no longer simple. We clearly want four regions with a representative point in each, but it is no longer obvious what the regions and reconstruction points should be.
ImportantTwo properties of an optimal quantizer
- Given a set of reconstruction points, distortion is minimized by mapping to the closest representation point. The regions so defined form a Voronoi (or Dirichlet) partition.
- The reconstruction points should minimize the conditional expected distortion over their respective regions — the centroids, for squared error.
NoteThe Lloyd algorithm
These two properties give an obvious iterative algorithm: start with a set of reconstruction points, find the optimal regions (nearest-neighbour regions), find the optimal points for those regions (centroids), and repeat. Expected distortion decreases at each stage, so it converges to a local minimum. This is the Lloyd algorithm (real-valued) or generalized Lloyd algorithm (vector-valued), widely used to design quantization systems.
Note “local minimum” — it is a heuristic, not an optimality theorem, which is another reason to want the theory that follows.
IntuitionWhy we go to blocks anyway
Now take i.i.d. Gaussian variables to be represented with bits. Since the source is i.i.d. the symbols are independent, so it may appear that each element is a separate problem. This is not true. We will represent the entire sequence by a single index taking values, and this treatment of whole sequences at once achieves a lower distortion for the same rate than quantizing the samples individually.
Definitions
A source produces i.i.d. . The encoder describes by an index ; the decoder represents by an estimate .
flowchart LR
Xn["X^n"] --> E[Encoder]
E --> W["f_n(X^n) in {1,...,2^nR}"]
W --> D[Decoder]
D --> XH["X-hat^n"]
DefinitionDistortion measure
A distortion function is a mapping
from source–reproduction alphabet pairs to non-negative reals. is the cost of representing symbol by symbol . It is bounded if
In most cases .
| Distortion measure | Definition | Notes |
|---|---|---|
| Hamming (probability of error) | if , else 1 | — distortion literally is error probability. |
| Squared error | The most popular for continuous alphabets: simple, and tied to least-squares prediction. |
WarningSquared error is often the wrong measure for humans
In image and speech coding, various authors have pointed out that mean-squared error is not an appropriate measure of distortion for human observers. There is a large squared-error distortion between a speech waveform and the same waveform slightly shifted in time, even though both sound identical.
Alternatives exist — the Itakura–Saito distance (the relative entropy between multivariate normal processes) is popular in speech coding. In image coding, however, there is at present no real alternative to mean-squared error. The whole theory is only as meaningful as the distortion measure you feed it.
DefinitionDistortion between sequences
The distortion for a sequence is the average of the per-symbol distortions.
NoteThis is a choice, not the only option
One might instead measure distortion by the maximum of the per-symbol distortions. The theory below does not apply directly to that more general measure. Averaging is what makes the law of large numbers available.
DefinitionRate distortion code and the two functions
A -rate distortion code consists of an encoding function and a decoding (reproduction) function , with distortion
The -tuples form the codebook, and are the assignment regions.
- A pair is achievable if there is a sequence of codes with .
- The rate distortion region is the closure of the set of achievable pairs.
- The rate distortion function is the infimum of rates such that is in the region.
- The distortion rate function is the infimum of distortions such that is in the region.
The two describe the same boundary; we generally use .
NoteMany names for
Vector quantization, reproduction, reconstruction, representation, source code, estimate — all refer to the replacement of by .
The information rate distortion function
DefinitionInformation rate distortion function
minimized over all conditional distributions whose joint satisfies the expected distortion constraint.
ImportantThe exact dual of channel capacity
Compare [[channel-capacity#The channel and its information capacity|]]. Here we minimize over conditional distributions subject to a constraint, there we maximize over input distributions subject to a constraint. The structural parallel runs through the whole chapter:
| Channel capacity | Rate distortion | |
|---|---|---|
| Optimization | ||
| What’s fixed | the channel | the source |
| What’s chosen | the input distribution | the “test channel” |
| Constraint | power / alphabet | expected distortion |
| Geometry | sphere packing | sphere covering |
| Goal | most codewords that stay apart | fewest codewords that cover everything |
TheoremThe main theorem of rate distortion theory
The rate distortion function for an i.i.d. source with distribution and bounded distortion function equals the associated information rate distortion function:
the minimum achievable rate at distortion .
NoteOperational versus information definitions, again
Exactly as in channel-capacity, we have an operational definition (the infimum of achievable rates, defined via codes) and an information definition (a minimization over distributions, no codes in sight). The theorem says they coincide, which is why we write for both from here on. The converse is in and achievability in .
Calculating
Binary source
TheoremRate distortion function for a Bernoulli() source with Hamming distortion
ProofLower bound by rewriting the conditional entropy, then exhibit a matching test channel
Assume WLOG . Let denote mod-2 addition, so is equivalent to .
Step 1: Lower bound. For any joint distribution satisfying the constraint,
The rewriting is the key move: given , knowing is the same as knowing the error pattern , so the conditional entropy can be expressed in terms of errors rather than symbols. Then
using conditioning-reduces-entropy, then together with the fact that increases with for . Hence .
Step 2: Achieve it with a test channel. Choose jointly distributed as a binary symmetric channel with crossover running from to — note the direction: is the input, the output. Choose the distribution of so that the output distribution of is the specified one. With , solve
If then is a valid probability. For this joint distribution and the expected distortion is exactly .
Step 3: The degenerate range. If , set with probability 1: then and , so . Similarly if , set .
∎
IntuitionReading the answer
is the cost of describing the source exactly; is the uncertainty you are allowed to leave behind. The rate is the difference — you pay for what you resolve and get a refund for what you don’t. Once the allowed distortion exceeds the source’s own bias , you can hit the target by saying nothing at all and always guessing the majority symbol, so the rate drops to zero.
WarningWhy should minimizing mutual information have anything to do with quantization?
The calculation above may seem entirely unmotivated. We have minimized an abstract quantity and called the answer a description rate, with no code in sight. The answer to this question must wait for the achievability proof — the coding theorem is what retroactively justifies the whole formulation.
Gaussian source
TheoremRate distortion for with squared-error distortion
ProofSame shape: bound via max-entropy, then build the test channel
Step 1: Lower bound. Since ,
using translation invariance of differential entropy (given , subtracting it is a shift). Then
by conditioning-reduces-entropy and then the Gaussian max-entropy theorem. Evaluating and using :
Step 2: The test channel. It is more convenient to specify — sometimes called the test channel, emphasizing the duality with channel capacity. For choose
with and independent. This gives and , meeting the bound. If , take with probability 1.
∎
IntuitionThe test channel runs backwards
Notice the direction in both examples: we specify as the reconstruction plus noise, not the reconstruction as the source plus noise. The variances split as — the reconstruction captures of the source’s energy and the remaining is exactly the distortion you agreed to tolerate.
FormulaDistortion rate form
Each bit of description reduces expected distortion by a factor of 4.
ExampleBlocks beat single-symbol quantization — concretely
With a 1-bit description, the theory says the best expected squared error is . Compare the simple 1-bit quantizer from , using the positive/negative half-lines with centroid reproduction points: its expected distortion is
The rate distortion limit is achieved only by long block lengths. This example shows we can achieve lower distortion by considering several distortion problems in succession than by considering each separately — and it is somewhat surprising, because we are quantizing independent random variables. This is the elephant and the chicken made numerical.
Independent Gaussians: reverse water-filling
The problem. Represent independent, not identically distributed sources with squared-error distortion , given bits total. How should the bits be allotted?
DerivationReducing to a per-component optimization
using independence of the sources, then conditioning-reduces-entropy, then the scalar Gaussian result. Equality holds by choosing and each . So the problem becomes
DerivationLagrange multipliers and the Kuhn–Tucker correction
Construct and differentiate:
So the optimum allotment gives equal distortion to every component — which is possible only while for all . As the total allowed distortion increases, rises until it exceeds some , at which point the solution hits the boundary and we need Kuhn–Tucker:
TheoremRate distortion for a parallel Gaussian source
Let be independent with . Then
with chosen so that . Equivalently .
ImportantReverse water-filling
Picture the variances as bars and as a water level. We choose a constant and describe only those random variables with variance greater than . No bits at all are used to describe variables with variance less than — those are simply reproduced as zero, and their entire variance is accepted as distortion.
Contrast forward water-filling:
| Forward (channel) | Reverse (source) | |
|---|---|---|
| Levels are | noise variances | source variances |
| We allocate | power, | distortion, |
| Ignored components | those too noisy to use | those too quiet to bother describing |
| Water sits | above the floor | below the ceiling |
NoteExtensions
More generally the rate distortion function for a multivariate normal vector is obtained by reverse water-filling on the eigenvalues. The same argument applies to a Gaussian stochastic process: by the spectral representation theorem such a process is an integral of independent Gaussian processes in various frequency bands, and reverse water-filling on the spectrum yields . This is, in essence, what a perceptual audio codec does — spend no bits on frequency bands whose content falls below threshold.
Converse to the rate distortion theorem
We must show we cannot achieve distortion below describing at a rate below . First, a structural property that the proof needs.
LemmaConvexity of
is a non-increasing convex function of .
ProofMonotonicity by enlarging the feasible set; convexity from convexity of
Non-increasing: is a minimum of mutual information over increasingly larger sets as grows — a looser constraint cannot raise a minimum.
Convex: take two pairs , on the curve, achieved by joints and . Consider . Distortion is a linear function of the distribution, so . Mutual information, on the other hand, is a convex function of the conditional distribution, so
∎
ProofConverse — the ten-step chain
We show that any code with distortion has — and in fact this holds even for randomized mappings , as long as takes at most values. Let .
Justifications:
- (a) the range of has at most values
- (b)
- (c) the data processing inequality
- (d) the are independent
- (e) chain rule for entropy
- (f) conditioning reduces entropy
- (g) definition of the rate distortion function
- (h) convexity of plus Jensen’s inequality — this is why the lemma was needed
- (i) definition of distortion for blocks of length
- (j) non-increasing, and
∎
IntuitionCompare with the channel coding converse
Structurally identical to the channel converse: data processing to get from the message to the codeword, single-letterization to reduce uses to times one use, and a convexity/Jensen step to handle the per-coordinate allocation. The only missing ingredient is Fano — unneeded here, because we assume a distortion bound rather than an error probability.
TheoremSource–channel separation with distortion
Let be a finite-alphabet i.i.d. source encoded into inputs of a DMC with capacity , with output mapped to and average distortion . Then is achievable if and only if .
IntuitionThe lossy separation principle
The lossless separation theorem said transmission is possible iff . This replaces with : compress to the rate your distortion budget permits, then channel-code that. Design the two halves independently, as before.
Achievability of the rate distortion function
The proof mirrors the channel coding theorem: random codebooks and joint typicality. Two new ingredients: a typicality notion that includes the distortion, and an inequality to handle the covering argument.
DefinitionDistortion typical set
A pair is distortion -typical if
The set is denoted .
IntuitionJust joint typicality plus one more condition
This is the jointly typical set with the added constraint that the distortion be close to its expected value — so . The extra condition is what converts “these two sequences look statistically related” into “this codeword is actually a good reproduction of this source sequence.”
Lemma1. The distortion typical set has probability
If are drawn i.i.d. , then .
ProofFour applications of the law of large numbers
All four conditions are normalized sums of i.i.d. random variables — including — so each tends to its expected value with probability 1, and the set satisfying all four has probability tending to 1.
∎
Lemma2. Reweighting bound
For all ,
ProofBound the three probabilities by their typicality ranges
∎
IntuitionWhy this lemma exists
The codebook is drawn from the marginal , but the calculation naturally produces the conditional . This lemma is the exchange rate between them, and the price is exactly — the same exponent that governed rival codewords in the channel coding proof, here governing whether a random codeword happens to cover a given source sequence.
Lemma3. A covering inequality
For and : .
ProofCheck the endpoints, then use convexity in
Let ; then and for , so , giving and hence — the case . The case is immediate. For , is convex in , so
∎
ProofAchievability — random codebook covering
Fix achieving the minimum, so , and compute .
Codebook. Randomly generate sequences i.i.d. , indexed , revealed to encoder and decoder.
Encoding. Encode by if ; if several, send the least; if none, send .
Decoding. Reproduce .
Step 1: Split the distortion by whether a good codeword exists. For a fixed codebook, sequences fall into two classes:
- Those with a distortion-typical codeword: distortion , and total probability at most 1, so they contribute at most .
- Those without: let be their total probability; each contributes at most , so they contribute at most — this is where boundedness of the distortion measure is used.
So everything reduces to showing is small.
Step 2: Set up and swap the order of summation. Let be the set of for which at least one codeword is distortion typical. Then
Reading it the second way: the probability of choosing a codebook that fails to represent , averaged over .
Step 3: One codeword’s failure probability. Let if the pair is distortion typical, else 0. A single random codeword fails to represent a fixed with probability , so all independent codewords fail with probability
Step 4: Apply Lemma 2 to convert the marginal into the conditional.
Step 5: Apply Lemma 3 with and , :
Step 6: Both pieces vanish. The last term equals , which goes to zero doubly exponentially fast if — so choosing to achieve the minimum, suffices. The first two terms are by Lemma 1.
Step 7: Extract one good code. For any there exist and such that the expected distortion averaged over random codebooks is below ; hence at least one codebook achieves it. Since was arbitrary, is achievable whenever .
∎
Packing versus covering
ImportantThe geometric duality, stated precisely
Channel coding for the Gaussian channel. The power constraint puts transmitted sequences in a sphere of radius . We need sequences such that the noise spheres of radius around them are almost disjoint — filling a sphere of radius with spheres of radius . The count is the volume ratio:
Rate distortion for the Gaussian source. A code with distortion is a set of sequences such that most source sequences — those within a sphere of radius — lie within of some codeword. The minimum number is again a volume ratio:
Channel coding is sphere packing; rate distortion coding is sphere covering. In transmission we want the largest set of codewords with large minimum distance; in rate distortion the smallest set that covers the entire space. A set meeting the sphere-packing bound for one meets it for the other — and in the Gaussian case, choosing codewords Gaussian with the appropriate variance is asymptotically optimal for both.
Strong typicality (sketch of the stronger result)
The proof above gives small expected distortion. In fact the probability that distortion exceeds also goes to 0, proved the same way but with strong rather than weak typicality.
DefinitionStrongly typical sequences
is -strongly typical w.r.t. if for all with ,
and whenever , where counts occurrences of . The pair version, with and , defines .
IntuitionWeak versus strong typicality
Weak typicality constrains only the average log-probability; strong typicality constrains every symbol’s empirical frequency. Strong is a stronger requirement, and it buys a two-sided bound where weak gave only an upper one.
LemmaTwo-sided joint typicality bound
For and drawn i.i.d. ,
with as , .
ImportantWhy the lower bound is the whole point
The weak joint AEP gave as an upper bound, which is what you need for packing (rival codewords rarely collide). For covering you need the lower bound: some codeword must actually succeed. Note the subtlety the chapter stresses — the expected number of jointly typical codewords is , exponentially large when , but an exponentially large expectation does not by itself guarantee at least one exists with high probability. The lower bound is what closes that gap.
ProofAchievability via strong typicality (outline)
Codebook, encoding and decoding as before but with . Source sequences now fall into three classes:
- Non-typical : total probability for large , contributing at most .
- Typical, with a jointly typical codeword: strong joint typicality plus continuity of the distortion in the joint distribution ensures they are also distortion typical, so distortion .
- Typical, with no jointly typical codeword: probability , contributing at most .
Expanding as before and substituting the lower bound from the lemma, with :
which if . So not only is the expected distortion close to — with probability going to 1 we find a codeword whose distortion is less than .
∎
Characterization of the optimum
The definition is a standard minimization of a convex function over the convex set of with and . Lagrange multipliers give conditions the optimum must satisfy.
DerivationLagrangian conditions for the optimal test channel
With , set up
the last term enforcing that is a conditional pmf. Differentiating and setting :
Normalizing via gives , hence
FormulaThe optimal test channel has exponential form
DerivationThe conditions on the output distribution
Multiplying by and summing over :
If we may divide, giving equations which, with the distortion equation, determine and the . The inequality case is covered by Kuhn–Tucker:
WarningCheckable, but not solvable
This characterization lets us check whether a given is optimal, but it is not easy to solve for the optimal output distribution from these equations. Hence the iterative algorithm below.
Computing capacity and : Blahut–Arimoto
The problem. Given two convex sets and , find .
IntuitionAlternating minimization
The obvious algorithm: take , find the closest ; fix that , find the closest point in ; repeat. The distance decreases at each stage — but does it converge to the minimum? Csiszár and Tusnády showed that if the sets are convex and the distance satisfies certain conditions, it does. In particular, if the sets are sets of probability distributions and the distance is relative entropy, the algorithm converges to the minimum relative entropy between the two sets.
To apply this we must rewrite as a minimum of relative entropy between two sets.
LemmaThe marginal minimizes relative entropy
For a given joint , the distribution minimizing is the marginal .
ProofThe difference is itself a relative entropy
∎
DerivationRewriting as a double minimization
The lemma lets us replace the marginal inside the mutual information by a free variable and minimize over it too:
Letting be the set of joint distributions with marginal satisfying the distortion constraint, and the set of product distributions with arbitrary :
ImportantThe Blahut–Arimoto algorithm for
Begin with a choice of and an initial output distribution ; then alternate:
- Minimize over the test channel (Lagrange multipliers):
- Minimize over the output distribution (the lemma):
Each step reduces the objective, so there is a limit, and Csiszár showed the limit is — with and depending on . Sweeping traces out the whole curve.
ImportantThe same algorithm computes channel capacity
Rewrite capacity as a double maximization using the same lemma:
and alternate:
- Best conditional given the input distribution:
- Best input distribution given the conditional:
This is the Arimoto–Blahut algorithm promised back in the capacity properties, and it closes that loop: the same alternating-projection idea computes both sides of the duality.
NoteA very general procedure
The Csiszár–Tusnády alternating minimization specializes to many other settings, including the EM algorithm and the algorithm for finding the log-optimal portfolio for a stock market.
Quick reference
| Object | Formula | Note |
|---|---|---|
| Rate distortion function | Dual of . | |
| Distortion rate function | Same boundary, other axis. | |
| Bernoulli(), Hamming | for , else 0 | Test channel: BSC with crossover . |
| Gaussian, squared error | for | : each bit quarters the distortion. |
| 1-bit quantizer vs. limit | vs. | Blocks beat symbols even for independent sources. |
| Parallel Gaussians | , | Reverse water-filling: ignore low-variance components. |
| Converse | data processing chain rule convexity/Jensen | No Fano needed. |
| Achievability | random codebook distortion typicality | , doubly exponential. |
| Geometry | packing (channel) vs. covering (source) | Same volume ratios, opposite goals. |
| Separation with distortion | achievable iff | replaces . |
| Optimal test channel | Exponential family in the distortion. | |
| Blahut–Arimoto | alternate and | Sweeping traces ; same idea gives . |
Facts to keep to hand:
- Both worked examples follow the same two-step recipe: lower-bound using conditioning-reduces-entropy plus a max-entropy bound, then exhibit a test channel meeting it. The test channel always runs backwards, specifying as plus independent noise.
- is non-increasing and convex — the convexity is not decoration, it is the Jensen step in the converse.
- Forward water-filling allocates power and abandons noisy components; reverse water-filling allocates distortion and abandons quiet ones.
- Weak typicality suffices for packing (upper bound on collision probability); covering needs the two-sided strong-typicality lemma, because a large expected number of good codewords does not guarantee one exists.
- Boundedness of enters in exactly one place: bounding the contribution of badly represented sequences by .
- The elephant-and-chicken gain is geometric: rectangular grids from independent descriptions do not fill space efficiently, which is why even for independent sources.
References
- [[lit/cover2006-elements|Cover & Thomas, Elements of Information Theory]] — Chapter 10