A decoder suffices for query-adaptive variational inference

Sakshi Agarwal, Gabriel Hope, Ali Younis, Erik B. SudderthUAI 2023

Abstract

Deep generative models like variational autoencoders (VAEs) are widely used for density estimation and dimensionality reduction, but infer latent representations via amortized inference algorithms, which require that all data dimensions are observed. VAEs thus lack a key strength of probabilistic graphical models: the ability to infer posteriors for test queries with arbitrary structure. We demonstrate that many prior methods for imputation with VAEs are costly and ineffective, and achieve superior performance via query-adaptive variational inference (QAVI) algorithms based directly on the generative decoder. By analytically marginalizing arbitrary sets of missing features, and optimizing expressive posteriors including mixtures and density flows, our non-amortized QAVI algorithms achieve excellent performance while avoiding expensive model retraining. On standard image and tabular datasets, our approach substantially outperforms prior methods in the plausibility and diversity of imputations. We also show that QAVI effectively generalizes to recent hierarchical VAE models for high-dimensional images.

Introduction

Standard Variational Autoencoders (VAEs) rely on an "encoder" network to map data to a latent representation. While efficient, this amortized inference breaks down when data is missing or corrupted. Real-world data is often incomplete—consider an image with a hole (inpainting) or a medical record with missing entries. Standard encoders expect a full vector of inputs and typically fail to generalize to arbitrary patterns of missingness without expensive retraining or inaccurate heuristics like zero-filling.

This paper introduces Query-Adaptive Variational Inference (QAVI), a method that restores the flexibility of classical probabilistic graphical models to deep generative frameworks. By bypassing the encoder entirely during inference and performing optimization directly on a pre-trained generative decoder, QAVI can handle arbitrary queries and capture complex, multi-modal uncertainties.

Methods: The Decoder is Enough

The core insight of QAVI is that the generative decoder $p_\theta(x|z)$ contains the complete probabilistic model. Instead of using a global encoder to guess the latent state $z$, QAVI treats inference as a per-query optimization problem.

Comparison between standard amortized inference (a), which requires an encoder, and Query-Adaptive Variational Inference (b), which optimizes a variational distribution directly using the pre-trained decoder and observed data.

Non-Amortized Optimization

For a specific query with observed features $x_O$ and missing features $x_M$, QAVI defines a variational distribution $q_\lambda(z)$ and optimizes the parameters $\lambda$ to maximize the Evidence Lower Bound (ELBO) based only on the observed data. The missing features are analytically marginalized out of the objective function, making the optimization stable and efficient.

Expressive Posteriors

Because missing data often leads to multiple plausible hypotheses (e.g., a missing patch in an image could be different facial features), a simple Gaussian distribution is often insufficient. QAVI utilizes Normalizing Flows and Gaussian Mixture Models to capture these multi-modal distributions in the latent space, allowing the model to suggest several distinct, sharp, and plausible completions.

Key Results and Insights

The authors evaluated QAVI across diverse datasets, including tabular data (UCI) and high-resolution images (FFHQ-256).

Visualization of posterior distributions for tabular data. QAVI variants (Mix and Flow) successfully capture complex, non-Gaussian dependencies and multi-modality compared to standard priors or simpler Gaussian approximations.
  • Superior Likelihood and Quality: On tabular data, QAVI consistently achieved higher log-likelihoods for missing features than amortized baselines. For high-resolution faces, QAVI achieved an FID score of 21.21, significantly outperforming Posterior Matching (23.68) and VAEAC (26.41).
  • Closing the Amortization Gap: Amortization provides speed but introduces a loss in accuracy because the encoder is a global approximation. By switching to non-amortized optimization at test time, QAVI closes this gap and remains robust to shifts in missingness patterns that baffle fixed encoders.
  • Hierarchical Adaptation: For complex images, QAVI adapts to Hierarchical VAEs (HVAEs) using a "KL-balanced warmup" strategy. This prioritizes learning high-level structures (like face shape) before refining fine-grained textures, significantly speeding up convergence.

Limitations and Future Work

While QAVI offers superior accuracy and flexibility, it requires an optimization loop for every new query, making it slower than a single encoder forward pass. It is currently less suited for real-time applications requiring millisecond latency. Future research directions include extending QAVI to "Missing Not At Random" (MNAR) scenarios and further improving inference efficiency.

Summary updated

BibTeX
@inproceedings{agarwal2023decoder,
  author = {Sakshi Agarwal and Gabriel Hope and Ali Younis and Erik B. Sudderth},
  title = {{A decoder suffices for query-adaptive variational inference}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=KMlALaA1bx},
}
Figure