Authors: Frederik Möbius Rygaard, Shen Zhu, Yinzhu Jin, Søren Hauberg, Tom Fletcher
Organizations: DTU Compute, Technical University of Denmark, Kongens Lyngby, Denmark · Department of Computer Science, University of Virginia, Charlottesville (VA), USA · Department of Electrical and Computer Engineering, University of Virginia, Charlottesville (VA), USA
The geometry of generative models serves as the basis for interpolation, model inspection, and more. Unfortunately, most generative models lack a principal notion of geometry without restrictive assumptions on either the model or the data dimension. In this paper, we construct a general geometry compatible with different metrics and probability distributions to analyze generative models that do not require additional training. We consider curves analogous to geodesics constrained to a suitable data distribution aimed at targeting high-density regions learned by generative models. We formulate this as a (pseudo)-metric and prove that this corresponds to a Newtonian system on a Riemannian manifold. We show that shortest paths in our framework can be characterized by a system of ordinary differential equations, which locally corresponds to geodesics under a suitable Riemannian metric. Numerically, we derive a novel algorithm to efficiently compute shortest paths and generalized Fréchet means. Quantitatively, we show that curves using our metric traverse regions of higher density than baselines across a range of models and datasets.
Figures & tables
Figure 1: A conceptual illustration of our method, where we consider the geometry corresponding to a Newtonian system on a Riemannian manifold. The gradient vector field of the density “pushes” the Riemannian geodesic to areas of high likelihood.
Figure 2: Examples of the three fundamental concepts derived from the (pseudo-)metric in Eq. 7 with λ=20.0 : boundary-value curves (row 1), initial value curves (row 2), and a generalized version of the Fréchet mean (row 3). The concepts are applied to an energy-based model ( ebm ) ( LeCun et al., 2006 ) for a checkerboard, normalizing flow ( nf ) ( Papamakarios et al., 2021 ) for the two-moon distributions, autoregressive model ( ar ) ( Uria et al., 2016 ) for a sinus curve, and a vae ( Kingma and Welling, 2014 ) for circle data. Red denotes the connecting curves between the green boundary points. For the generalized Fréchet mean, blue denotes the mean, while the white points are 100 sampled data points. The black arrows denote the initial directions of the curves. The regularization function for each model is described in Section 4 .
Figure 3: Interpolation curves computed for different values of λ in Eq. 5 with an Euclidean background metric and S(z)=−logp(z) . The data density, p , is approximated by a gmm and kde shown in the background color for synthetic data (black). The mean log-likelihoods of the estimated curves are denoted L , where the first number is for gmm and the second for kde .
Method
Complexity
Gradient descent
O(Ngridd)
Quasi-Newton method
O(Ngrid2d2)
(Sparse) Newton method
O(Ngridd3)
ProbGEORCE
O(Ngridd3)
Table 1: Complexity of different optimization algorithms.
Figure 4: The Fréchet mean (blue) for the dino-dataset using a ddpm computed in data space as well as 10 curves (red) in ten different directions (green arrows) for the corresponding ivp ( 8 ).
Figure 5: The regularized energy and runtime for different methods minimizing Eq. 7 for λ=1.0 for the n -sphere and S=−logp , where p is the density of three Gaussians randomly weighted with random mean values and identity as the covariance matrix. Note that the regularized energy for ProbGEORCE with line-search (LS) and adaptive update scheme (Adaptive) are very similar.
EBM
NF
AR
VAE
Method
NLL ↓
Runtime ↓
NLL ↓
Runtime ↓
NLL ↓
Runtime ↓
NLL ↓
Runtime ↓
IVP
Ours ( λ=20.0 )
8.483
4.90 ± 0.09
1.20×103
101.08 ± 2.17
1.37×104
7.66 ± 0.08
-144.673
64.01 ± 0.49
Euclidean
30.010
0.00 ± 0.00
4.01×103
0.00 ± 0.00
1.06×105
0.00 ± 0.00
-105.053
0.00 ± 0.00
Spherical
16.536
0.00 ± 0.00
4.10×103
0.00 ± 0.00
8.25×104
0.00 ± 0.00
-85.552
0.00 ± 0.00
Fisher-Rao
29.682
12.61 ± 0.09
-
-
-
-
-
-
Table 2: Negative log-likelihood (NLL) and runtime results for the energy-based model, normalizing flow, autoregressive model and variational autoencoder used in Fig. 2 . For the vae , we report the elbo . We write − if the Riemannian metric is not invertible or if the generative model returns NaNs for the likelihood. In Appendix E , we provide details on the benchmarks and any hyper-parameters.
Figure 6: The distance between grid points for the normalizing flow model in Fig. 2 for varying values of λ .
Method
FID ↓
KID ↓
G1/pθ (conformal)
187.25
0.0800 ± 0.0028
Glogpθ (conformal)
189.47
0.0819 ± 0.0033
G1/pθ (diagonal)
198.06
0.0828 ± 0.0032
Glogpθ (diagonal)
189.32
0.0745 ± 0.0031
GLAND
186.87
0.0726 ± 0.0028
G1/pθ (full)
179.62
0.0676 ± 0.0024
Table 3: Comparison of methods using FID and KID metrics (lower is better).
Method
FID ↓
KID ↓
Ours (Noise)
182.73
0.12 ± 0.04
Ours (Data)
172.70
0.11 ± 0.04
Linear
200.62
0.08 ± 0.04
Spherical
184.21
0.12 ± 0.04
NoiseDiffusion ( Zheng et al., 2024 )
174.46
0.11 ± 0.04
Table 4: Comparison of methods using FID and KID metrics (lower is better) for the AFHQ dataset ( Choi et al., 2020 ) for the bvp connecting two images.
Figure 7: Interpolated images for different methods.
Figure 8: Left: Computed mean value using our method in data space, where the image shows the transition from the mean to the data points in the last row. Right: the estimated mean using our method in noise and data space, respectively, compared to the Fréchet mean using a linear and spherical geometry in noise space.
Figure 9: Three principal geodesics shown on the left. On the right, samples drawn within the principal subspace are shown.
\begin{split}\min_{\alpha}\quad&E\left({\bm{z}}_{0:N_{\mathrm{grid}},1:N_{\mathrm{data}}}\right)\quad\text{(exact line search)}\\ \text{s.t.}\quad&{\bm{z}}_{s+1,i}={\bm{z}}_{s,i}+\alpha\tilde{{\bm{u}}}_{s,i}+(1-\alpha){\bm{u}}_{s,i}^{(k)},\quad s=0,\dots,N_{\mathrm{grid}}-1,\,i=1,\dots,N_{\mathrm{data}}.\\ &\tilde{{\bm{u}}}_{s,i}=\alpha{\bm{u}}_{s,i}+(1-\alpha){\bm{u}}_{s,i}^{(k)},\quad s=0,\dots,N_{\mathrm{grid}}-1,\,i=1,\dots,N_{\mathrm{data}}.\\ &x_{0,i}={\bm{a}}_{i}.\end{split}
Appendix
Algorithm 2 ProbGEORCE for means
Figure 10: From left to right: The Fréchet mean (blue) for two data points (red) on the circle with uniqueness of the Fréchet mean, two points on the circle, where there are multiple Fréchet mean, the area (blue) for the data support around the north pole (green) of S2 for which the existence and uniqueness is guaranteed and similarly for the torus embedded in R3 .
Figure 11: The negative loss of mean, where we for each grid point computes the energy from all other data points using Eq. 7 for different values of λ . The right-most figure correspond to λ=0 . Note that each loss is normalized for each plot to be between 0 and 1, and therefore the absolute scale between the plots can not be compared.
Figure 12: The first row shows interpolation in noise space (red) using the isotropic Gaussian limiting distribution and transports the curve to data space using a ddpm -model for a dino-dataset. The second row computes the curve directly in data space using the score of the ddpm , which, for illustrative purposes, is repeated in each step of the sampling process.
Figure 13: Computed interpolations for ControlNet ( Zhang et al., 2023 ) for eagle images of size 768×768×3 similar to the experiment by Zheng et al. (2024) . We set the regularizer function in Eq. 7 as the density of the χ2 -distribution on the squared norm of the grid points z0:N . We plot the using our method incorporated into NoiseDiffusion using Eq. 46 and compare to NoiseDiffusion ( Zheng et al., 2024 ) .
Method
Metric
Hyper-parameters
Linear
G(z)=I
-
Spherical
Riemannian geometry of a sphere embedded in Euclidean space
-
Fisher-Rao
G(z)=∇zlogp(z)∇zlogp(z)⊤
-
Jacobian
G(z)=J∇zlogp⊤(z)J∇xlogp(z)
-
Inverse Density
G(z)=p(z)21I
-
Generative
G(z)=(p0+λp(z)+λ)2I
p0=λ=1
Appendix
Table 5: Benchmark methods and hyper-parameters
Metric type
Kinetic Energy
Conformal
Ekin(x,x˙)=(λ+h(x))∥x˙∥2 , where h is a scalar function.
Diagonal
Ekin(x,x˙)=(λ+h(x))∥x˙∥2 , where h is not a scalar function.
Full
Ekin(x,x˙)=λ∥x˙∥2+(⟨x˙,∇h(x)⟩)2
Appendix
Table 6: Kinetic energy for different metric types.
Model
Architecture
Training
Energy-Based model
We use a MLP with one hidden layer with 128 neurons and ReLU activations using the package Ghaderi and Contributors (2025) .
Trained for 1,000 epochs with a batch size of 128 for fixed 50,000 samples.
Normalizing flow
We use 32 affine coupling blocks of MLPs with two hidden layers of 64 neurons using the package ( Stimper et al., 2023 ) .
Trained for 4,000 epochs with a batch size of 29 .
AR
We use a MLP with two hidden layers of 64 neurons and TanH activations using the package.
Trained for 10,000 epochs with a batch size of 512 for fixed 50,000 samples.
VAE
We use the same architecture for a noisy circle embedded in R3 as in Shao et al. (2018) with minor modifications.
Trained for 5,000 epochs with a batch size of 512 for fixed 50,000 samples.
DDPM dinosaur
We use the architecture from github.com/tanelp/tiny-diffusion .
Trained identical to github.com/tanelp/tiny-diffusion .
Appendix
Table 7: Summary of models, their architectures, and training details.
Figure 14: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with G1/pθ (conformal).
Figure 15: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with Glogpθ (conformal).
Figure 16: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with G1/pθ (diagonal).
Figure 17: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with Glogpθ (diagonal).
Figure 18: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with GLAND .
Figure 19: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with G1/pθ (full).
Figure 20: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with Glogpθ (full).
Figure 21: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with our method ( S=−1/pθ ).
Figure 22: Image transitions on the AFHQ dataset ( Choi et al., 2018 ) with our method ( S=−logpθ ).
Figure 23: A transition corresponding to an initial value problem using our method in noise space for ControlNet, where we state the target prompt under the images. The initial prompt was "A photo of a cat".
Figure 24: A transition corresponding to an initial value problem using our method in noise space for ControlNet, where we state the target prompt under the images. The initial prompt was "A photo of a house".
Figure 25: A display of different boundary value methods for ControlNet. The prompt was "A photo of a mountain".
Figure 26: A display of different boundary value methods for ControlNet. The prompt was "A photo of a cat".
Figure 27: A display of different boundary value methods for ControlNet. The prompt was "A photo of an aircraft".
Figure 28: The estimated mean using spherical geometry for the data in Fig. 8 . The prompt was "A photo of a cat".
Figure 29: The estimated mean using linear geometry for the data in Fig. 8 . The prompt was "A photo of a cat".
Figure 30: The estimated mean using our method in noise space for the data in Fig. 8 . The prompt was "A photo of a cat".
Interpolation
OASIS3
CIFAR10 (SGM)
CelebAHQ (SGM)
CIFAR10 (LSGM)
CelebAHQ (LSGM)
Linear
27.83 / 85.94
0.33 / 391.64
-1.61 / 285.32
26.49 / 254.39
1.51 / 149.53
Spherical
28.46 / 68.97
4.30 / 237.64
-1.56 / 142.14
30.00 / 217.10
1.70 / 145.02
ProbGEORCE
28.41 / 66.54
4.12 / 233.84
-0.46 / 138.69
29.99 / 217.52
1.70 / 143.79
Appendix
Table 8: Mean log-likelihood / FID for interpolation in different diffusion models and datasets. SGM is score-based generative models ( Kingma and Ba, 2014 ) , while LSGM is latent score-based generative model ( Vahdat et al., 2021 ) . OASIS3 ( LaMontagne et al., 2019 ) was trained using latent diffusion model ( Rombach et al., 2022 ) used by Pinaya et al. (2022) .
Figure 31: Interpolation using a latent diffusion model similar to ( Pinaya et al., 2022 ) with our proposed method. Each row represents different slices of the brain. The interpolation shows the generative transition between a healthy brain (left) and a brain with Alzheimer disease (right).
Figure 32: Comparisons of interpolation curves for CelebAHQ with SGM.
Figure 33: Comparisons of interpolation curves for CIFAR10 with SGM.
Figure 34: The regularized energy and runtime for different optimizers for the regularized energy in Eq. 7 solving the bvp for the models in Fig. 2 .
EBM
NF
AR
VAE
Optimizer
Reg. Energy
Runtime
Reg. Energy
Runtime
Reg. Energy
Runtime
Reg. Energy
Runtime
λ=1.0
ProbGEORCE (Adaptive)
0.124
7.45 ± 0.01
0.087
81.03 ± 0.39
0.115
6.83 ± 0.01
0.043
145.86 ± 0.53
ProbGEORCE (LS)
0.124
73.62 ± 0.29
0.087
6.42 ± 0.01
0.115
0.58 ± 0.00
0.037
514.56 ± 10.30
Adam
0.124
6.60 ± 0.00
0.087
181.43 ± 3.04
0.115
12.65 ± 0.03
0.045
194.05 ± 5.60
SGD
0.206
5.70 ± 0.01
0.111
166.12 ± 2.02
0.175
11.99 ± 0.02
0.150
135.86 ± 9.14
Appendix
Table 9: Runtime and regularized energy for different methods for different values of λ for the methods in Fig. 2 . For ProbGEORCE (LS) for nf , the neural networks estimate of the likelihood returned nans during the iterations, and therefore we set − .
Figure 35: The regularized energy and runtimes for different optimizers minimizing Eq. 7 . We consider the n -sphere with n=10 for different values of λ and S=−logp , where p is the density of a mixture of three randomly weighted Gaussians with random means and the identity as covariance matrix. We report the regularized energy and runtime (mean runtime ± standard deviation runtime over five runs repeated five times).