VAE with Hyperspherical Coordinates: Improving Anomaly Detection from Hypervolume-Compressed Latent Space
2026
Read VAE with Hyperspherical Coordinates: Improving Anomaly Detection from Hypervolume-Compressed Latent Space (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-18823.txt.
Introduction
A study takes on a flaw in a kind of smart tool that learns to squeeze data down and build it back up. Such a tool, called a variational autoencoder, learns a small code for each case. Once taught, it should flag new cases whose codes look odd, since odd codes may mark faults or fraud. But as the code grows in dims, its space swells fast. That swell can warp the codes and hide the odd ones.
The work bends the code space in-to a ball form, in which all codes sit on a shell of set span. A shell has no far waste space for codes to drift in-to. Codes that break the shell's form then stand out with more ease. A sharper flag could serve banks, plants, and scan tools. The work tests the ball form on that hunt.
Catalog record
| YEAR | 2026 |
|---|---|
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 32 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2601-18823
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
VAE with Hyperspherical Coordinates: Improving Anomaly Detection from Hypervolume-Compressed Latent Space Abstract Variational autoencoders (VAE) encode data into lower-dimensional latent vectors before decoding those vectors back to data. Once trained, one can hope to detect out-of-distribution (abnormal) latent vectors, but several issues arise when the latent space is high dimensional. This includes an exponential growth of the hypervolume with the dimension, which severely affects the generative capacity of the VAE. In this paper, we draw insights from high dimensional statistics: in these regimes, the latent vectors of a standard VAE are distributed on the ‘equators’ of a hypersphere, challenging the detection of anomalies. We propose to formulate the latent variables of a VAE using hyperspherical coordinates, which allows compressing the latent vectors towards a given direction on the hypersphere, thereby allowing for a more expressive approximate posterior. We show that this improves both the fully unsupervised and OOD anomaly detection ability of the VAE, achieving the best performance on the datasets we considered, outperforming existing methods. For the unsupervised and OOD modalities, respectively, these are: i) detecting unusual landscape from the Mars Rover camera and unusual Galaxies from ground based imagery (complex, real world datasets); ii) standard benchmarks like Cifar10 and subsets of ImageNet as the in-distribution (ID) class. 1 Introduction Figure 1 : Proposed method for the fully unsupervised case . The standard VAE (left) is modified (right) by converting the latent vectors into hyperspherical coordinates. In our new formulation, the latent vectors from the normal class in green can be moved during training towards a given direction on the hypersphere, forming a dense and compact “island”, illustrated here by projecting the latent distributions on a 2D sphere (see subsection Results 4.3 for more details about how this is done). Anomalies in red are detected by measuring their distance to the island. The figure corresponds to results from the experiment on the Galaxy Zoo dataset (cf. Table 1 , third column). Figure 2 : Proposed method for the OOD case . In this case, a compression of the same type as in the previous figure is done on each of the ID class clusters, simply by re-orienting the full hyperspherical coordinate system such that the first angular coordinate is the angle w.r.t. the Cartesian orthogonal axis whose number is equal to a corresponding ID class label. The von Mises-Fisher-based method (von MF) shows more noisy and dispersed samples because having only one single parameter (the first hyperspherical angle) to compress the volume and thus reduce the sparsity of the HD space is not enough, as we show in the Supplementary materials (Supp.), where we also see that t-SNE can be misleading for assessing compression. In contrast, our method compresses all of the hyperspherical angles. The figure corresponds to results from the experiment on Imagenette vs close Imagenet (cf. Table 3 ). Anomaly detection (AD) can be done in a fully unsupervised or OOD manner. Fully unsupervised anomaly detection, where one does not have access to sub-class information/labels in the normal/ID data , is a challenging task, and two main approaches have shown promise. They both rely on an autoencoder (AE), which encodes the data into a lower dimension latent space, before decoding the latent vectors back to data. The main assumption is that the AE, having learned to encode/decode the training dataset, would do poorly in processing a sample outside that distribution. The detection can either be done by comparing the reconstructed and the original data [ 7 , 15 ] , or by detecting whether latent vectors lie outside the “normal” latent distribution. A variation of the former uses a diffusion-based generative model to reconstruct data, but the detection is also between the generated and original data [ 23 ] . Many recent works have focused on the OOD AD case, where one uses sub-class information from the normal training set to help the task, for example by disentangling the normal subclasses with a classifier, e.g., a ResNet [ 33 , 19 ] ; the ‘good’ embeddings/features from the penultimate layer can then be used for AD via some standard method outlier detection techniques, e.g., k-NN [ 29 ] . This greatly simplifies the problem. In this work, we explored the performance of our method on both of these two types of AD scenarios. Our main contribution is a novel way to detect anomalies in latent space. AD is challenging due to the high dimensionality of practical datasets such as the images used in this paper: because of concentration of measure effects, when encoding samples uniformly to a latent hypersphere, they tend to only populate its ‘ equators ’. We proposed to convert the latent vectors from Cartesian coordinates to hyperspherical coordinates, de facto disentangling the dimensions: a point on a hypersphere can be moved on the surface by changing only one hyperspherical angle. This is impossible to do using standard Cartesian coordinates: moving a point on the hypersphere surface involves modifying every Cartesian latent dimension. Because of that disentanglement, we could reformulate the VAE cost function to move all the latent samples towards a given direction on the hypersphere, creating a very dense island, away from the high hypervolume equators. Measuring how far a sample is from that island of normal data becomes easier than in the case of a uniform distribution on the hypersphere with its vast equators, and a simple k- nearest neighbors achieves better results for AD than existing methods. The creation of a dense island by this particular method has already been shown to be useful when using the VAE for the generative task [ 2 ] , and here we show its value for AD. Reviews on the standard VAE can be found in [ 16 , 17 ] . The latent space tends towards a high dimensional independent multivariate Gaussian, which has properties that we briefly review next. 1.1 High Dimensional Spaces Sampling from a multivariate Gaussian in a high-dimensional (HD) Euclidean space of dimension n exhibits several counterintuitive properties. Although the origin has the highest probability density, the probability of drawing samples near it is nearly zero. Instead, most samples concentrate near the (n-1) -dimensional hypersphere \mathbb{S}_{\sqrt{n}}^{n-1} of radius \sqrt{n} . The norm of the samples follows a \chi(n) distribution, which implies that samples lie within a thin shell around the hypersphere. The thickness of this shell relative to its radius \sqrt{n} shrinks as n increases. As n grows large, the distribution of \mathcal{N}(0,I_{n}) approaches the uniform distribution on the hypersphere. Furthermore, any two independent samples from \mathcal{N}(0,I_{n}) are always nearly orthogonal to one another, a property called almost-orthogonality (see [ 31 ] for a formal treatment). These behaviors are deeply tied to how (hyper-)volume behaves in HD spaces. Under the uniform measure on a hypersphere, most of its exponentially growing volume in n is concentrated in extremely thin equatorial bands relative to any randomly chosen “north pole.” This is a truly remarkable and deep fact. It is formalized in [ 32 ] , and is part of the broader notion known in mathematics as concentration of measure . Standard low-dimensional (2D or 3D) intuitions about spheres break down in HD spaces, and such properties significantly affect anomaly detection in