Ensuring Topological Data-Structure Preservation under Autoencoder Compression Due to Latent Space Regularization in Gauss–Legendre Nodes
*Equal contribution · Research Institute CODE (UniBw Munich) · CASUS, Helmholtz-Zentrum Dresden-Rossendorf · SAXONY.ai · University of Wrocław
TL;DR: A low reconstruction error does not mean an autoencoder has learned the true shape of the data. Its latent space can still tear, fold or self-intersect the data manifold. We propose a simple, data-independent regularization that samples the autoencoder's Jacobian at Gauss–Legendre nodes in the latent space, and we prove it yields a one-to-one, topology-preserving embedding. In practice, regularized autoencoders keep circles as circles and tori as tori, and stay robust to heavy noise on FashionMNIST and MRI brain scans.
Motivation: compression should not break the shape of the data
Autoencoders are the standard tool for compressing high-dimensional data, from microscopy and neuroscience to physics, into a low-dimensional latent space. These latent codes are then used for classification, feature selection and analysis. That only makes sense if the latent space is a faithful copy of the data manifold: points that are neighbours in the data stay neighbours in the latent space, and nothing gets glued together or torn apart.
Training only minimizes reconstruction error, and that is not enough. The decoder solves an inverse problem, and inverse problems are notoriously unstable: tiny changes to a latent code can produce very different reconstructions. Without extra control, an autoencoder can reconstruct its training data well while its latent space still crosses itself, flattens holes or merges classes.
The idea: regularize the latent space at Legendre nodes
Our key requirement is that encoding a decoded latent point gives back the same point, \( \varphi(\nu(y)) = y \), for every \( y \) in the latent cube, not just for training data. By the inverse function theorem, this holds if the Jacobian of \( \varphi \circ \nu \) is the identity everywhere.
So we add one term to the usual reconstruction loss:
\[\mathcal{L} = \sum_{x \in D_{\text{train}}} \lVert x - \nu(\varphi(x)) \rVert^2 \;+\; \lambda \sum_{\alpha} \big\lVert I - J\big(\varphi(\nu(p_\alpha))\big) \big\rVert^2\]The points \( p_\alpha \) are Gauss–Legendre nodes, the classic quadrature points used for highly accurate numerical integration. Sampling the Jacobian there approximates an integral over the entire latent space very efficiently. Because the nodes live in the small latent space, high-resolution regularization stays cheap.
This regularization has several useful properties:
- It is data-independent: it needs no knowledge of the data manifold or how it is embedded.
- It is architecture-independent: it can be added to MLPs, CNNs or VAEs.
- It is provably correct: we prove that autoencoders trained to zero loss converge to a proper, topology-preserving autoencoder (Theorem 1 in the paper).
We also propose a hybrid variant (Hybrid AE-REG). It first compresses each image with a Chebyshev polynomial fit and then trains the regularized autoencoder on the polynomial coefficients, which improves reconstruction quality.
Results: shapes that stay intact
We compared the regularized autoencoder (AE-REG) with an MLP autoencoder, a CNN autoencoder, MLP and CNN VAEs, and a contractive autoencoder (ContraAE), all with parameter counts of similar size.
A circle in 15 dimensions. We embedded a circle into 15-dimensional space and trained on only three points, the minimum that determines a circle. Every unregularized model produces overlaps or crossings. Only AE-REG recovers a clean loop.
A torus. The same story holds for a squeezed torus embedded in 15 and 1,024 dimensions. The VAEs and the CNN autoencoder flatten it, and ContraAE and the MLP autoencoder make it intersect itself. AE-REG is the only model that keeps the hole.
FashionMNIST under noise. With a 10-dimensional latent space, the regularized models are not the best on clean images, but they stay stable as noise increases. From 20% Gaussian noise onward, Hybrid AE-REG gives the best reconstructions of all models, and its quality holds up to 70% noise.
The robustness shows up in the images too. Under heavy noise, the unregularized models change the item’s class: for example, trousers are reconstructed as a shirt or a dress. AE-REG and Hybrid AE-REG (the bottom two rows) keep trousers as trousers.
Walking through the latent space. To probe the latent geometry, we computed shortest paths (geodesics) between two encoded images, a sandal and a boot. A faithful latent space should give a smooth path through similar items. The unregularized MLP autoencoder wanders through bags, shirts and trousers. AE-REG moves smoothly from sandals through sneakers to boots.
MRI brain scans. On 60,000 slices from the OASIS MRI dataset (91 × 91 pixels, 40-dimensional latent space), the picture repeats. The regularized models are comparable on clean scans and pull ahead once noise is added. Hybrid AE-REG gives the cleanest reconstructions of perturbed scans, and AE-REG produces the most consistent latent geodesics.
Takeaway
Low reconstruction error is not the same as a trustworthy latent space. By asking the autoencoder to be invertible across its whole latent space, which we enforce cheaply at Gauss–Legendre nodes, we obtain representations that provably preserve the topology of the data. In practice they are also far more robust to noise. Even plain MLP autoencoders regularized this way outperform convolutional, variational and contractive alternatives.
Citation
@article{ramanaik2024ensuring,
title={Ensuring Topological Data-Structure Preservation under Autoencoder Compression Due to Latent Space Regularization in Gauss--Legendre Nodes},
author={Ramanaik, Chethan Krishnamurthy and Willmann, Anna and Suarez Cardona, Juan-Esteban and Hanfeld, Pia and Hoffmann, Nico and Hecht, Michael},
journal={Axioms},
volume={13},
number={8},
pages={535},
year={2024},
publisher={MDPI}
}