Assessing local deformation and computing scalar curvature with nonlinear conformal regularization of decoders
Benjamin Cou\'eraud, Vikram Sunkara, Christof Sch\"utte

TL;DR
This paper introduces a nonlinear conformal regularization method for autoencoders that quantifies local deformation and enables scalar curvature computation of the learned manifold, enhancing geometric understanding of data representations.
Contribution
It proposes a novel geometric regularization for autoencoders that allows local deformation analysis and scalar curvature computation of the learned data manifold.
Findings
Regularization enables local deformation quantification.
Method allows scalar curvature computation of the learned manifold.
Experiments demonstrate effectiveness on Swiss roll and CelebA datasets.
Abstract
One aim of dimensionality reduction is to discover the main factors that explain the data, and as such is paramount to many applications. When working with high dimensional data, autoencoders offer a simple yet effective approach to learn low-dimensional representations. The two components of a general autoencoder consist first of an encoder that maps the observed data onto a latent space; and second a decoder that maps the latent space back to the original observation space, which allows to learn a low-dimensional manifold representation of the original data. In this article, we introduce a new type of geometric regularization for decoding maps approximated by deep neural networks, namely nonlinear conformal regularization. This regularization procedure permits local variations of the decoder map and comes with a new scalar field called conformal factor which acts as a quantitative…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsDigital Image Processing Techniques · Distributed and Parallel Computing Systems · Geological Modeling and Analysis
Assessing local deformation and computing scalar curvature with nonlinear conformal regularization of decoders
Benjamin Couéraud111Corresponding author, please address all communications to [email protected].
Zuse Institute Berlin
Vikram Sunkara
Zuse Institute Berlin
Christof Schütte
Zuse Institute Berlin
Abstract
One aim of dimensionality reduction is to discover the main factors that explain the data, and as such is paramount to many applications. When working with high dimensional data, autoencoders offer a simple yet effective approach to learn low-dimensional representations. The two components of a general autoencoder consist first of an encoder that maps the observed data onto a latent space; and second a decoder that maps the latent space back to the original observation space, which allows to learn a low-dimensional manifold representation of the original data. In this article, we introduce a new type of geometric regularization for decoding maps approximated by deep neural networks, namely nonlinear conformal regularization. This regularization procedure permits local variations of the decoder map and comes with a new scalar field called conformal factor which acts as a quantitative indicator of the amount of local deformation sustained by the latent space when mapped into the original data space. We also show that this regularization technique allows the computation of the scalar curvature of the learned manifold. Implementation and experiments on the Swiss roll and CelebA datasets are performed to illustrate how to obtain these quantities from the architecture.
Keywords: Nonlinear dimensionality reduction, manifold learning, representation learning, autoencoders, deep learning, conformal map, regularization, Hutchinson’s estimator, deformation, scalar curvature.
Introduction
Dimensionality reduction, also known as manifold learning in certain contexts, aims at representing high-dimensional datasets by a smaller number of latent factors. Principal Component Analysis (PCA), is a well-known method that achieves that aim, but is not satisfactory for highly nonlinear datasets. Starting approximately two decades ago, numerous methods have been developed to address nonlinearity in dimension reduction. Popular among these methods are Locally Linear Embedding (LLE) [21], Multidimensional Distance Scaling (MDS) [23], Laplacian eigenmaps [1], just to name a few. These methods rely on performing a Singular Value Decomposition (SVD) at some stage and as such are not directly translatable to large and high-dimensional datasets. For an in-depth overview of nonlinear dimensionality reduction, see [2]. In the last decade, deep neural networks (DNNs) have been used in the analysis of such highly nonlinear datasets with much success. DNNs help in circumventing the need for SVD by optimizing with respect to a reconstruction loss (possibly amended with regularizers), on randomly selected points, to learn both local and global properties of the data.
We begin by establishing the mathematical notations used in this article. Let us denote the observation (data) space as , with usually very large, representing the number of features of the dataset. After performing dimension reduction via an encoder map , we end up in the latent space , with . To reconstruct this reduced data, we map it back with a decoder map to the original space , which is usually denoted by to emphasize the reconstruction process. Therefore, dimensionality reduction is represented by the maps:
[TABLE]
The manifold that is learned is ; it can be seen as embedded in although the existence of an embedding (in the mathematical sense) is not guaranteed. In practice, the latent space and the decoder constitute a parametrization of the learned manifold . When the encoder and decoder are neural networks, the structure above is knows as an autoencoder. In this context the encoder is parameterized by weights and the decoder is parameterized by weights , and the optimal weights are found by minimizing the reconstruction loss
[TABLE]
with respect to the weights and , and where denotes one of the data samples ( denotes the Euclidean norm). In what follows we will omit the reference to these weights for simplicity.
While using the reconstruction loss guarantees that the data manifold is close to the original data found in , neighboring data points in can me mapped to points in (called codes) which are far away from each other in the latent space , and similarly nearby codes in can be reconstructed without preserving the distance between them, resulting in encoders and decoders that exhibit high variations. In order to obtain better reduced representations of the data in the latent space, various geometric regularization terms have been proposed for either the encoder or the decoder, in order to not tear apart the latent representation and preserve neighborhoods (topology), or the distances in a certain sense (geometry – which practitioners may want to use to make statements about their datasets)222Regularizers can be seen as constraints in a given optimization problem and serve many purposes, such as imposing sparsity or smoothness. In this article regularization is used to enforce geometric properties.. For instance, to avoid high variations of the encoder, the norm of the Jacobian of the encoder is used as a regularizer (see [19]), which encourages the variations to be globally small. In another direction, a global isometry can be encouraged for the decoder by using a regularization term of the form:
[TABLE]
where denotes a distance on the latent space and denotes a distance on the data space (or similarly for the encoder; see [16] for an application to encoders where is the (approximated) geodesic distance). However, this regularization term is strong, as distances are encouraged to be preserved for any pair of codes, possibly not near each other. A weaker possibility is to encourage the decoder to be a local isometry, meaning that distances are preserved only between mapped neighborhoods. If both the data space and latent space are equipped with Euclidean metrics, the regularizer for the decoder is then
[TABLE]
where denotes the Jacobian of the decoder at a point (see [7] for such an approach), the identity matrix of size , and the Frobenius norm. Local distance preservation has also been explored in [14], without resorting to Jacobians but by using an auxiliary neighborhood graph and enforcing a local version of (3) between consecutive layers of the encoder. Another direction for geometric regularization makes use of curvature minimization, see for instance [13].
Nonlinear conformal decoding
In [12], it was noted that (4) is not a coordinate-invariant expression. The authors then proposed a new coordinate-invariant regularizer that ensures that the learned decoder is as closed as possible to a (local) isometry, and extended this approach (in a slightly different way) to conformal mappings possessing a constant conformal factor (see also [5] and [17] for former approaches). Conformal maps locally preserve distances up to a (possibly nonlinear) factor, and therefore preserve angles. Such maps are well-known in cartography (for cartographic projections, akin to what an encoder does) as well as physics and engineering (for reformulating problems into equivalent yet simpler ones). In generative artificial intelligence, conformal maps have also been used as normalizing flows (see [20]). We extend this approach to the case a nonlinear conformal factor and show its benefits.
Definition 1**:**
Let and be two Riemannian manifolds and be a smooth map. The map is called conformal if there exists a smooth map everywhere strictly positive such that , which means that for any point , , , we have:
[TABLE]
or alternatively in terms of the corresponding matrices:
[TABLE]
The function (or sometimes ) is known as the conformal factor).
We now would like to encourage a decoder to be a nonlinear conformal map. In many practical cases, the Riemannian metric on the data space (or ) is assumed to be Euclidean, and we will assume so as well: it amounts to say that the matrix above is everywhere the identity matrix. Then from (5), the condition we are trying to enforce reads , where is the matrix of the Riemannian metric on the latent space (which is invertible) and is the conformal factor for the decoder . Following [12], since eigenvalues of a matrix are invariant upon a coordinate change, we need to formulate a regularization term that involves eigenvalues of the ratio matrix , which we will denote by , . A natural expression that doesn’t favor any eigenvalue is:
[TABLE]
where denotes a smooth, positive and convex function that reaches its minimum at , and denotes a probability measure on the latent space 333The latent space will always be assumed to be compact.. This expression can be used to encourage the decoder to be a local isometry; we will explain how briefly hereafter. However, for the purpose of encouraging the decoder to be a nonlinear conformal map, we propose the following regularization term:
[TABLE]
where denotes any symmetric function such that and such that is homogeneous of degree , meaning for any nonzero real number . Note that such a function may still favor certain eigenvalues, but as a priori there is no reason to do so, we will specify a neutral later on. This new regularization term is a direct generalization of:
[TABLE]
with (see [12, section 3.3]), with the advantage that we will have access to a statistical estimator of the local deformation factor, see (9). Indeed, the conformal factor at a point can be seen as the ratio of the area of a ball centered at to the area of the preimage by the decoder of the same ball, giving a quantitative way to measure the stretching sustained while decoding.
Proposition 1**:**
Given a decoder , a function and a function satisfying the properties mentioned above, we have:
- 1
, 2. 2
is equivalent to the existence of a smooth map such that for all .
Also, given two decoders and , we have:
- 3
If there exists a smooth map such that , then .
Proof**:**
The first point is trivial. Concerning the second point, the implication from right to left is clear thanks to the properties of . The converse comes from the fact that is positive, so
[TABLE]
for all , but then reaches its unique minimum at , hence setting we obtain for all . The third point is clear using the homogeneity of after remarking that the eigenvalues of the matrix are the ones of multiplied by the conformal factor , at any point .
The first property ensures that the minimum of the regularizer is zero, while the second ensures that this minimum is reached precisely when the decoder is a conformal map, with the conformal factor given by the map . The third property simply says that conformal-equivalent decoders yield the same value of the regularization term; such property reduces the search space.
Proposition 2**:**
Choosing and so as not to favor any particular eigenvalue, we obtain:
[TABLE]
Proof**:**
From the previous proof, we note that the conformal factor is given by , hence we obtain the second formula. For the first, after rewriting the integral in (7) as an expectation with respect to the probability distribution on , we compute:
[TABLE]
which after simplification yields the first formula, since thanks to the invariance by similarity (change of basis) property of the trace we have .
Remark 1**:**
If we denote by the geodesic distance on the data space and the geodesic distance on the latent space by , we have:
[TABLE]
for any , in a neighborhood of a common . Indeed, using the Riemannian exponential map at the point we have for some tangent vectors and . Then by using [6, chapter 5, proposition 2.7] which approximates the geodesic distance by the Riemannian distance on , we obtain that the last term is approximately equal to (to first order) which in turn is equal to since is conformal444Given a Riemannian manifold, (or in matrix form) for any tangent vector .. Then using the exponential and the aforementioned proposition once more, we obtain .
Remark 2**:**
The regularization term (6) can be used to encourage the decoder to be local isometry. Using the same function as before, and computations similar to the ones in proposition 2 shows that we obtain a regularization term of the form:
[TABLE]
See also [9] for a similar approach but that does not make use of neural networks. In [12], constant conformal maps were introduced; they correspond to the coordinate-invariant regularization term:
[TABLE]
and the associated constant conformal factor then can be seen to be . Notice also the difference with regarding the use of the expectation operator .
Computing scalar curvature
In Riemannian geometry, scalar curvature [11] is the tensor of lowest rank that one can associate to the original Riemann curvature tensor. It is a smooth function on the manifold (or on the latent space, in case the manifold is embedded like in this article) that measures the curvature at that point, independently from a choice a local chart (or parametrization in our case). Computing different measures of the curvature of the learned manifold gives an intrinsic piece information about this manifold, and is of particular interest in the case of RNAseq data, see [24] and [22] for instance. With the help of the regularizer (7), in the case the latent space is of dimension (which is usually the case for visualization) we are encouraging the decoder to be conformal, meaning that at each latent variables we are trying to impose the relationship:
[TABLE]
where denotes the Euclidean metric on . Therefore, the scalar curvature on the latent space is the scalar curvature of the metric , with . However, the change of scalar curvature (on a manifold of dimension ) under a conformal change of metric is well known in Riemannian geometry (see [3]):
[TABLE]
where denotes the Laplace-Beltrami operator, generalizing the Laplacian to manifolds (see [11]). In our case and so we obtain:
[TABLE]
which is independent of the dimension of the space in which the data manifold is embedded. Once the decoder has been learned during the training phase, we can compute the conformal factor with the formula (10): to each input data point corresponds a latent code , and accordingly a value of the conformal factor at that point. To estimate the scalar curvature of , a simple approach is then to construct a -nearest neighbors graph from the latent codes, a weight matrix (and its associated degree matrix ) with exponential weights with respect to the Euclidean distances between latent codes, and form the graph Laplacian . Then if represents the array of estimated values for the conformal factor, the scalar curvature is given by the array , where the division and the logarithm are component-wise operations.
Implementation
In order to implement the different regularizers, we use Hutchinson’s trace estimator [8]. Namely, given a matrix , the trace can be Monte-Carlo estimated thanks to the relation , which has the advantage to only require matrix-vector products. Stacking samples from a Rademacher distribution instead of using one sample from a -dimensional multivariate Gaussian, one obtains an unbiased estimator with minimal variance (see [8, proposition 1])555Notice though that Hutchinson’s estimator may exhibit a great amount of Monte-Carlo variance. To remedy to this problem, variance reduction techniques can be employed, see this web page for an exhaustive review and insights. We give an example of this estimator for with , denoting the Jacobian of some map (a decoder in particular). We have the formula
[TABLE]
which we used to implement the regularization term (9) with PyTorch666Matrix-vector products of the form are computed with the help of the function torch.func.jvp, while matrix-vector products such as (that appear in are computed with the help of the function torch.func.vjp., and where denotes a stacked Rademacher sample as described before. Also, to implement , we take to be the empirical measure.
Furthermore when the full Jacobian of the decoder is needed for a batch of data, we make use of the the torch.func.vmap and torch.func.jacfwd functions. The optimizer used is the weighted Adam’s algorithm, with additions in the case of the Celebrities dataset (see section 5.2).
All code was implemented using PyTorch and was run on standard laptop-grade Intel CPU hardware (i5-11400H), then with a standard NVIDIA GPU hardware (GeForce RTX 3500), as well as on a computing cluster equipped with NVIDIA H100 NVL GPU hardware, giving roughly a tenfold performance increase on the experiments to follow. The full code can be found at this URL.
Remark 3**:**
Concerning reproducibility, although we made sure that all seeds (Python, NumPy, PyTorch and CUDA ones) are set before running the experiments, we couldn’t obtain the same values for different runs. According to PyTorch’s documentation, this is due to CUDA choosing at runtime what is the best algorithm to run the code on the GPU, and that randomness is involved in this choice. Even with fully deterministic CUDA algorithms we couldn’t obtain the same values for different runs. Running multiple times the same experiment and averaging the results was ruled out because it proved to be too computationally intensive. We invite the reader to consult PyTorch’s official documentation on this matter.
Experiments
In order to assess the regularization terms (11) and (12) proposed in this article, we created experiments based on several datasets. A vanilla autoencoder with reconstruction loss (2) serves as the basis for comparison (with no geometric regularizer), with layers of different types according to the dataset used. Then, the different regularization terms were added to the reconstruction loss , starting with the well-known (3) and then considering and .
Swiss roll dataset
The Swiss roll is a classical toy dataset in nonlinear dimensionality reduction. It can be found for example in scikit-learn. In this package it is parametrized as follows: , a latent variable is written , and the parametrization is given by:
[TABLE]
The notations and are precisely chosen so as to give a parallel with the autoencoder structure (1) (with , and ). We are now given samples from this dataset and the aim of the encoder is to obtain a latent space (not necessarily the same as the one above), while the decoder will give us a new parametrization of the Swiss roll. Adding the regularization terms means that we are adding constraints on the way the Swiss roll is embedded in through its parametrization . Using this parametrization we compute:
[TABLE]
therefore the parametrization above is not conformal, and the regularizer we propose will find one. The dataset has been normalized as follows: to each data point the average among all samples is subtracted, and we divide the result by the standard deviation among the samples. The vanilla autoencoder is composed of a sequence of fully connected layers with dimensions for the encoder, and reversed for the decoder, together with ReLU activation functions. The same architecture is held throughout the experiments, for all regularizers. The standard mean squared error (MSE) loss is used to implement the reconstruction loss.
The scalar curvature of the Swiss roll, which is twice its Gaussian curvature, can be computed from the parametrization above and we find as expected as it is an embedding of a plane in (see [18] for how to compute the Gaussian curvature from the first and second fundamental forms). The vanilla autoencoder, together with the conformal regularizer and the computation of the graph Laplacian on the latent space allows to recover this fact as shown by figure 3.
On the validation dataset we also measured the condition number (with respect to the norm) of the Jacobian of the decoder, , and the condition number of the pull-back metric of the decoder, with . The first measure shows how the linearized decoder around one latent code amplifies variations in its input (latent variables), and the second summarizes the pullback metric, specifically the anisotropy of the pullback metric, or how far the decoder is from being a local isometry. These condition numbers are computed with torch.linalg.cond at each validation point in the latent space. Their spatial distributions are visualized in figure 4 and summarized in the table 1, for all geometric regularizers. Although no experiment repetition and results averaging has been performed, it has been observed clearly that nonlinear conformal regularization (and local isometric regularization) consistently learn a better conditioned and anisotropic decoder.
An important hyperparameter to consider when one wants to quantitatively assess the benefits of a geometric regularizer is the intensity with which the constraint is imposed in the total loss. One rule of thumb is to first adjust it so that the regularizer values times this intensity are in the same range as the values of the reconstruction loss . Then, from that stage, if we increase this intensity it may happen that the reconstruction loss does not decrease anymore, while decreasing the intensity will accordingly decrease the desired effect of the geometric regularizer. Finding a good balance is a challenge, especially because the regularizer values change during the training process.
Celebrities dataset
The Celebrities dataset (also widely known as CelebA, see [15]) is a well-known dataset that comprises more than 200,000 faces of celebrities (with 40 annotated attributes), each of size pixels. With the help of the torchvision.transforms submodule, each image in the dataset is center cropped to pixels, resized to pixels, and normalized per channel so that all values are in . Therefore, with regards to the structure (1), and . For this experiment the vanilla autoencoder uses convolutional layers with kernel size , stride and padding , together with leaky ReLU activation functions, except for the last layer of the decoder which uses an hyperbolic tangent in order to normalize the values in and recreate an image. There is also a fully connected layer after the last convolution layer to map the last feature map onto the latent space. The dimensions are as follows: . In order to reduce overfitting, for this dataset we used weight decay and a learning rate scheduler that reduces the learning rate upon encountering a plateau (starting with a learning rate of , with batch size 64, attaining convergence at 100 epochs). Note that since the data set is high dimensional and the compression is maximal (latent space has dimension 2), it is very difficult to reconstruct images and the reconstruction loss stabilizes around only. The table 2 shows once more that the local isometry and nonlinear conformal regularizers added to the vanilla autoencoder learn better conditioned decoders than the global isometry regularizer.
Conclusion
In this article, we applied a new type of geometric regularization to decoders, namely nonlinear conformal regularization. Conformal maps do not exactly preserve distances, only up to a certain factor that varies with the codes in the latent space, called the conformal factor, which allows to make an assessment on the local deformation that occurs upon reconstructing the observed data from latent codes. The regularizer is formulated in a coordinate-invariant way, in the spirit of [9], and is implemented as a Hutchinson’s Monte-Carlo estimator, whose quality increases with the number of stacked Rademacher samples. The architecture proposed automatically learns the conformal factor as well as the scalar curvature of the manifold after construction of a graph Laplacian on the latent space. In addition, it is more flexible than a global isometry regularizer in the sense that local variations of the decoder are allowed, and the regularizers allow the architecture to learn better conditioned decoders.
This work opens further questions on geometric regularization in the context of autoencoders. One venue of research would be to integrate this new geometric regularizer into a variational autoencoder (VAE), and study the interplay between the geometry brought back onto the latent space with the help of the pullback metric, and the information geometry of the latent space as given bye the VAE (several works are already investigating this direction, such as [4] and [10]), and how conformal maps are beneficial in that case. Moreover, VAEs tend to use less samples than standard autoencoders, which would be beneficial to study RNAseq datasets with the presented framework, possibly opening the way to make statements based on stretched distances and scalar curvature as visualized in the latent space. Also, it would be interesting to study variance reduction techniques for the conformal regularizer, with the aim of improving both the condition number of the decoder’s Jacobian and the condition number of the pullback metric.
Acknowledgments: The author would like to thank Enikő Regényi for her explanations regarding RNAseq data and for the preparation of experiments regarding several RNAseq datasets (unpublished).
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps and spectral techniques for embedding and clustering. In T. Dietterich, S. Becker, and Z. Ghahramani, editors, Advances in Neural Information Processing Systems , volume 14. MIT Press, 2001.
- 2[2] Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Trans. Pattern Anal. Mach. Intell. , 35(8):1798–1828, 2013.
- 3[3] Arthur L Besse. Einstein Manifolds . Classics in Mathematics. Springer, Berlin, Germany, 2007.
- 4[4] Clément Chadebec and Stéphanie Allassonnière. A geometric perspective on variational autoencoders. In Proceedings of the 36th International Conference on Neural Information Processing Systems , NIPS ’22, Red Hook, NY, USA, 2022. Curran Associates Inc.
- 5[5] Nutan Chen, Alexej Klushyn, Francesco Ferroni, Justin Bayer, and Patrick Van Der Smagt. Learning flat latent manifolds with VA Es. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning , volume 119 of Proceedings of Machine Learning Research , pages 1587–1596. PMLR, 2020.
- 6[6] F. Flaherty and M.P. do Carmo. Riemannian Geometry . Mathematics: Theory & Applications. Birkhäuser Boston, 2013.
- 7[7] Amos Gropp, Matan Atzmon, and Yaron Lipman. Isometric autoencoders, 2020.
- 8[8] M.F. Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics - Simulation and Computation , 18(3):1059–1076, 1989.
