Embedding trees in hyperbolic space, because flat earth is wrong for hierarchies
A PyTorch implementation of Nickel & Kiela's NIPS 2017 paper that learns hierarchical representations in Poincaré ball space instead of Euclidean space.

What it does
This repo implements Poincaré embeddings, which represent hierarchical data (like WordNet’s noun taxonomy) in hyperbolic rather than Euclidean space. The key insight: tree-like structures need exponentially more dimensions to embed faithfully in flat space, but hyperbolic geometry has room to spare. You get a PyTorch implementation with async multithreaded SGD, plus ready-made scripts to reproduce the paper’s WordNet mammals and full noun hierarchy results.
The interesting bit
The geometry itself is the trick. In Poincaré ball space, distances grow exponentially as you approach the boundary, so the model naturally learns to place root nodes near the center and leaf nodes near the edge. No explicit tree encoding required — the metric does the work.
Key highlights
- Reproduces the NIPS 2017 paper out of the box with
train-mammals.shandtrain-nouns.sh - Includes transitive closure generation for WordNet hierarchies via NLTK
- Async SGD with configurable thread count; conservative default (2 threads) runs on modest hardware
- Hyperparameters to reproduce both 10-dimensional embeddings and MAP results are documented in the scripts
- Straightforward conda environment setup with provided
environment.yml
Caveats
- Licensed CC-BY-NC 4.0, so no commercial use without negotiating with Facebook Research
- README contains a typo (
NHTREADSinstead ofNTHREADS) that suggests limited recent maintenance - No topics, no CI badges, no tests visible — this is research code, not a product
Verdict
Worth a look if you’re working on hierarchical representation learning or need a baseline for hyperbolic embeddings. Skip it if you need production-grade tooling or a permissive license; this is a paper implementation that does exactly what it says and little more.