Kullback–Leibler (KL) divergence measures the discrepancy between probability distributions. In variational inference, p(x) is a target posterior and q(x) is a tractable approximation with adjustable parameters. Minimizing their divergence turns posterior approximation into an optimization problem. section 1.4.1
Direction matters. Reverse KL is KL(q||p) = E_q[log(q(x)/p(x))]; forward KL is KL(p||q) = E_p[log(p(x)/q(x))]. Both are nonnegative, but exchanging p and q can change the preferred approximation. When a single-peaked q approximates a two-peaked p, reverse KL tends to concentrate on one mode, while forward KL can favor a broader fit covering both peaks. section 3.1 section 1.4.1
Check the Gaussian objective
Let p(x) = N(0,1) and q(x) = N(μ,σ²). Computing reverse KL gives KL(q||p) = (μ² + σ² − 1 − log σ²)/2. Fixing σ² = 4 reduces this to (μ² + 3 − log 4)/2. Its minimum over μ is at μ = 0: matching the means helps, but the divergence remains positive because the variances differ. section 3.1
Figure 3.2 Forward KL (left) q(x) overestimates the support, while reverse KL (right) q(x) locks onto a mode.
Compare the broad forward-KL approximation with the reverse-KL approximation concentrated on one mode of the target. section 3.1
The same discrepancy serves several objectives. In variational inference it contributes to a variational free-energy objective and the derivation of a bound used for optimization. A KL-based bound also supports iterative mutual-information maximization. In a time-series LSTM-VAE, minimizing KL structures the latent Gaussian toward N(0,1), alongside a likelihood objective for detecting anomalies. section 3.1 section 3.4 section 11.1.1











