Expand description
Hyperbolic geometry for embedding hierarchical structures.
Embed trees and hierarchies in low dimensions where Euclidean would need thousands.
§Which Model Should I Use?
| Task | Model | Why |
|---|---|---|
| Learning embeddings | LorentzModel | Stable gradients everywhere |
| Visualization | PoincareBall | Bounded, intuitive |
| Mixed hierarchy + similarity | Consider mixed-curvature | Best of both |
§Why Hyperbolic?
| Year | Observation | Implication |
|---|---|---|
| 2017 | Trees embed poorly in Euclidean space | Need exponential dims |
| 2017 | Hyperbolic space has exponential volume | Trees embed naturally |
| 2018 | Lorentz model more stable | Better for optimization |
| 2021 | Mixed-curvature spaces | Best of both worlds |
Key insight: Hyperbolic space has exponentially growing volume with radius, just like trees have exponentially growing nodes with depth. A 10-dimensional hyperbolic space can embed trees that would require thousands of Euclidean dimensions.
§The Two Models
| Model | Representation | Pros | Cons |
|---|---|---|---|
| Poincaré Ball | Unit ball | Intuitive, conformal | Gradients vanish at boundary |
| Lorentz (Hyperboloid) | Upper sheet of hyperboloid | Stable gradients | Less intuitive |
For learning, prefer Lorentz: gradients are well-behaved everywhere. For visualization, prefer Poincaré: it’s a bounded disk.
§Mathematical Background
The Poincaré ball model represents hyperbolic space as the interior of a unit ball with the metric:
ds² = (2/(1-||x||²))² ||dx||²As points approach the boundary (||x|| → 1), distances grow infinitely— this is how infinite hierarchical depth fits in finite Euclidean volume.
§When to Use
- Taxonomies: WordNet, Wikipedia categories
- Organizational hierarchies: Company structures, file systems
- Evolutionary trees: Phylogenetics, language families
- Social networks: Often have hierarchical community structure
§When NOT to Use
- Flat structures: No hierarchy to exploit (use Euclidean)
- Grid-like data: Images, audio (use CNN/RNN)
- Very shallow trees: Depth < 5, Euclidean often suffices
§Connection to Intrinsic Dimension
Local Intrinsic Dimensionality (LID) can help decide between hyperbolic and Euclidean embeddings:
- Low LID + hierarchical structure: Use hyperbolic (Poincaré/Lorentz)
- High LID + uniform structure: Use Euclidean (HNSW, IVF-PQ)
- Variable LID across regions: Consider mixed-curvature spaces
Research (D-Mercator, 2023) shows that networks with low intrinsic dimension in hyperbolic space exhibit high navigability—meaning greedy routing succeeds. This connects to HNSW’s small-world navigation: graphs with low effective dimension are easier to search.
See jin::lid for LID estimation utilities.
§References
- Nickel & Kiela (2017): “Poincaré Embeddings for Learning Hierarchical Representations”
- Nickel & Kiela (2018): “Learning Continuous Hierarchies in the Lorentz Model”
- Chami et al. (2019): “Hyperbolic Graph Convolutional Neural Networks”
Re-exports§
pub use lorentz::LorentzModel;
Modules§
Structs§
- Poincare
Ball - Poincaré Ball manifold.