Calibration models for Kullback-Leibler divergence

distribution-theory
Kullback-Leibler-divergence
Author

James E. Pustejovsky

Published

July 12, 2026

For a new project, I’ve been thinking about model evaluation and model selection in meta-analysis. You can’t get very far into the literature on this without running into Kullback-Leibler divergence, which is a metric for quantifying discrepancies between distributions. Among other things, KL divergence is the basis of information criteria, including the Akaike (Akaike, 1973), Bayesian (Schwarz, 1978), Deviance (Spiegelhalter et al., 2002), Watanabe (Watanabe, 2010), and LOO (Vehtari & Lampinen, 2002) information criteria. For two distributions \(P\) and \(Q\) with probability density functions \(p(x)\) and \(q(x)\), respectively, the KL divergence of Q from P is \[ KL(P||Q) = \mathbb{E}_P\left[\log p(X) - \log q(X)\right], \] where \(\mathbb{E}_P\) means that the expectation is taken with respect to \(P\). Note that KL-divergence is not, strictly speaking, a distance metric because it is not symmetric: \(KL(P||Q) \neq KL(Q || P)\) because the expectation is taken under different distributions in each case.

One of the vexing things about working with KL divergence is interpreting its magnitude. If two models differ by 4 in KL divergence, is that big and meaningful? Or trivial? How should an analyst make judgements on the basis of KL divergence, AICs, or LOOICs? There are surely many answers to this question. In this post, I’ll explore a technique that’s been called calibration.

Suppose we are examining two different models fitted to the same data, trying to decide which one fits better. The (estimated) KL divergences of the two models differ by \(\Delta\). Calibration involves constructing an analogy to these two models by finding simpler-to-conceptualize models with the same KL divergence, \(KL = \Delta\). McCulloch (1989) suggested calibrating based on the KL divergence of a Bernoulli\((\pi)\) distribution from a Bernoulli\((\frac{1}{2})\) distribution. Domingue et al. (2025) recently described a relative model fit index called the InterModel Vigorish, which is derived along essentially the same lines as McCulloch (1989)’s calibration model. Goutis & Robert (1998) gave examples of calibrations based on other single-parameter distributions including the divergence of Poisson\((\lambda)\) from Poisson\((1)\) and divergence of \(N(\mu,1)\) from \(N(0,1)\). The diversity of potential calibration models is effectively endless, constrained only by one’s imagination and computing power.

Coin flip calibrations

Here is a slight generalization of the calibration model proposed in McCulloch (1989), where I use Binomial instead of Bernoulli distributions. Suppose that the true model \(P\) is Binomial\(\left(N,\frac{1}{2}\right)\) but our prediction model \(Q\) is \(\left(N,\pi\right)\). The KL divergence of the latter from the former is \[ \begin{aligned} KL\left(Bin\left(N,\frac{1}{2}\right), Bin\left(N,\pi\right)\right) &= N \times \left[\log\left(\frac{1}{2}\right) -\frac{1}{2} \left[\log \pi + \log(1 - \pi)\right]\right] \\ &= -\frac{K}{2} \log\left(4 \pi(1 - \pi)\right). \end{aligned} \] Given a KL-divergence of \(\Delta\), the prediction model with corresponding KL-divergence would have \(\pi = \frac{1}{2}\left[1 + \sqrt{1 - \exp\left(-\frac{2\Delta}{N}\right)}\right]\).

In the interactive Figure 1, you can specify a degree of divergence \(\Delta\) (along with the number of trials \(N\)) and see the binomial distribution with probability \(\pi\) that has KL-divergence of \(\Delta\) from a binomial distribution with probability \(\frac{1}{2}\). You can think of this as representing the divergence (or lack of fit) that corresponds to assuming you have a biased \(\pi\) coin across \(N\) flips, when the coin is actually fair.

Figure 1: Binomial\((K,\pi)\) distribution (black lollipops) that diverges by \(\Delta\) from a Binomial\((K,\frac{1}{2})\) distribution (blue bars)

McCulloch’s calibration model feels backwards to me—why would one predict that a coin is biased when it is actually perfectly fair? The other way to set up this problem would be to imagine that you are flipping \(N\) coins and that you expect the coin to be fair, but it is actually biased. This corresponds to finding the probability for \(Q\) such that the KL divergence of \(P\) from \(Q(\phi)\) is equal to \(\Delta\): \[ KL\left(Bin\left(N,\phi\right), Bin\left(N,\frac{1}{2}\right)\right) = N \times \left[\log 2 + \phi \log \phi + (1 - \phi) \log(1 - \phi)\right]. \] This is a bit harder to solve for \(\phi\), but no problem to work out numerically. Figure 2 displays the calibrated models corresponding to a given difference \(\Delta\) in KL divergence, for whatever value of \(N\) that you like. For small or moderate \(N\), this calibration model is distinct from McCulloch’s because of the asymmetry of KL divergence.

Figure 2: Binomial\((K,\frac{1}{2})\) distribution (black lollipops) that diverges by \(\Delta\) from a Binomial\((K,\pi)\) distribution (green bars)

Standard Normal Calibrations

The appeal of coin flips (or binomial distributions) for this sort of calibration exercise is that it they are familiar and just about as simple as you can get—one bit of information per flip—as far as probability models go. However, this isn’t necessarily the most intuitive calibration model for meta-analysis. In a conventional random effects meta-analysis, the effect size parameters are typically assumed to be normally distributed about some average effect and with some standard deviation that measures the degree of heterogeneity in the results across studies. Given that meta-analysts are accustomed to thinking about Gaussian distributions, perhaps a more natural calibration model would be one that involves the standard normal distribution. Here I’ll treat the standard normal \(N(0,1)\) distribution as the inferior prediction model and consider a variety of superior models for the unknown true distribution. For greater flexibility (as well as consistency with the coin flip models), I’ll always write KL divergences for samples of \(N\) observations, which is just \(N\) times the KL divergence of a single observation.1

A simple starting point would be to compare two normal distributions to each other. The KL divergence of a \(N(\mu,\sigma^2)\) distribution from the standard normal distribution is quite simple: \[ KL_N\left(N\left(\mu,\sigma^2\right), N\left(0,1\right)\right) = \frac{N}{2}\left(\mu^2 + \sigma^2 - 1 - \log \sigma^2\right). \] Even simpler, Goutis & Robert (1998) considered a calibration model involving normal distributions with unit variance, so the KL divergence is just \(N \times \mu^2 / 2\). Thus, taking \(\mu = \sqrt{\frac{2\Delta}{N}}\) leads to two unit-Gaussian distributions for which an \(N\)-sample has a divergence of \(\Delta\).

But why focus only on location shifts? Instead, what if the true model \(P\) had mean zero but differing variance? Then \[ KL_N\left(N\left(0,\sigma^2\right), N\left(0,1\right)\right) = \frac{N}{2}\left(\sigma^2 - 1 - \log \sigma^2\right). \] To obtain a KL divergence of \(\Delta\), set \(\sigma^2 = - W\left(-\exp\left[-\left(\frac{2\Delta}{N} + 1\right)\right]\right)\), where \(W()\) is the Lambert W function.

Neither of these calibration models seems especially salient in the meta-analysis context. There, it seems rather implausible that a model would be badly mis-specified in terms of the center or spread of the distribution of effects. I would find it more plausible that a model might be mis-specified in terms of its shape somehow—perhaps missing some skewness or kurtosis in the distribution of effects that a (Gaussian) random effects model would not capture.

What if the superior model was a shifted gamma distribution with shape parameter \(\alpha\), scale parameter \(\beta\), and shift \(c\)? If \(X + c \sim \Gamma(\alpha, \beta)\), then setting \(\beta = \sqrt{\alpha}\) and \(c = -\sqrt{\alpha}\) leads to a distribution with mean zero, unit variance, skewness \(2 / \sqrt{\alpha}\), and differential entropy \[ \mathcal{H}(P) = \alpha - \frac{1}{2}\log (\alpha) + \log \Gamma(\alpha) + (1 - \alpha) \psi(\alpha), \] where \(\Gamma()\) is the gamma function and \(\psi()\) is the digamma function. The KL divergence of an \(N\)-sample from this shifted gamma distribution to the unit normal distribution is therefore \[ \begin{aligned} KL_N\left(\Gamma\left(\alpha,\sqrt\alpha\right) + \sqrt\alpha, N\left(0,1\right)\right) &= \frac{1}{2}\log(2\pi) + \frac{1}{2} - \mathcal{H}(P) \\ &= \frac{1}{2}\log(2\pi) + \frac{1}{2} - \alpha + \frac{1}{2}\log (\alpha) - \log \Gamma(\alpha) - (1 - \alpha) \psi(\alpha). \end{aligned} \] Although there’s not a closed-form inverse, it’s easy enough to solve numerically for \(\alpha\).

If mis-specification could manifest as skewness, then why not kurtosis too? Suppose the true model is a Student \(t\) distribution with degrees of freedom \(\nu\). For simplicity, I won’t worry about forcing the \(t\) to have unit variance. For an \(N\)-sample, the KL-divergence of the standard normal from a \(t(\nu)\) distribution is \[ \begin{aligned} KL_N\left(t(\nu), N\left(0,1\right)\right) &= \frac{N}{2}\left[\log(2\pi) + \frac{\nu}{\nu - 2} \right. \\ & \qquad \qquad \left. - (\nu + 1)\left(\psi\left(\frac{\nu + 1}{2}\right) - \psi\left(\frac{\nu}{2}\right)\right) \right. \\ & \qquad \qquad \qquad \qquad \qquad\left. - \log(\nu) - 2 \log B\left(\frac{\nu}{2}, \frac{1}{2}\right) \right], \end{aligned} \] where \(\psi()\) is the digamma function and \(B()\) is the beta function. For a given \(\Delta\), the expression can be solved numerically for \(\nu\).

The interactive Figure 3 displays all four of these calibration models, where the superior distributions differ by location, scale, skew, or kurtosis, respectively. One thing that jumps out to me about this visualization is that the divergence from the \(t(\nu)\) distribution seems much subtler than the others. With this distribution, all of the action is in the tails. Put differently, the KL-divergence is driven by differences in the probability assigned to rare extreme outcomes.

Figure 3: Standard normal distribution (black line) that diverges by \(\Delta\) from selected non-normal distributions, including \(N(\mu, 1)\) (blue density), \(N(0,\sigma^2)\) (green density), shifted \(\Gamma(\alpha, \sqrt{\alpha})\) (orange density), or \(t(\nu)\) (red density).
Code
mu_toprint = mu.toFixed(3)
D_mu = N * mu**2 / 2
D_mu_toprint = D_mu.toFixed(3) 

sigma_toprint = sigma.toFixed(3)
D_sigma = KL_sigma(sigma).toFixed(3)

alpha_toprint = alpha.toFixed(3)
D_alpha = math.exp(logKL_gamma(log_alpha)).toFixed(3)

nu_toprint = nu.toFixed(3)
D_nu = KL_t(nu).toFixed(3)

How useful are these calibration models? I’m not entirely sure yet.2 I find them appealing because they turn the very abstract concept of KL-divergence into something that can be visualized. However, having to make arbitrary choices of distributions to construct the calibration model does seem a bit weird to me. I will just leave this up and let it marinate a bit.

Back to top

References

Akaike, H. (1973). Information theory and an extension of the maximum likelihood principle. In 2nd International Symposium on Information Theory (pp. 267–281). Akadémiai Kiadó. https://hero.epa.gov/reference/591/
Domingue, B. W., Rahal, C., Faul, J., Freese, J., Kanopka, K., Rigos, A., Stenhaug, B., & Tripathi, A. S. (2025). The InterModel Vigorish (IMV) as a flexible and portable approach for quantifying predictive accuracy with binary outcomes. PLOS ONE, 20(3), e0316491. https://doi.org/10.1371/journal.pone.0316491
Goutis, C., & Robert, C. P. (1998). Model choice in generalised linear models: A Bayesian approach via Kullback-Leibler projections. Biometrika, 85(1), 29–37. https://doi.org/10.1093/biomet/85.1.29
McCulloch, R. E. (1989). Local model influence. Journal of the American Statistical Association, 84(406), 473–478. https://doi.org/10.2307/2289932
Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464. http://www.jstor.org/stable/2958889
Spiegelhalter, D. J., Best, N. G., Carlin, B. P., & Van Der Linde, A. (2002). Bayesian measures of model complexity and fit. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 64(4), 583–639. https://doi.org/10.1111/1467-9868.00353
Vehtari, A., & Lampinen, J. (2002). Bayesian model assessment and comparison using cross-validation predictive densities. Neural Computation, 14(10), 2439–2468. https://doi.org/10.1162/08997660260293292
Watanabe, S. (2010). Asymptotic equivalence of bayes cross validation and widely applicable information criterion in singular learning theory. Journal of Machine Learning Research, 11(116), 3571–3594. http://jmlr.org/papers/v11/watanabe10a.html

Footnotes

  1. All of the math that follows amounts to applications of the same general derivation. For a distribution \(P\), \[ \begin{aligned} KL_N\left(P, N\left(0,1\right)\right) &= \mathbb{E}_P\left[\log p(X) - \log \phi(X)\right] \\ &= \mathbb{E}_P\left[\log p(X) + \frac{1}{2}\log(2\pi) + \frac{1}{2} X^2\right] \\ &= \frac{1}{2}\log(2\pi) + \frac{1}{2} \left(\left[\mathbb{E}_P (X) \right]^2 + \mathbb{V}_P(X)\right) - \mathcal{H}(P), \end{aligned} \] where \(\mathcal{H}(P)\) is the differential entropy of the distribution \(P\). Thus, the KL divergence depends only on the entropy, mean, and variance of the distribution. If \(P\) is constructed to have the same mean and variance as the standard normal, then things simplify even further to \(KL_N\left(P, N\left(0,1\right)\right) = \frac{1}{2}\log(2\pi) + \frac{1}{2} - \mathcal{H}(P)\).↩︎

  2. If you have thoughts on these models, please feel free to comment!↩︎