Abstract
Variational Autoencoders (VAEs) learn powerful latent representations, but the standard Euclidean distance in these spaces often fails to capture semantic similarity due to distortions induced by the prior distribution. This paper introduces a framework-friendly algorithm to compute Riemannian geodesics—shortest paths along the learned data manifold—within the latent space. By modeling generator uncertainty with a Gaussian Mixture Model (GMM) and parameterizing geodesics as quadratic curves, the authors enable standard clustering algorithms like $k$-medoids to achieve state-of-the-art performance on various datasets without requiring complex, task-specific architectures.
Introduction: The Geometry of Latent Spaces
In a standard VAE, latent variables are typically constrained to a standard Gaussian prior. While effective for generative tasks, this constraint often squashes distinct semantic clusters together, rendering Euclidean distance an unreliable metric for downstream tasks like clustering.
Recent research suggests treating the generative model as a Riemannian manifold, where distances are measured along the manifold surface (geodesics). However, traditional geodesic computation requires solving complex non-linear Ordinary Differential Equations (ODEs) involving Jacobians—operations that are computationally expensive in modern auto-grad frameworks like PyTorch or TensorFlow. This work proposes a method to compute these geodesics that is natively compatible with standard deep learning optimization.
Methodology
The proposed approach follows a three-stage pipeline:
- VAE Training: A standard VAE is trained with a fixed constant output variance.
- Uncertainty Modeling via GMM: Standard VAEs often fail to capture uncertainty in empty latent regions. To address this, the authors fit a Gaussian Mixture Model (GMM) to the latent representations to model the inverse variance (precision). This ensures that the manifold "tears" or creates high-energy barriers in regions devoid of data.
- Quadratic Geodesic Optimization: Instead of solving ODEs, the authors define an energy function that penalizes both physical distance and traversal through high-uncertainty regions. By restricting the geodesic curve to a quadratic parameterization ($c(t) = at^2 + bt + c$), the problem is reduced to a simple gradient descent optimization of $d$ parameters (where $d$ is the latent dimension).
Experimental Results
The authors evaluated the method on synthetic (Two-Moon, Anisotropic) and image datasets (MNIST, Fashion-MNIST, EMNIST).
- Synthetic Data: The geodesic $k$-medoids approach achieved 100% accuracy on both Two-Moon and Anisotropic datasets, significantly outperforming Euclidean latent distances (80-86%).
- Image Datasets: On MNIST (digits '0' and '1'), the method achieved 100% accuracy. On Fashion-MNIST (3-class), it maintained 100% accuracy, while Spectral Clustering on the raw data achieved only 28%.
The "Path of Least Resistance" intuition is confirmed: geodesics naturally avoid low-density regions, staying within the known data distribution. Visualizations of the Riemannian volume measure reveal "valleys" of low volume at clusters and "ridges" of high volume in empty spaces.
Discussion and Limitations
The primary innovation is the simplification of differential geometry into a standard loss-minimization problem. By bypassing ODEs and Jacobians, the method becomes highly accessible for practical applications.
However, limitations remain. Quadratic curves may be too rigid for highly complex manifolds, potentially requiring higher-order polynomials. Additionally, as latent dimensionality increases, the optimization of these curves may face challenges with local minima. Future work could explore end-to-end training of the VAE and the geodesic metric.
Summary updated