Hyperbolix
Hyperbolic Deep Learning in JAX
Pure JAX implementation of hyperbolic deep learning with manifold operations, neural network layers, and Riemannian optimizers. Built with Flax NNX and Optax.
Features
- 🌐 6 Manifolds: Euclidean, Poincaré Ball, Hyperboloid, Proper Velocity, κ-Stereographic (signed curvature — hyperbolic, flat, and spherical in one manifold), and Product Manifold (mixed-curvature composition)
- 🎛️ Learnable Curvature:
LearnableCurvaturemodule bundles parameter + reparameterization (softplus, log/exp, or signed identity) + optional clamp. Works with anynnx.Optimizer— no Riemannian optimizer needed - 🧠 40+ Neural Network Layers: Linear, convolutional, regression, attention, normalization, positional encoding, PV
- ⚡ 5 Hyperbolic Activations: ReLU, Leaky ReLU, Tanh, Swish, GELU
- 📈 Riemannian Optimizers: RAdam and RSGD with automatic manifold detection
- 🚀 Pure JAX/Flax NNX: vmap-native API, JIT-compatible
- ✅ 3,550+ tests passing (735 test functions, parametrized across dtypes, dimensions, manifolds) checked against independently transcribed NumPy/SciPy oracles
Quick Start
import jax.numpy as jnp
from flax import nnx
from hyperbolix.manifolds import Poincare
from hyperbolix.nn_layers import HypLinearPoincare
# Plain Python manifold class (optionally float64; pass `c=` for fixed curvature)
poincare = Poincare() # add dtype=jnp.float64 as needed
# Manifold operations (single-point; use jax.vmap for batches)
x = jnp.array([0.1, 0.2])
y = jnp.array([0.3, -0.1])
distance = poincare.dist(x, y, c=1.0)
# Neural network layer
layer = HypLinearPoincare(
manifold_module=poincare,
in_dim=128,
out_dim=64,
rngs=nnx.Rngs(0),
)
output = layer(x_batch, c=1.0)
Mixed-Curvature Product Spaces
from hyperbolix.manifolds import ProductManifold, Hyperboloid, Poincare, Euclidean
# H^5 × P^3 × E^4 — points live in R^12, each factor keeps its own curvature
product = ProductManifold(
(Hyperboloid(c=1.0), 5),
(Poincare(c=0.1), 3),
(Euclidean(), 4),
)
cs = product.curvatures # (1.0, 0.1, 0.0) — pass per-factor at call time
d = product.dist(x, y, cs) # sqrt(sum d_i^2) over factors
To make any factor's curvature trainable, store one LearnableCurvature
instance per factor on your model and call it to obtain c for per-factor
operations (see "Learnable curvature" below).
Installation
git clone https://github.com/timoklein/hyperbolix.git
cd hyperbolix
uv sync # or: pip install -e .
Requirements: Python 3.12+, JAX 0.9+, Flax 0.12+, Optax 0.2.6+
Documentation
- Getting Started - Installation and first examples
- User Guides - Manifolds, layers, optimizers, batching, numerical stability
- API Reference - Complete API documentation
- Developer Guide - Development setup and workflows
Build docs locally: uv run mkdocs serve
Key Concepts
Plain-class manifolds, curvature passed at call time: Each manifold is a plain Python class (not an nnx.Module) with automatic dtype casting; the curvature c is supplied per call so it can be static, dynamic, or a traced jax.Array driven by a learnable parameter on your model.
from hyperbolix.manifolds import Poincare
poincare = Poincare() # add dtype=jnp.float64 as needed
dist = poincare.dist(x, y, c=1.0) # (dim,) → scalar
vmap-native API: Methods operate on single points; use jax.vmap for batching.
distances = jax.vmap(poincare.dist, in_axes=(0, 0, None))(
x_batch, y_batch, 1.0
)
Learnable curvature: Use the LearnableCurvature module — assign one instance per distinct curvature in your model and call it to obtain a positive (optionally clamped) value. The manifold itself stays a fixed plain Python class, which keeps it out of the NNX state pytree (safe to share the same instance across layers and inside nnx.scan / nnx.fori_loop). The default clamp [0.1, 10.0] matches published reference ranges; pass c_min=None, c_max=None to disable. Use parameterization="log" (MERU-style) when c may span orders of magnitude or for long compiled training loops; the default "softplus" matches van Spengler 2023.
from hyperbolix import LearnableCurvature
from hyperbolix.manifolds import Hyperboloid
class Model(nnx.Module):
def __init__(self, rngs):
self.manifold = Hyperboloid(c=1.0) # static, shared
self.curvature = LearnableCurvature(init_c=1.0) # one per distinct c
self.fc = HypLinearHyperboloidPLFC(self.manifold, 33, 65, rngs=rngs)
def __call__(self, x):
c = self.curvature() # positive, clamped
return self.fc(x, c=c)
# Updated by any standard Euclidean optimizer — no Riemannian optimizer needed.
optimizer = nnx.Optimizer(model, optax.adam(1e-3), wrt=nnx.Param)
Citation
@software{hyperbolix2026,
title = {Hyperbolix: Hyperbolic Deep Learning in JAX},
author = {Klein, Timo and Lang, Thomas},
year = {2026},
url = {https://github.com/timoklein/hyperbolix}
}
References
Implements methods from:
- Ganea et al. (2018): Hyperbolic Neural Networks
- Bécigneul & Ganea (2019): Riemannian Adaptive Optimization
- Gu et al. (2019): Learning Mixed-Curvature Representations in Product Spaces
- Nagano et al. (2019): Wrapped Normal Distribution on Hyperbolic Space
- Shimizu et al. (2020): Hyperbolic Neural Networks++
- Bdeir et al. (2023): Fully Hyperbolic CNNs
- Bdeir et al. (2025): Robust Hyperbolic Learning
- Klis et al. (2026): Fast and Geometrically Grounded Lorentz Neural Networks
- Chen et al. (2026): Proper Velocity Neural Networks
See individual module docstrings for detailed references.
Contributing
Contributions welcome! See DEVELOPER_GUIDE.md for setup and guidelines.
For bugs or questions, open an issue.
License
MIT License. See LICENSE for details.
Metadata
Release files for hyperbolix 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hyperbolix-1.1.2.tar.gz | 187.2 kB | Without provenance | Details for hyperbolix-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyperbolix-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for hyperbolix-1.1.2-py3-none-any.whl |
Total release size: 421.2 kB
Release files / hyperbolix-1.1.2.tar.gz
| Download URL | hyperbolix-1.1.2.tar.gz |
|---|---|
| Size | 187.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd48497715414be2b49b0282e4102e928630baf52f21be78c2a3d4117a414449
|
|
BLAKE2b-256 checksum How to use checksums |
63560e5894b6f827bbd8b03474227fa59bfc28354080b2fb25e074453e1a8f43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / hyperbolix-1.1.2-py3-none-any.whl
| Download URL | hyperbolix-1.1.2-py3-none-any.whl |
|---|---|
| Size | 234.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0446b0564ceec31e3decf563866cf1578a1623efbe2eb3ae6bd3ae392c9847fc
|
|
BLAKE2b-256 checksum How to use checksums |
1761314e8219e1b8e2a462d45883bc7b84be2dfe2f8867b3da656774dc722914
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for hyperbolix 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.