Abstract
This paper introduces a novel method for performing "arbitrary" conditional inference in pre-trained Variational Autoencoders (VAEs) without the need for expensive retraining or slow MCMC sampling. By freezing a pre-trained decoder and quickly training a small "conditional prior network" using a novel Conditional ELBO (C-ELBO) objective, the authors enable high-quality, diverse image completion and data query results in just a few seconds.
The Challenge of Conditional Inference
Variational Autoencoders are excellent at generating data, but they struggle with conditional inference—predicting missing parts of an input (the "query") based on observed parts (the "evidence").
The challenge arises when the "split" between evidence and query is not fixed. If the missing parts are arbitrary (e.g., different occlusions in every image), standard approaches typically involve two suboptimal options:
- Retraining the entire model for every new query, which is computationally prohibitive.
- Using MCMC sampling (like Hamiltonian Monte Carlo), which is slow to converge and often fails to capture the diversity of possible solutions, frequently getting stuck in a single mode.
Methodology: Conditional Prior Networks
The authors propose a "fast and simple" middle ground: Conditional Prior Networks. Instead of retraining the massive VAE decoder, they freeze it. They then introduce a small, auxiliary network that learns to "warp" a standard Gaussian distribution into a specific latent distribution that matches the observed evidence.
Technical Components
- C-ELBO (Conditional Evidence Lower Bound): A novel training objective derived specifically to optimize these small prior networks while keeping the decoder weights fixed.
- The Workflow: When a new query arrives, the system optimizes the parameters of the tiny prior network for a few seconds. Once trained, it can instantly draw diverse samples that are consistent with the evidence.
Network Variants
The researchers explored three variants for the prior network:
- GVI (Gaussian Variational Inference): A simple linear transformation.
- NF (Normalizing Flows): A sequence of invertible mappings (specifically Planar Flows) that can represent complex, multimodal distributions.
- FCN (Fully Connected Networks): A standard deep network used as a baseline.
Experimental Evaluation
The approach was evaluated on three well-known benchmarks:
- MNIST: Handwritten digits (28x28 pixels), using a 2D latent space for easy visualization of the "warped" latent distributions.
- Anime: A dataset of 20,000 animated character faces (64x64 RGB) with a 64-dimensional latent space.
- CelebA: A benchmark of 200,000 celebrity faces (64x64 RGB) using a 100-dimensional latent space to test high-dimensional inference.
Key Insights and Results
- The Decoder is Enough: A well-trained VAE decoder already contains the knowledge of how to generate data. One does not need to change the decoder to handle new conditions; rather, one must find the right neighborhood in the latent space ($z$) that corresponds to the evidence ($x$).
- Handling Multimodality: Even if the global prior is Gaussian, the conditional latent distribution $p(z|x)$ is often multimodal. Normalizing Flows proved highly effective at "shaping" the latent space into these complex forms.
- Speed and Diversity: Conditional training completes in seconds (typically under 32s). The proposed method produced significantly more diverse results than HMC, which often collapsed into a single "average" looking face in high dimensions.
- Performance: In quantitative tests using SSIM and Query Marginal Likelihood, the Normalizing Flow (NF) variant consistently outperformed HMC and other baselines.
Limitations and Future Work
While significantly faster than full retraining, the optimization phase is not yet instantaneous. The authors also noted that the GVI variant was prone to numerical instability, and the FCN variant was computationally infeasible for high-dimensional latent spaces due to expensive Jacobian matrix calculations. Future work may focus on further accelerating the optimization phase or amortizing the cost across similar query types.
Summary updated