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.vmaptransformation.
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.
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,hyperbolixintegrates seamlessly with core JAX transformations likejax.jitandjax.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.
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.
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