Posterior Matching for Arbitrary Conditioning

Ryan Strauss, Junier Oliva

Introduction

Posterior Matching is a simple, plug-and-play framework that allows any Variational Autoencoder (VAE) to perform "arbitrary conditioning"—predicting missing features from any subset of observed ones. By training a secondary network to match the VAE’s latent distribution using only partial information, the authors achieve state-of-the-art results in imputation and a massive 219x speedup in active feature acquisition, all without ever modifying the original VAE.

The Challenge of Arbitrary Conditioning

Most generative models, including standard VAEs, are designed to learn the joint distribution $p(x)$—the likelihood of seeing all features of a data point simultaneously. However, real-world applications often involve arbitrary conditioning: given a random subset of observed features $x_o$ (e.g., a patient's age and weight), we want to predict the distribution of the remaining unobserved features $x_u$ (e.g., blood pressure or heart rate).

While you can theoretically obtain these conditionals by marginalizing the joint distribution, doing so is computationally expensive and often analytically impossible. Previous attempts to solve this required specialized, complex architectures or restrictive assumptions that limited the model's expressiveness. The core challenge addressed by this paper is how to make standard, powerful VAEs handle missing data at inference time without redesigning them from scratch.

Methods: The Posterior Matching Framework

The authors introduce Posterior Matching (PM). The central idea is intuitive: if a VAE has already learned a robust latent space where $z$ represents the data $x$, then a partially observed $x_o$ should ideally map to the same region in that latent space as the full $x$.

The Posterior Matching architecture. A partially observed encoder is trained to match the latent distribution of a pre-trained VAE using a posterior matching loss.
  1. The Framework: The authors introduce a "partially observed encoder" $q_\theta(z | x_o)$.
  2. The Objective: Instead of designing a complex new loss function, they train this new encoder to minimize the KL-divergence between its output and the original VAE’s posterior $q_\psi(z | x)$.
  3. The Mathematical Link: Crucially, the paper proves (Theorem 3.1) that minimizing this divergence in the latent space is mathematically equivalent to maximizing the conditional likelihood $p(x_u | x_o)$ in the data space.
  4. Implementation: To handle the varying sizes of $x_o$, they use a simple bitmask approach, concatenating the data with a binary vector indicating which features are present. Because the training doesn't require the "reparameterization trick" for the partial encoder, highly expressive, non-Gaussian distributions can be used for $q_\theta$.

Key Insights

  • Decoupling Training: You don't need to change the underlying VAE. You can take a pre-trained, "off-the-shelf" VAE and simply train a partial encoder to match its latent codes. This makes the method incredibly flexible.
  • Latent Space as a Bridge: The latent space acts as a universal interface. By matching distributions in this lower-dimensional space, the model avoids the "curse of dimensionality" associated with high-dimensional conditional data distributions.
  • Lookahead Posteriors: For Active Feature Acquisition (deciding which feature to measure next to learn the most), the authors show they can train a network to predict "what the posterior would look like" if a specific feature were observed. This bypasses the need for expensive sampling during the decision process.

Key Results

The authors evaluated Posterior Matching across several domains, including images (MNIST, OMNIGLOT, CelebA), tabular data (UCI datasets), and clustering tasks (Fashion MNIST).

  • Superior Imputation: On tabular UCI datasets, Posterior Matching consistently outperformed VAEAC (a specialized VAE for conditioning) in both log-likelihood and reconstruction error (NRMSE).
  • State-of-the-Art Inpainting: When paired with powerful VAE variants like VDVAE (Very Deep VAE), the method achieved higher precision and recall for image inpainting than previous flow-based models like ACFlow.
  • Massive Speedup in Active Acquisition: In active feature acquisition tasks, their "lookahead" approach achieved a staggering 219x speedup over the previous gold standard (EDDI) while maintaining or improving accuracy.
Active feature acquisition on MNIST. The model sequentially selects the most informative pixels to observe, rapidly improving its reconstruction.
  • Generative Clustering: Using Posterior Matching with a clustering VAE (VaDE) allowed for accurate unsupervised clustering even when only 10-20% of the features were observed, nearly matching supervised baselines.

Limitations and Future Work

While powerful, the current framework assumes that the training data is fully observed, even if the test data is not. Extending this to "missing-at-training-time" scenarios is a logical next step. Furthermore, the performance of PM is strictly capped by the quality of the underlying VAE; if the base VAE has a poor latent representation, Posterior Matching cannot fix it. Finally, while the framework is general, the choice of the partial encoder's architecture (e.g., using Transformers vs. MLPs for the bitmask) likely impacts performance on complex tabular data, presenting a rich area for further exploration.

Summary updated

BibTeX
@inproceedings{strauss2022posterior,
  author = {Ryan Strauss and Junier Oliva},
  title = {{Posterior Matching for Arbitrary Conditioning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=EFnI8Qc--jE},
}
Figure