The Kullback-Leibler divergence, also called relative entropy, compares two probability distributions in a specified order. In , observations follow and the comparison probability distribution is : the first argument supplies the averaging weights. For probability mass functions on a finite alphabet,
Here is a random variable with probability distribution . For probability density functions relative to the same measure , replace the sum by . These formulas use natural logarithms unless stated otherwise. The expected value is under , even though appears in the denominator. [ref]
Take and on two outcomes. Direct calculation gives
The second outcome contributes negatively to the first sum: assigning it more probability than does makes its individual contribution negative. Nevertheless, relative entropy nonnegativity guarantees a nonnegative total. Reversing the arguments changes both the likelihood ratio and the averaging probabilities; taking an absolute value inside the logarithm would define a different quantity.
Figure 1.
Direction changes the averaging weights; a missing outcome can make relative entropy infinite
. Details.
The units depend on the logarithm: natural logarithms give nats, whereas base-two logarithms give bits. Divide a value in nats by to obtain bits; the forward example is approximately bits. Changing the base rescales every Kullback-Leibler divergence by the same positive factor. Since the two calculated directions differ, Kullback-Leibler divergence is asymmetric and cannot be a metric. It also need not satisfy the triangle inequality. [ref]
The operational meaning is an expected penalty for using the wrong probability distribution. A prediction incurs log-loss when outcome occurs, the negative of the logarithmic scoring rule. Under , its expected value is the cross-entropy . Predicting with itself incurs information entropy , so
Thus Kullback-Leibler divergence is exactly excess expected log-loss, whenever these separate quantities are finite. [ref]
For lossless source coding, ideal codeword lengths similarly give excess expected length in bits per symbol. Actual prefix codes require integer codeword lengths; Shannon's source coding theorem explains how long blocks approach ideal per-symbol lengths. The interpretation concerns an average, not a fractional physical bit attached to every outcome. In our example, ideal coding with costs one bit per symbol, while bits; the difference is exactly the computed bits. [ref]
Zeros require explicit conventions. An outcome with contributes zero, including when ; the convention agrees with the relevant limit. If but , the Kullback-Leibler divergence is infinite: the predictor has declared impossible an outcome that can occur. On a finite alphabet, the probability support of must therefore be contained in the probability support of for a finite answer. For example, and give , but . For general probability measures, failure of absolute continuity of measures likewise gives infinity. Even does not guarantee a finite integral. [ref]
To see how confidently wrong predictions are punished, hold the true Bernoulli distribution parameter at and vary the predicted parameter . Its binary relative entropy is
It vanishes at , equals approximately nats at , and equals nats at . Both endpoints give infinity because both outcomes remain possible under . Predicting almost no successes is especially costly because successes actually occur three quarters of the time. The reversed binary relative entropy stays finite at the endpoints: its averaging probability distribution concentrates on just one outcome, and assigns positive probability to both.
Figure 2.
Bernoulli relative entropy with true success probability 0.75 and varying predicted probability
. Details.
For model selection, minimizing expected log-loss ranks candidate statistical models by , since is common to them. The true probability distribution is usually unknown, so one estimates predictive performance using fresh observations or cross-validation. Fitting and assessing on the same data can reward overfitting; a small fitted Kullback-Leibler divergence alone does not establish useful prediction.
In variational inference, a tractable trial probability distribution commonly minimizes against a target posterior distribution . Maximizing the evidence lower bound accomplishes this without evaluating the target's normalization constant. The averaging now follows : placing trial probability where the posterior distribution assigns almost none is strongly penalized. The chosen direction and trial family therefore matter. [ref]
These comparisons do not by themselves establish causal inference. Two statistical models can reproduce the same observed probability distribution while predicting different responses to an intervention. Choosing the smaller Kullback-Leibler divergence therefore needs additional assumptions or experimental evidence before supporting a causal claim. [ref]
The original reference is S. Kullback and R. A. Leibler's 1951 paper [ref], published in The Annals of Mathematical Statistics 22(1), pages 79–86. Its title connects this comparison with sufficient statistics: the historical setting was statistical information, before today's widespread applications in prediction and variational inference.
Let be a random probability mass function on a finite alphabet, let , and suppose a fixed reference is positive on the probability support of . Then vanishes almost surely wherever , and
Taking expected values yields the displayed decomposition. In particular it applies to an unbiased empirical distribution. It separates sampling fluctuation from reference mismatch: even perfect recovery of leaves the deterministic relative entropy . A bound comparing different references must account for this term.
For a fixed probability mass function on a finite alphabet, relative entropy is a convex function of its first probability mass function. For , the coordinate function has on and extends continuously with . Applying scalar convexity coordinate by coordinate proves the inequality. If , finite relative entropy requires for every positive-weight constituent; otherwise the right side is infinite. Thus the assertion also holds as an extended-valued convexity statement. On the probability simplex supported where , the function is strictly convex: two distinct probability mass functions give a strict inequality for .
For a measurable event , applying Jensen inequality to separately on and its complement shows that the Kullback-Leibler divergence between two probability measures is at least the divergence between the two event indicators. This reduces a general probability measure comparison to a binary one and is the key step in a proof of Pinsker's inequality.
For , the second derivative with respect to is . Its value and first derivative at vanish, so . Boundary values follow by continuity or the infinite-divergence convention. Together with the binary partition bound for relative entropy, this gives Pinsker's inequality with the natural-logarithm constant.
For sufficiently regular positive probability densities, this compares their spatial logarithmic derivatives. It is the dissipation functional for relative entropy under suitable diffusion equations. For standard Gaussian , it becomes , and in one dimension equals at unit mass.
The differential estimate gives the displayed exponential bound by an integrating factor. Start at any time with finite information. Combining this with a zero limiting entropy yields .
For probability distributions , relative entropy satisfies , with equality exactly when . Thus truthful prediction uniquely minimizes expected log-loss whenever the comparison is well defined, explaining the strictly proper scoring rule property of the logarithmic scoring rule.
For a short proof with probability density functions and , set . Their integrals both equal one, giving
The strictly convex function is minimized only at , so equality means almost everywhere. Its value at zero is one by . Where , relative entropy is infinite; where both vanish, the contribution is zero. These conventions extend the argument beyond positive reference probability density functions.
For nonnegative densities of possibly different total masses, this divergence includes the mass correction as well as the logarithmic term. It is the Bregman distance of the maximum-entropy regularization functional at a positive reference . Convexity of proves nonnegativity. For equal masses the correction integrates to zero, recovering the Kullback-Leibler divergence; for probability density functions both masses are one. Use the usual extended-value conventions at zero reference density.
For probability mass functions with compatible supports,
When the final term vanishes, this is the Pythagorean identity for relative entropy.
The Pythagorean identity is
whenever the residual term in the three-point identity for relative entropy is zero. Convex information projections replace equality by the corresponding Pythagorean inequality.
The binary relative entropy is the Kullback-Leibler divergence between Bernoulli distributions:
It is the exact exponent obtained by optimizing the Chernoff bound for a Bernoulli mean.
For probability distributions and on the same finite set,
with equality exactly when on the support of .
For independent outcomes with positive probability distribution , allocations summing to one and return multipliers , the strong law of large numbers gives asymptotic logarithmic fortune growth . Gibbs inequality gives , so the unique optimum is . Writing gives . Thus guarantees positive optimal growth, whereas allows the house to force negative growth by choosing , but does not guarantee decline for every choice of .
For probability distributions and on a product space, the Kullback-Leibler divergence decomposes into the divergence of a marginal and the expected divergence of the corresponding conditional distributions. Iteration gives
For nonnegative , with and , the log-sum inequality is
It proves both Gibbs inequality and the data processing inequality for relative entropy.
For a probability mass function of full support on a finite alphabet and a real function ,
where uses natural logarithms. The unique maximizing probability mass function is the exponential tilt .
For univariate normal distributions,
If is a product measure, is any probability measure, and omits coordinate , then
For a random vector ,
This is equivalent to Han's inequality for relative entropy after expansion against a product reference measure.
For a discrete random vector with coordinates, this is the average information entropy per coordinate over all subsets of size . Independent coordinates give the same average for every , even when their individual entropies differ. If all coordinates are copies of one random variable , the average is .
For discrete random variables, normalized subset entropy decreases with subset size. For finite entropies, the chain rule for information entropy and conditioning reduces entropy give . Sum this over all -subsets . Every -subset occurs times, and cancels the normalization factors. This proves . If a marginal entropy is infinite, every one of these subset averages is infinite; otherwise all entropies used in the proof are finite.
The strong form
follows by iterating entropy submodularity.
For a product reference and arbitrary ,
It follows from the chain rule for relative entropy and convexity of relative entropy in its first argument.

Ancestors (5)

  1. f-divergence
  2. Probability and statistics
  3. Area of mathematics
  4. Mathematics
  5. Home

Synonyms (1)

Discussion (0) New discussion

There are no discussions about this article yet.

Articles by others on the same topic (1)