Tensor-Hyperbolic Graphs (THG) ​
THG is a Python library for building and querying knowledge graphs in hyperbolic space. It provides the geometric foundation for the SLoD operator and the memory engine's hierarchical representations.
Why hyperbolic space? ​
Knowledge is naturally hierarchical — concepts contain subconcepts, topics contain subtopics. Euclidean space cannot embed deep hierarchies without distortion because its volume grows polynomially. Hyperbolic space (the Poincaré ball model) has exponential volume growth, matching the exponential branching of tree structures.
A tree with n nodes can be embedded in the Poincaré ball with distortion O(log n) — provably optimal for tree metrics (Sarkar, 2011).
What THG provides ​
THG implements the geometric primitives needed for SLoD and memory operations:
- Poincaré ball operations — exponential and logarithmic maps, geodesic distance, Möbius addition
- Tree embedding — Sarkar's construction for placing hierarchies into hyperbolic space
- Heat kernel diffusion — scale-dependent smoothing used by the SLoD operator (Taylor and Krylov solvers)
- Graph Laplacian — spectral analysis for boundary detection
- Graph storage — node and edge management with tensor operations
These components are described in the published SLoD paper (arXiv:2603.08965) and implemented as a standalone library.
Validated results ​
Tree embedding quality ​
Using Sarkar's algorithm on test hierarchies:
| Metric | Result |
|---|---|
| Hierarchy preservation | 100% (parent always closer to root than child) |
| Distance correlation (Spearman) | 0.905 |
| Placement speed | ~30 microseconds per node |
These results are on a 15-node test tree. Larger-scale validation is ongoing.
SLoD integration ​
THG provides the geometric substrate for the SLoD experiments reported in the arXiv paper:
- Boundary recovery on synthetic hierarchies (ARI=1.00)
- WordNet consistency (82K synsets, Kendall tau=0.79)
Stack ​
- Python 3.12+, PyTorch
- geoopt for Riemannian optimization
- scipy for sparse linear algebra
- 13 test files with property-based tests
Status ​
THG is under active development. The mathematical foundations extend beyond what is published in the SLoD paper — additional theoretical results are being validated and will be published separately.
Related ​
- Semantic Level of Detail — the operator built on THG geometry
- Building Memory That Scales — how the engine uses these primitives in practice
- Manifesto — the case for hyperbolic geometry in memory systems