Abstract
Neural samplers such as variational autoencoders (VAEs) or generative adversarial networks (GANs) approximate distributions by transforming samples from a simple random source—the latent space—to the data space. Standard Euclidean distance in this latent space is often a poor proxy for actual data similarity because it ignores the "stretching" and "warping" caused by the generator. This paper proposes using Riemannian geometry to calculate distances as the shortest path (geodesic) along the learned data manifold, resulting in smoother interpolations and more meaningful similarity metrics.
Introduction
Deep generative models map a simple latent space (e.g., a Gaussian) to a complex, high-dimensional data distribution. However, the "manifold hypothesis" suggests that real-world data resides on low-dimensional surfaces surrounded by vast regions of empty space. When training a VAE, the model is forced to pack these disconnected data "islands" into a compact latent space.
As a result, two points that are very different in the real world might end up adjacent in the latent space, separated only by a thin border of high distortion. Consequently, a straight line (Euclidean distance) in latent space may traverse "empty" regions of low data density, leading to nonsensical or blurry interpolations.
Methodology: Latent Space as a Riemannian Manifold
To address this, the authors treat the latent space as a Riemannian manifold. The core of this approach is the metric tensor ($G$), defined using the Jacobian ($J$) of the generator function: $G = J^T J$. This tensor quantifies how much the generator stretches the space at any point. A small step in latent space that causes a large change in the generated output results in a large "distance" in the Riemannian sense.
The shortest path between two points on this manifold is a geodesic. Unlike the straight Euclidean line, the geodesic curves to stay in regions where the generator's "magnification factor" is low—effectively following the high-density regions of the data manifold. The authors approximate these geodesics by parameterizing paths with a small neural network and optimizing them to minimize Riemannian length.
Key Insights and Results
A critical metric introduced is "velocity" (or magnification factor $\phi(t)$). High velocity indicates a path crossing low-density regions. Geodesic paths minimize this velocity, ensuring the interpolation stays where the data is "thickest."
Experimental Findings
- Smoother Transitions: In pendulum and human motion datasets, Euclidean interpolation often produced "jerky" or physically impossible frames. Geodesic interpolation resulted in smooth, natural movements.
- Quantitative Distance: On a pendulum task, the manifold distance of the Euclidean path was 0.827, while the optimized geodesic reduced it to 0.538, demonstrating that the "straight" line is actually a longer path through the data distribution.
- Class Separation: In MNIST, Riemannian equidistance lines respect class boundaries much better than Euclidean distances, which often fail to separate digits due to thin boundaries in latent space.
- Robot Path Planning: For a KUKA robot arm, the geodesic path accurately reconstructed circular motion, whereas the Euclidean path "cut the corner," failing to follow the learned skill.
Conclusion
By incorporating Riemannian geometry, generative models can provide more meaningful distance metrics and higher-quality interpolations. While computationally more expensive than linear methods, this approach ensures that transitions between data points respect the underlying structure of the learned manifold, which is vital for applications in robotics and motion synthesis. Future work aims to scale these methods to GANs and incorporate temporal dynamics directly into the metric.
Summary updated