Abstract
Given data, deep generative models, such as variational autoencoders (VAE) and generative adversarial networks (GAN), train a lower dimensional latent representation of the data space. The linear Euclidean geometry of data space pulls back to a nonlinear Riemannian geometry on the latent space. The latent space thus provides a low-dimensional nonlinear representation of data and classical linear statistical techniques are no longer applicable. In this paper we show how statistics of data in their latent space representation can be performed using techniques from the field of nonlinear manifold statistics. Nonlinear manifold statistics provide generalizations of Euclidean statistical notions including means, principal component analysis, and maximum likelihood fits of parametric probability distributions. We develop new techniques for maximum likelihood inference in latent space, and adress the computational complexity of using geometric algorithms with high-dimensional data by training a separate neural network to approximate the Riemannian metric and cometric tensor capturing the shape of the learned data manifold.
Introduction: The Geometry of Latent Spaces
When training Variational Autoencoders (VAEs) or Generative Adversarial Networks (GANs), high-dimensional data is compressed into a low-dimensional latent space. A common but flawed assumption is that this latent space is Euclidean—a flat plane where linear operations like averaging or standard Principal Component Analysis (PCA) are valid.
However, the decoder mapping from latent space back to data space is highly non-linear. This non-linearity "warps" the latent space, endowing it with a Riemannian geometry. In this curved environment, the shortest path between two points is a geodesic, not a straight line. Standard linear tools fail to account for this curvature, often resulting in statistical "means" that do not accurately represent the data or principal components that drift away from the actual data manifold.
Methodology: Nonlinear Manifold Statistics
The authors propose a framework to perform "correct" non-linear statistics directly within the latent space by leveraging Riemannian geometry:
- Riemannian Pullback: The latent space geometry is defined using the pullback metric from the data space. The distance between two points in latent space is determined by the distance between their decoded counterparts in the original data space.
- Non-linear Statistical Tools:
- Fréchet Mean: A generalization of the arithmetic mean that minimizes the sum of squared geodesic distances.
- Principal Geodesic Analysis (PGA): The manifold equivalent of PCA, identifying the "straightest" curved paths that capture the most variance.
- Diffusion Bridges: Brownian motion (random walks) on the manifold is used for Maximum Likelihood (ML) estimation of the mean.
- Metric Approximation Network: Calculating the metric tensor $g(z)$ via Jacobians is computationally expensive. To solve this, the authors train a separate, lightweight neural network to approximate $g(z)$ and its inverse. This innovation reduces computation time from seconds to milliseconds.
Experiments and Key Results
The framework was evaluated on a synthetic sphere ($S^2$) and the MNIST dataset.
- Computational Efficiency: The metric approximation network achieved a 1,000x speedup, reducing geodesic integration time from 30 seconds to 30 milliseconds per step.
- Enhanced Dimensionality Reduction: Applying PGA to MNIST latent spaces allowed for the visualization of primary modes of variation (e.g., digit tilt or loop size) along curved paths that remained "on-model" more effectively than linear interpolation.
- Probabilistic Averaging: The ML mean, derived from diffusion bridges, often produced "cleaner" and more representative digits in MNIST experiments compared to the distance-based Fréchet mean.
Discussion and Future Outlook
The core insight of this work is that latent spaces are geometric manifolds, not just flat vectors. Treating them as such allows for more principled statistical analysis. While the quality of these statistics depends on the underlying generative model, the introduction of the metric approximation network makes these complex geometric calculations feasible for real-time applications. Future work may focus on ensuring the predicted metric remains strictly positive definite and scaling these tools to even higher-dimensional latent representations.
Summary updated