Diffusion Variational Autoencoders

Luis A. Pérez Rey, Vlado Menkovski, Jacobus W. Portegies · DOI

Abstract

Standard Variational Autoencoders (VAEs) typically utilize Euclidean latent spaces, which are structurally incapable of capturing the topological properties of non-Euclidean datasets. To address this "manifold mismatch," we introduce Diffusion Variational Autoencoders (ΔVAEs). By employing transition kernels of Brownian motion on arbitrary Riemannian manifolds, ΔVAEs allow for latent spaces with specific shapes, such as spheres or tori. We demonstrate that ΔVAEs can capture topological properties in synthetic data and provide meaningful geometric embeddings for natural datasets like MNIST.

Introduction: The Manifold Mismatch

In a standard VAE, high-dimensional data is compressed into a low-dimensional latent space, usually represented as $\mathbb{R}^n$. However, many real-world datasets possess inherent non-Euclidean structures. For instance, a video of a rotating object is fundamentally defined by an angle, which exists on a circle ($S^1$).

Mapping a continuous, closed structure like a circle onto a flat line ($\mathbb{R}^1$) inevitably creates a topological obstruction. To fit the circle onto the line, the model must "break" the continuity at some point. Consequently, two data points that are semantically very close (e.g., 0.1° and 359.9°) might be mapped to opposite ends of the latent space. This structural incapacity prevents the model from learning a truly representative manifold of the data.

Methodology: Diffusion on Manifolds

The core innovation of the Diffusion VAE (ΔVAE) is the replacement of the standard Gaussian distribution with transition kernels of Brownian motion on a Riemannian manifold.

Brownian Motion as a Prior

Just as the Gaussian distribution is the fundamental solution to the heat equation in Euclidean space, Brownian motion kernels (heat kernels) provide a natural way to define probability distributions on curved surfaces. This allows the latent space to take the shape of any arbitrary manifold, such as a sphere, torus, or projective space.

The Projection Reparametrization Trick

Training a VAE requires the "reparametrization trick" to allow gradients to flow through the sampling process. On arbitrary manifolds, this is non-trivial. The authors implement this by simulating Brownian motion as a sequence of small random steps in the ambient Euclidean space, followed by a projection back onto the manifold surface.

The projection reparametrization trick: simulating Brownian motion on a manifold by projecting random steps from the tangent space.

Efficient KL-Divergence

Calculating the Kullback-Leibler (KL) divergence on manifolds is computationally demanding. To maintain efficiency, ΔVAE utilizes a "short-term asymptotic expansion" of the heat kernel. This mathematical approximation allows for fast computation of the KL divergence during the training process, making the approach scalable.

Experiments and Results

The ΔVAE was evaluated on several datasets to test its ability to capture global topology.

Synthetic Periodic Data

On a synthetic dataset of translated images where the true latent space is a flat torus, the ΔVAE with a torus latent space achieved a Mean Squared Error (MSE) of $0.90 \times 10^{-2}$. In contrast, a spherical latent space—which lacks the necessary "holes" to match the data's topology—performed significantly worse with an MSE of $2.82 \times 10^{-2}$.

MNIST on Manifolds

While natural datasets like MNIST do not have a single "correct" topology, training them on curved manifolds reveals interesting geometric properties. When mapped to a sphere or a torus, the model organizes digits such that similar styles cluster together, while the global "wrap-around" nature of the manifold allows for more complex adjacencies than a flat plane.

MNIST digits embedded on a sphere (left) and a torus (right), showing how the model organizes data according to the latent manifold's shape.

Discussion and Key Insights

  • Topology Matters: Matching the latent space's topology to the data's inherent structure leads to significantly better reconstruction and representation.
  • Overcoming Singularities: By using a projection-based random walk, ΔVAE avoids the "Hairy Ball" problem—the inability to define a single continuous coordinate system on a sphere without singularities.
  • Frequency Sensitivity: An interesting finding is that the model's ability to capture global topology is sensitive to the visual smoothness of the input. High-frequency noise or sharp edges can "confuse" the topological mapping, whereas low-frequency, blurry images are more easily organized.

Limitations and Future Work

Despite its advantages, ΔVAE introduces computational overhead due to the iterative projection steps required for sampling. Furthermore, the choice of the manifold currently remains a manual hyperparameter. Future research aims to automate manifold selection, allowing the model to learn the optimal topology directly from the data.

Summary updated

BibTeX
@inproceedings{rey2020diffusion,
  author = {Luis A. Pérez Rey and Vlado Menkovski and Jacobus W. Portegies},
  title = {{Diffusion Variational Autoencoders}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.24963/ijcai.2020/375},
}
Figure