Mind the Gap when Conditioning Amortised Inference in Sequential Latent-Variable Models

Justin Bayer, Maximilian Soelch, Atanas Mirchev, Baris Kayalibay, Patrick van der Smagt

In the world of deep learning, Variational Autoencoders (VAEs) are a staple for modeling complex data. When applying them to sequential data—like video, speech, or robot trajectories—researchers often make a seemingly sensible design choice: they only feed the "past" into the inference network to predict the current hidden state. After all, that is exactly how a real-time filter works.

However, the paper "Mind the Gap when Conditioning Amortised Inference in Sequential Latent-Variable Models" argues that this common practice is a trap. The authors demonstrate that "partial conditioning" creates a fundamental mismatch that does not just make inference harder—it actually breaks the generative model itself.

The Conditioning Gap

When training a VAE, an inference network is used to guess the latent variables ($z$) that produced the data ($x$). In sequential models, the "true" mathematical posterior for a latent state at time $t$ actually depends on the entire sequence of observations ($x_{1:T}$).

Despite this, many researchers use partial conditioning, feeding only observations up to the current time ($x_{1:t}$) into the network. This is often done for efficiency or to mimic a "Bayesian filter" for real-time applications. The authors identify that this creates a conditioning gap.

This gap is not just a matter of having less information; it is a structural problem. Because the ELBO (Evidence Lower Bound) objective involves a logarithm, forcing multiple different "true" posteriors to share one partially-conditioned approximate posterior results in a "product of experts" compromise.

Illustration of the conditioning gap showing how partial conditioning results in a sharply peaked product distribution rather than the true mixture.

This compromise often manifests as a sharply peaked distribution located in a "no-man's land" between the actual modes of the data, leading the model to learn incorrect physics or patterns.

Methods and Experimental Setup

The authors provide a rigorous theoretical analysis followed by an empirical study using Variational State-Space Models (VSSMs).

  1. Theoretical Proof: They prove that minimizing the expected KL divergence with a partially-conditioned posterior leads to an optimal distribution that is a product of the full posteriors. In probability, a product of distributions is much "sharper" and more restrictive than a mixture (which is what the true marginal posterior looks like).
  2. Conditioning Comparison: They compare three levels of information given to the inference network:
  3. Partial: Only past data ($x_{1:t}$).
  4. Semi (Sneak Peek): Past data plus a few steps into the future.
  5. Full: The entire sequence ($x_{1:T}$), typically implemented using a bidirectional RNN.

They tested their theory on three diverse datasets where dynamics are stochastic or observations are imperfect: UAV Trajectories (Blackbird Dataset), Row-wise MNIST, and Traffic Flow (Seattle Loop).

Key Insights

  • The "Veto" Effect: The most striking insight is the difference between mixtures and products. In a mixture (the true posterior), if one future is possible, the model "passes" it. In a product (the result of partial conditioning), if any possible future "vetoes" a latent state, the probability drops to zero. This makes the model overly confident and often wrong.
  • The Generative Model Suffers: Usually, we think of inference as just a tool to train the generator. The authors show that if the inference tool has a "conditioning gap," the generator itself will learn the wrong parameters to compensate for the bad guesses.
  • When is it "Safe"? The gap vanishes in two cases:
  • Deterministic Dynamics: If the next state is perfectly predictable from the last.
  • Perfect Information: If the current observation tells you everything you need to know about the state. Crucially, many common RL benchmarks (like MuJoCo) fall into these "safe" categories, which is why this problem has been overlooked for so long.

Key Results

Across all tested datasets, full conditioning significantly outperformed partial conditioning:

  • Row-wise MNIST: The fully-conditioned model achieved a significantly higher log-likelihood ($\geq -88.45$) compared to the partial model ($\geq -98.99$). Qualitatively, the partial model could only generate a few digit types, while the full model captured the entire diversity of the dataset.
Generated digits from a partially-conditioned model, demonstrating a lack of diversity and poor sample quality.
  • UAV Trajectories: The full model outperformed the semi-conditioned model in test ELBO (2.41 vs 2.13). In "prefix-sampling" (predicting the future after seeing a bit of the past), the full model's predictions were much more concentrated around the ground truth.
  • Traffic Flow: The partial model "concentrated too much," failing to represent the multi-modal nature of traffic (where it might stay clear or suddenly jam). The full model correctly captured these multiple possibilities.

Limitations and Future Work

While the study focuses on the standard KL divergence used in the ELBO, the authors note that other divergences (like Rényi divergence) might behave differently.

Furthermore, full conditioning requires seeing the future, which isn't possible in real-time deployment. The authors suggest that while we should use full conditioning for training the generative model, we still need to figure out the best way to handle real-time filtering without losing the gains made during training. Future work could investigate if specific neural architectures can naturally bridge this gap without needing the full bidirectional pass.

Summary updated

BibTeX
@inproceedings{bayer2021mind,
  author = {Justin Bayer and Maximilian Soelch and Atanas Mirchev and Baris Kayalibay and Patrick van der Smagt},
  title = {{Mind the Gap when Conditioning Amortised Inference in Sequential Latent-Variable Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=a2gqxKDvYys},
}
Figure