Post · 2 min read· p. 93

Local KL Divergence

The KL divergence is an important tool for studying the distance between two probability distributions. Formally, given two distributions pp and qq, the KL divergence is defined as

KL(p∣∣q):=∫p(x)log⁡(p(x)/q(x))dxKL(p || q) := \int p(x) \log(p(x)/q(x)) dx

Note that KL(p∣∣q)≠KL(q∣∣p)KL(p || q) \neq KL(q || p). Intuitively, a small KL(p∣∣q)KL(p || q) means that there are few points that pp assigns high probability to but that qq does not. We can also think of KL(p∣∣q)KL(p || q) as the number of bits of information needed to update from the distribution qq to the distribution pp.

Suppose that p and q are both mixtures of other distributions: p(x)=∑iαiFi(x)p(x) = \sum_i \alpha_i F_i(x) and q(x)=∑iβiGi(x)q(x) = \sum_i \beta_i G_i(x). Can we bound KL(p∣∣q)KL(p || q) in terms of the KL(Fi∣∣Gi)KL(F_i || G_i)? In some sense this is asking to upper bound the KL divergence in terms of some more local KL divergence. It turns out this can be done:

Theorem: If ∑iαi=∑iβi=1\sum_i \alpha_i = \sum_i \beta_i = 1 and FiF_i and GiG_i are all probability distributions, then

KL(∑iαiFi∣∣∑iβiGi)≤∑iαi(log⁡(αi/βi)+KL(Fi∣∣Gi))KL\left(\sum_i \alpha_i F_i || \sum_i \beta_i G_i\right) \leq \sum_i \alpha_i \left(\log(\alpha_i/\beta_i) + KL(F_i || G_i)\right).

Proof: If we expand the definition, then we are trying to prove that

∫(∑αiFi(x))log⁡(∑αiFi(x)∑βiGi(x))dx≤∫(∑iαiFi(x)log⁡(αiFi(x)βiGi(x)))dx\int \left(\sum \alpha_i F_i(x)\right) \log\left(\frac{\sum \alpha_i F_i(x)}{\sum \beta_i G_i(x)}\right) dx \leq \int \left(\sum_i \alpha_iF_i(x) \log\left(\frac{\alpha_i F_i(x)}{\beta_i G_i(x)}\right)\right) dx

We will in fact show that this is true for every value of xx, so that it is certainly true for the integral. Using log⁡(x/y)=−log⁡(y/x)\log(x/y) = -\log(y/x), re-write the condition for a given value of xx as

(∑αiFi(x))log⁡(∑βiGi(x)∑αiFi(x))≥∑iαiFi(x)log⁡(βiGi(x)αiFi(x))\left(\sum \alpha_i F_i(x)\right) \log\left(\frac{\sum \beta_i G_i(x)}{\sum \alpha_i F_i(x)}\right) \geq \sum_i \alpha_iF_i(x) \log\left(\frac{\beta_i G_i(x)}{\alpha_i F_i(x)}\right)

(Note that the sign of the inequality flipped because we replaced the two expressions with their negatives.) Now, this follows by using Jensen's inequality on the log⁡\log function:

∑iαiFi(x)log⁡(βiGi(x)αiFi(x))≤(∑iαiFi(x))log⁡(∑iβiGi(x)αiFi(x)αiFi(x)∑αiFi(x))=(∑iαiFi(x))log⁡(∑iβiGi(x)∑iαiFi(x))\sum_i \alpha_iF_i(x) \log\left(\frac{\beta_i G_i(x)}{\alpha_i F_i(x)}\right) \leq \left(\sum_i \alpha_iF_i(x)\right) \log\left(\frac{\sum_i \frac{\beta_i G_i(x)}{\alpha_i F_i(x)} \alpha_i F_i(x)}{\sum \alpha_i F_i(x)}\right) = \left(\sum_i \alpha_i F_i(x)\right) \log\left(\frac{\sum_i \beta_i G_i(x)}{\sum_i \alpha_i F_i(x)}\right)

This proves the inequality and therefore the theorem. □\square

Remark: Intuitively, if we want to describe ∑αiFi\sum \alpha_i F_i in terms of ∑βiGi\sum \beta_i G_i, it is enough to first locate the iith term in the sum and then to describe FiF_i in terms of GiG_i. The theorem is a formalization of this intuition. In the case that Fi=GiF_i = G_i, it also says that the KL divergence between two different mixtures of the same set of distributions is at most the KL divergence between the mixture weights.