Abstract
Being one of the most popular generative framework, variational autoencoders (VAE) are known to suffer from a phenomenon termed posterior collapse, where the latent variational distributions collapse to the prior, especially when a strong decoder network is used. In this work, we analyze the latent representation of collapsed VAEs and propose a novel model, Neighbor Embedding VAE (NE-VAE). NE-VAE explicitly constrains the encoder to map inputs that are close in the input space to nearby locations in the latent space. We observed that VAE variants reporting similar ELBO, KL divergence, or mutual information scores can still exhibit vastly different latent organizations. NE-VAE produces qualitatively different latent representations with a majority of latent dimensions remaining active, benefiting downstream tasks like latent space optimization. NE-VAE prevents posterior collapse more effectively than predecessors and integrates easily into existing frameworks without complex training routines.
Introduction
Variational Autoencoders (VAEs) are cornerstone models in generative AI, yet they frequently encounter posterior collapse. This occurs when a powerful decoder learns to model the data distribution independently of the latent code $z$, causing the approximate posterior $q(z|x)$ to match the prior $p(z)$. Consequently, the latent variables become uninformative.
This collapse is particularly detrimental for Latent Space Optimization (LSO), where the goal is to navigate the latent manifold to discover high-performing samples (e.g., optimized molecules). A collapsed or disorganized latent space makes such searches inefficient or impossible.
Methodology: Neighbor Embedding VAE
The Neighbor Embedding VAE (NE-VAE) is inspired by manifold learning techniques like Stochastic Neighbor Embedding (SNE). The fundamental principle is that local topology should be preserved: points near each other in the input space should remain neighbors in the latent space.
To implement this efficiently without expensive neighbor searches, NE-VAE utilizes an "artificial neighbor" approach:
- Encode an input $x$ to obtain latent code $z$.
- Decode $z$ to produce a reconstruction $\hat{x}$.
- Re-encode $\hat{x}$ to obtain a new latent code $\hat{z}$.
- Constraint: Apply a Neighbor Embedding loss that minimizes the distance between $z$ and $\hat{z}$.
By enforcing $z \approx \text{encoder}(\text{decoder}(z))$, the model prevents the decoder from ignoring $z$. If the decoder were to ignore the latent code, the encoder would be unable to reconstruct the original $z$ from the generated output.
Experimental Setup
The model was evaluated on two image datasets:
- Omniglot: A dataset of 1623 character classes with few examples per class, making it highly susceptible to posterior collapse.
- MNIST: The standard handwritten digit dataset.
Key Results
Preventing Posterior Collapse
A primary metric for posterior collapse is the number of Active Units (AU). In experiments on Omniglot with a 32-dimensional latent space, a vanilla VAE typically utilizes only about 6 dimensions, with the rest collapsing to the prior. In contrast, NE-VAE maintains up to 26 active dimensions.
Latent Space Organization
The authors found that standard metrics like ELBO or KL-divergence can be deceptive; models with similar scores often have very different latent structures. NE-VAE "squashes" activity across more dimensions, creating a smoother and more continuous manifold. This organization leads to higher efficiency in LSO tasks, where NE-VAE converged faster and showed less sensitivity to initialization compared to "Aggressive Training" baselines.
Conclusion
NE-VAE offers a robust solution to posterior collapse by explicitly enforcing topological preservation through a re-encoding constraint. It significantly increases the number of active latent dimensions and improves the utility of the latent space for downstream optimization. Future work will explore how this approach scales to non-image data and investigate the optimal organization of latent spaces for diverse tasks.
Summary updated