Structured Uncertainty in the Observation Space of Variational Autoencoders

James Langley, Miguel Monteiro, Charles Jones, Nick Pawlowski, Ben Glocker · DOI

Abstract

Standard Variational Autoencoders (VAEs) often produce grainy, incoherent samples because they assume pixels are independent of one another. This paper introduces the Structured Observation Space VAE (SOS-VAE), which models spatial correlations directly in the observation space using a low-rank covariance matrix. This approach allows the model to generate realistic, spatially-coherent samples and enables "one-pass" interactive image editing through Gaussian conditioning.

Introduction

In the landscape of generative modeling, Variational Autoencoders (VAEs) are fundamental tools. They consist of an encoder that maps data to a latent space and a decoder that maps it back to the original data space. However, a persistent issue in VAE research is the discrepancy between theory and practice regarding sampling. While the underlying probabilistic framework suggests we should sample from the model's output distribution, the resulting samples are typically covered in "salt and pepper" noise.

This phenomenon occurs because most VAEs assume pixel-wise independence, treating every pixel as a separate random variable. This ignores the inherent spatial correlations found in real-world images. To circumvent this, researchers often display the mean of the distribution—which is blurry but clean—rather than actual samples. SOS-VAE addresses this by modeling the complex dependencies between pixels in the observation space, aligning VAE practice with its theoretical foundations.

Methodology: Structured Observation Space

The authors propose the Structured Observation Space VAE (SOS-VAE). Instead of the standard diagonal covariance matrix, which implies independence, they utilize a Multivariate Normal distribution with a structured, fully populated covariance matrix $\Sigma$.

Low-Rank Parameterization

To maintain computational feasibility—given that a full covariance matrix for a $64 \times 64$ image would contain over 16 million entries—the authors employ a low-rank parameterization:

$$\Sigma = PP^T + D$$

In this formulation:

  • $P$ is a low-rank factor matrix that captures global correlations (e.g., lighting, skin tone, or hair color).
  • $D$ is a diagonal matrix capturing independent pixel-level noise.

By leveraging the Woodbury matrix identity and the matrix determinant lemma, the authors compute the likelihood and gradients in linear time relative to the number of pixels. This efficiency allows the model to be trained on modern deep learning hardware. Additionally, an entropy penalty is introduced to stabilize training and prevent the model from artificially increasing variance to minimize loss.

Interactive Editing via Conditioning

A significant advantage of using a multivariate normal output is the ability to perform interactive editing via standard Gaussian conditioning. Because the output space is structured, changing the color of a small patch of pixels (e.g., turning a section of hair red) allows the model to calculate the "conditional mean" of the remaining pixels in a single step. The model automatically updates the rest of the image to maintain coherence with the edit, without requiring a search through the latent space or multiple passes through the decoder.

Experimental Results

The model was evaluated on two primary datasets:

  1. CelebA: 200,000 celebrity face images ($64 \times 64$).
  2. UK Biobank (UKBB): Human brain MRI scans, highlighting the model's utility in medical imaging where structural uncertainty is critical.

Quantitative and Qualitative Performance

SOS-VAE produces samples that are visually indistinguishable from the mean in terms of coherence, effectively solving the "grainy sample" problem. Quantitatively, on the CelebA dataset, SOS-VAE achieved a Fréchet Inception Distance (FID) of 104.62, significantly outperforming the standard $\beta$-VAE's sampling score of 196.40. The model also demonstrated superior efficiency compared to previous attempts at structured uncertainty, requiring only a single T4 GPU for training.

Discussion and Future Work

SOS-VAE suggests a compelling trade-off: if the observation space is sophisticated enough to model spatial correlations, the latent space is relieved of some representational burden. This raises new questions regarding which features should be captured in the latent space versus the observation space.

Despite its successes, the low-rank approach introduces additional parameters and memory overhead compared to diagonal models. Future research will focus on integrating structured observation spaces into more complex architectures like NVAE and investigating how this approach scales to higher-resolution images where low-rank assumptions may need further refinement to capture fine-grained textures.

Summary updated

BibTeX
@article{langley2022structured,
  author = {James Langley and Miguel Monteiro and Charles Jones and Nick Pawlowski and Ben Glocker},
  title = {{Structured Uncertainty in the Observation Space of Variational Autoencoders}},
  journal = {Accepted by TMLR},
  year = {2022},
  url = {https://openreview.net/forum?id=cxp7n9q5c4},
}
Figure