Abstract
A common assumption in generative models is that the generator immerses the latent space into a Euclidean ambient space. Instead, we consider the ambient space to be a Riemannian manifold, which allows for encoding domain knowledge through the associated Riemannian metric. Shortest paths can then be defined accordingly in the latent space to both follow the learned manifold and respect the ambient geometry. Through careful design of the ambient metric we can ensure that shortest paths are well-behaved even for deterministic generators that otherwise would exhibit a misleading bias. Experimentally we show that our approach improves the interpretability and the functionality of learned representations both using stochastic and deterministic generators.
Introduction
In standard generative models like Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs), it is common practice to interpolate between points in the latent space $Z$ using straight Euclidean lines. However, this approach faces a significant challenge: the latent space is not unique, leading to the identifiability problem. A straight line in $Z$ may correspond to a non-natural path in the observation space $\mathcal{X}$, often taking "shortcuts" through low-density regions where no data exists. This results in interpolations that fail to respect semantic boundaries or the underlying data manifold.
Methodology
To address these issues, we propose treating the ambient observation space $\mathcal{X}$ as a Riemannian manifold. By equipping $\mathcal{X}$ with a Riemannian metric, we can define how distance is measured locally, making certain regions (e.g., low-density areas) more "expensive" to traverse while others (e.g., high-density data regions) are "cheaper."
The Pull-Back Metric
We project the ambient metric back into the latent space using the generator's Jacobian, creating an "intrinsic" metric $M(z)$. This metric guides movement in the latent space while respecting the geometry of the observation space. We propose a diagonal metric $M_{\mathcal{X}}(x) = (\alpha \cdot h(x) + \epsilon)^{-1} \cdot I_D$, where $h(x)$ can be derived from data density (e.g., via RBF networks or GMMs) or specific semantic classifiers. In stochastic models, the variance of the generator naturally acts as a metric, where high uncertainty pushes shortest paths toward regions of higher confidence.
Deterministic Generator Architecture
For deterministic models like GANs, we introduce a ResNet-style architecture incorporating a linear pPCA-based term. This ensures that the model extrapolates meaningfully outside the training distribution, which is essential for calculating stable shortest paths (geodesics) via Ordinary Differential Equations (ODEs).
Experimental Results
We validated our approach across synthetic data, MNIST, and CelebA datasets.
Semantic Control and Steering
On the CelebA dataset, we utilized a pre-trained Progressive GAN and a "blond hair" classifier to demonstrate semantic steering. While a standard Euclidean path might pass through non-blond regions when interpolating between two blond individuals, our geometrically enriched path successfully remains within the blond manifold by treating non-blond regions as high-cost.
Improved Representation and Sampling
By using the induced metric to define a new density $q(z)$, we generated samples with significantly higher precision than those drawn from a standard Gaussian prior. On MNIST, we demonstrated that paths could be steered toward or away from specific classes by combining different metric components, such as LDA-based metrics for class separation and local covariance metrics for density.
Conclusion
This work demonstrates that latent spaces need not be treated as flat, Euclidean black boxes. By incorporating geometry as domain knowledge, we can achieve latent paths that are more interpretable, identifiable, and semantically meaningful. While finding geodesics introduces computational complexity due to the need to solve second-order nonlinear ODEs, the resulting improvements in control and representation quality offer a robust framework for future generative modeling research.
Summary updated