When Does a VAE Mix? Aggregate-Posterior KL, Mutual Information, and Encode--Decode Gibbs Chains

Ahmad Ayaz Amin, Guanghui WangAutoMLR @ NeurIPS 2026

TL;DR

If you alternate running a Variational Autoencoder's (VAE) decoder and encoder—feeding generated data back into the encoder, and latent codes back into the decoder—you get a Markov chain. This paper proves that in linear-Gaussian VAEs, two classic terms from the VAE objective control completely different parts of this chain's behavior: the aggregate-posterior KL measures how far your starting prior is from the target, while mutual information controls how fast the chain forgets its past. Crucially, a chain can mix super fast and still converge to the wrong distribution if the encoder and decoder aren't compatible.

What Problem Does This Paper Address?

Variational Autoencoders (VAEs) learn a decoder $p_\theta(x \mid z)$ to generate data from latent codes, and an encoder $q_\phi(z \mid x)$ to map data back into latent space. A classic way to sample from a VAE is to run an "encode–decode Gibbs chain": start with a latent code $z_0$ from the prior $p(z)$, decode it to $x_0$, encode $x_0$ to $z_1$, and repeat.

Normally, practitioners look at a famous decomposition of the VAE's KL-divergence penalty (often called "ELBO surgery"), which splits it into two terms: the mutual information $I_Q(X; Z)$ between data and latents, and the aggregate-posterior KL $D_{\text{KL}}(q_\phi(z) \parallel p(z))$, which measures how well the average encoded distribution matches the prior. While these terms are usually treated as training regularizers, it wasn't clear what they actually mean for the dynamics of the encode–decode Markov chain—specifically, how fast it mixes and whether it even converges to the right place.

Methods

The authors analyze the encode–decode chain $z_t \to x_t \sim p_\theta(x \mid z_t) \to z_{t+1} \sim q_\phi(z \mid x_t)$ in the linear-Gaussian VAE setting, where the prior, encoder, and decoder are all linear-Gaussian maps. This is the simplest model that still behaves like a real VAE while remaining 100% mathematically solvable.

Their key theoretical step is defining compatibility: an encoder and decoder are compatible if the decoder $p_\theta(x \mid z)$ matches the exact reverse conditional distribution induced by the data and the encoder. Under compatibility:

  1. The chain is a true two-block Gibbs sampler targeting the aggregate posterior $q_\phi(z)$.
  2. By whitening and rotating into canonical-correlation coordinates, the chain's transition eigenvalues are simply $\lambda_i = r_i^2$ (the squared canonical correlations between $X$ and $Z$).
  3. Mutual information is a log-determinant summary of these eigenvalues: $I_Q(X; Z) = -\frac{1}{2} \sum_i \log(1 - \lambda_i)$.

To test what happens when compatibility breaks, they also derive a discrete Lyapunov equation for the learned linear VAE's stationary covariance, allowing them to compute the exact stationary-target error without noisy simulations.

Datasets

No external or real-world datasets were used. Instead, the authors used two controlled synthetic setups:

  • Exact compatible Gaussian joints: Simulated with $k=8$ latent dimensions, 60,000 particles for transient KL tracking, and a 250,000-step trajectory for autocorrelation.
  • Population-trained linear $\beta$-VAE: Trained in PyTorch directly against exact population expectations for synthetic 6-dimensional Gaussian data $p_{\text{data}}(x) = \mathcal{N}(0, \text{diag}(5.5, 3, 1.5, 0.5, 0.5, 0.5))$ with decoder variance $0.5$.

Key Insights and Ideas

  • A three-way diagnostic: The paper cleanly separates iterative VAE sampling into three distinct properties: aggregate KL (initialization error), dependence/MI (chain memory), and compatibility (target correctness).
  • Scalar mutual information is a misleading mixing metric: Knowing the total mutual information isn't enough to predict how fast a chain mixes. Spreading 1 nat of MI evenly across 8 latent modes gives fast mixing, while concentrating that exact same 1 nat into a single mode creates a stubborn, slow-mixing bottleneck.
  • Fast mixing $\neq$ correct sampling: A chain can forget its past almost immediately (low memory, fast mixing) while converging to the completely wrong stationary distribution if the encoder and decoder are incompatible.
  • Posterior collapse is a "fast" but useless chain: When $\beta$ is cranked up high enough to cause posterior collapse ($I_Q(X; Z) = 0$), the chain mixes in a single sweep from any starting state—but only because the encoder ignores the data and the decoder ignores the latents.

Key Results

In the controlled $k=8$ compatible Gaussian experiment (all starting with the exact same initial mismatch of $D_{\text{KL}}(q \parallel p) = 1.90648$ nats):

  • Zero MI: Mixes in one sweep, with worst-direction integrated autocorrelation time (IAT) of $1.000$ and one-sweep KL error of $0.0000$.
  • One nat, spread over 8 modes: Worst-direction IAT is $1.568$ and one-sweep KL error is $0.0021$.
  • One nat, concentrated in 1 mode: Worst-direction IAT jumps to $13.778$ and one-sweep KL error is $0.2269$—over two orders of magnitude worse.
Figure 1: Left: target-to-chain KL under identical prior initialization. Zero MI reaches the aggregate posterior in one sweep. Right: at one nat total MI, concentrating information creates much larger worst-direction autocorrelation than spreading it.

In the population-trained linear $\beta$-VAE sweep:

  • At $\beta = 1$, the chain is compatible ($D_{\text{KL}}(q \parallel \pi_K) = 8.3 \times 10^{-14}$) with high memory ($\rho(AW) = 0.909$).
  • At $\beta = 4$, memory drops ($\rho(AW) = 0.636$), but incompatibility introduces a stationary-target bias of $D_{\text{KL}}(q \parallel \pi_K) = 0.0450$ nats.
  • At $\beta = 12$, full posterior collapse occurs: MI and spectral radius both hit $0.000$, yielding an instant one-step refresh.
Population linear beta-VAE sweep

Limitations and Future Work

The authors note that their exact spectral and finite-time results rely heavily on linearity and Gaussianity, which aren't guaranteed to hold for general, nonlinear neural VAEs. Additionally, the trained experiments used fixed, unimodal Gaussian decoders; as $\beta$ increases, the decoder struggles to capture the true conditional variation, which may explain the observed stationary-target bias. Future work should develop a perturbation theory to bound stationary-target bias by encoder–decoder incompatibility, and test whether more expressive decoders (like mixture decoders) can achieve both fast mixing and target correctness on multimodal data.

Summary updated

BibTeX
@inproceedings{amin2026when,
  author = {Ahmad Ayaz Amin and Guanghui Wang},
  title = {{When Does a VAE Mix? Aggregate-Posterior KL, Mutual Information, and Encode--Decode Gibbs Chains}},
  booktitle = {AutoMLR @ NeurIPS},
  year = {2026},
  url = {https://openreview.net/forum?id=iQUzeulBou},
}
Figure