Riemannian Geometry: Geodesics, Exponential Maps and Why Trees Prefer Hyperbolic Space
Published:
The metric is the only input
A smooth manifold has tangent spaces but no way to measure anything in them. A Riemannian metric $g$ supplies one: a positive-definite inner product $g_p(\cdot,\cdot)$ on $T_pM$ for each $p$, depending smoothly on $p$. In coordinates it is a symmetric positive-definite matrix field \(g_{ij}(x)\) — the first fundamental form of the curvature post, promoted to a definition rather than inherited from an ambient space.
Everything else follows. The length of a curve $\gamma:[0,1]\to M$ is
and the distance between two points is \(d(p,q) = \inf\\{L(\gamma) : \gamma(0)=p,\ \gamma(1)=q\\}\). Angles come from $g$ the same way they do in flat space, and the volume element is \(\sqrt{\det g_{ij}}\,dx\).
Geodesics
A geodesic is a constant-speed curve that is locally length-minimising: every sufficiently short segment of it is the shortest path between its endpoints. Equivalently it satisfies
where the Christoffel symbols \(\Gamma^k_{ij}\) are built from first derivatives of $g$. The equation says the acceleration has no component inside the tangent space — the curve is as straight as the manifold permits.
“Locally” is doing real work. On the sphere, the geodesics are great circles, and a great-circle arc of $200^\circ$ is a geodesic but is emphatically not the shortest route; the complementary $160^\circ$ arc is. Geodesics are also not unique in general: antipodal points on a sphere are joined by infinitely many.
Exponential and logarithmic maps
Given $p \in M$ and $v \in T_pM$, let $\gamma_v$ be the unique geodesic with $\gamma_v(0)=p$, $\dot\gamma_v(0)=v$. Then
$\exp_p$ takes a tangent vector — a flat, linear object you can do arithmetic with — and returns a point on the manifold, travelling a distance $\lVert v\rVert_g$ in the direction $v$. $\log_p(q)$ returns the initial velocity needed to reach $q$. Together they are the standard device for optimisation on manifolds: pull the problem into $T_pM$, take a Euclidean step, push back with $\exp$. The inverse only exists locally — on the unit sphere the injectivity radius is $\pi$, and beyond that geodesics start colliding.
On the unit sphere $S^{n-1}$ the maps are explicit: $\exp_p(v) = \cos(\lVert v\rVert)\,p + \sin(\lVert v\rVert)\,v/\lVert v\rVert$. Feed that the tangent direction toward $q$ and you get spherical linear interpolation:
SLERP is not a heuristic for interpolating unit vectors, it is \(\exp_p\\!\big(t\log_p(q)\big)\) written out. It matters because linear interpolation shrinks: the midpoint of two unit vectors has norm $\cos(\Omega/2)$, so at $\Omega = 60^\circ$ the lerped midpoint has norm $0.866$ and at $\Omega = 120^\circ$ only $0.5$ — halfway between two latents, at half the radius, in a region the model never saw during training.
Hyperbolic space and the volume argument
Hyperbolic space $\mathbb{H}^d$ has constant negative curvature. The Poincaré ball model puts it on the open unit ball with the conformal metric $g_x = \lambda_x^2\,g^{\mathrm{E}}$, $\lambda_x = 2/(1-\lVert x\rVert^2)$, giving
The metric blows up near the boundary, so the rim is infinitely far away and there is unlimited room out there. Quantitatively, a disc of radius $r$ in $\mathbb{H}^2$ has area $2\pi(\cosh r - 1)$, against $\pi r^2$ in the plane:
| $r$ | Hyperbolic area | Euclidean area | Ratio |
|---|---|---|---|
| $2$ | $17.36$ | $12.57$ | $1.4$ |
| $5$ | $460.0$ | $78.54$ | $5.9$ |
| $10$ | $69{,}193$ | $314.2$ | $220$ |
This is what Poincaré embeddings exploit for taxonomies such as WordNet, reaching better reconstruction with a handful of hyperbolic dimensions than Euclidean embeddings manage with far more; hyperbolic neural networks and hyperbolic GNNs extend the layers themselves to the manifold.
Recap
- A Riemannian metric is a smoothly varying inner product on tangent spaces; lengths, angles, distances and volume all derive from it.
- Geodesics solve \(\ddot\gamma^k + \Gamma^k_{ij}\dot\gamma^i\dot\gamma^j = 0\) and are locally, not globally, length-minimising.
- \(\exp_p(v) = \gamma_v(1)\) maps tangent vectors to points; \(\log_p\) inverts it near \(p\). Riemannian optimisation is: \(\log\), Euclidean step, \(\exp\).
- SLERP is \(\exp_p(t\log_p q)\) on the sphere; linear interpolation shrinks norms by \(\cos(\Omega/2)\) at the midpoint.
- Ball volume grows like \(e^r\) in hyperbolic space versus \(r^d\) in Euclidean space, matching the \(b^r\) growth of a tree — hence low-distortion hierarchy embeddings.
References
- do Carmo, M. P. Riemannian Geometry. Birkhäuser, 1992.
- Shoemake, K. Animating Rotation with Quaternion Curves. SIGGRAPH 1985.
- Sarkar, R. Low Distortion Delaunay Embedding of Trees in Hyperbolic Plane. Graph Drawing 2011.
- Nickel, M., & Kiela, D. Poincaré Embeddings for Learning Hierarchical Representations. NeurIPS 2017.
- Ganea, O., Bécigneul, G., & Hofmann, T. Hyperbolic Neural Networks. NeurIPS 2018.
- Chami, I., Ying, R., Ré, C., & Leskovec, J. Hyperbolic Graph Convolutional Neural Networks. NeurIPS 2019.
