hyperbolix: Hyperbolic Deep Learning in JAX

Timo Klein, Thomas Lang, Yllka Velaj, Sebastian TschiatschekarXiv 2026

TL;DR

The authors present hyperbolix, the first comprehensive, general-purpose hyperbolic deep learning library built natively for the JAX ecosystem (specifically Flax NNX). It introduces 76 neural network layers across 6 distinct manifold models and features novel, cancellation-free mathematical formulas that drastically improve numerical stability in standard 32-bit precision (float32) compared to existing PyTorch alternatives.

What Problem Does This Paper Address?

Standard deep learning frameworks like PyTorch and JAX are Euclidean by design: tensors live in flat vector spaces ($\mathbb{R}^n$), and operations rely on standard vector addition and affine transformations. However, hierarchical data—such as natural language taxonomies, internet graphs, or biological classifications—grows exponentially with depth. Forcing this tree-like data into a flat Euclidean space leads to severe distortion. Hyperbolic space, where volume expands exponentially with radius, offers a mathematically ideal geometry for embedding hierarchies.

While PyTorch users can leverage established hyperbolic libraries like geoopt or HypLL, JAX users have lacked a comprehensive library for hyperbolic layers. Furthermore, standard implementations of hyperbolic geometry suffer from severe numerical instability. Far from the origin, standard formulas subtract large, nearly equal terms (catastrophic cancellation), causing calculations to collapse into NaN (Not a Number) values when using standard float32 precision.

Methods

hyperbolix bridges this gap by providing an open-source library built on Flax NNX. Its design adheres strictly to idiomatic JAX principles:

  • Stateless Manifolds: Manifolds are plain Python classes rather than stateful modules, allowing curvature parameters to be passed dynamically at call time.
  • Functional Paradigm: Operations are defined on single, unbatched points, leaving batching behavior entirely to JAX’s native jax.vmap transformation.

The library supports six manifold models with a unified interface: Euclidean space, the Poincaré ball, the hyperboloid, the $\kappa$-stereographic model, mixed-curvature product spaces, and the proper velocity space. It implements 76 public exports covering linear layers, convolutions, attention mechanisms, normalization, positional encodings, regression, and vector quantization.

Table 1: Contents of the nn_layers package. A ✓marks manifold coverage. The full inventory with source attributions is in Appendix A.

To solve the numerical instability problem on the hyperboloid, the authors rewrote standard two-point operations (like distance and parallel transport). They replaced Minkowski inner-product subtractions with non-negative, cancellation-free formulations—essentially creating a hyperbolic analog to the haversine identity.

Datasets

Not discussed in the paper. The library's correctness and performance were evaluated using synthetic mathematical sampling grids and algorithmic verification rather than training on standard deep learning datasets.

Key Insights and Ideas

  • Algebraic Banishment of NaNs: Instead of relying on crude numerical clamping to prevent code from crashing, the authors mathematically restructured the underlying equations to guarantee non-negative terms. This allows models to operate much further from the origin without losing precision.
  • Functional Compatibility: By keeping manifold classes stateless and relying on jax.vmap, hyperbolix integrates seamlessly with core JAX transformations like jax.jit and jax.grad, avoiding the complex graph-tracking issues common in stateful deep learning frameworks.
  • Independent Oracle Testing: To prevent inheriting bugs from prior implementations, the authors verified all 1,038 test functions against independently derived closed-form mathematical oracles (transcribed via high-precision NumPy/SciPy) rather than cross-library comparisons.

Key Results

Numerical Stability

On the hyperboloid, hyperbolix maintains high accuracy in float32 up to a geodesic radius of 10. In contrast, the leading PyTorch alternative, geoopt, suffers from catastrophic cancellation and returns NaN at a radius of approximately 9.

Figure 2: Median relative error of hyperboloid operations at curvature c = 1 in dimension 8, as a function of the geodesic radius a from the origin. We measure the distance between two points on one ray at unit separation, and the norm of a unit tangent vector at 45◦to the ray. For both float32 and float64, hyperbolix tracks the input-rounding error. On the float32 distance past a ≈10, it stays within 8× of it. For the tangent norm, geoopt’s median is exactly 0 at a = 7 and 9 only because cancellation leaves it so few possible float32 results that more than half land exactly on 1. The rest are far off.

Additionally, the library demonstrates superior round-trip stability (expmap followed by logmap) near the origin compared to geoopt on both the Poincaré ball and the hyperboloid.

Figure 3: Expmap-logmap round trip stability of different libraries as a function of the tangent vector norm r. For the Poincaré ball, hyperbolix and HypLL are more stable than geoopt around the origin. On the hyperboloid, hyperbolix stays at the rounding level across the measured range. geoopt shows elevated error near the origin. HypLL does not implement hyperboloid operations.

Computational Performance

When compiled using jax.jit, hyperbolix achieves speeds comparable to optimized PyTorch libraries (geoopt and HypLL using torch.compile). However, due to current XLA compiler limitations—specifically its inability to fuse separate reduction and rescaling operations into a single GPU kernel—HypLL remains faster for certain Poincaré ball operations.

Limitations and Future Work

  • Lack of Downstream Benchmarks: The authors acknowledge that the library has not yet been benchmarked on real-world downstream tasks to demonstrate competitive training accuracy.
  • Uneven Feature Coverage: Feature support is currently uneven across the different manifolds; for instance, attention layers and positional encodings are only implemented for the hyperboloid, while vector quantization bottlenecks are restricted to the Poincaré ball.
  • Compiler Bottlenecks: The library's performance on certain operations is bottlenecked by XLA's kernel fusion limitations rather than algorithmic design.

Summary updated

BibTeX
@misc{klein2026hyperbolix,
  author = {Timo Klein and Thomas Lang and Yllka Velaj and Sebastian Tschiatschek},
  title = {{hyperbolix: Hyperbolic Deep Learning in JAX}},
  year = {2026},
  eprint = {2609.28248},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.28248},
}
Figure