Klein Hyperbolic Metric Learning

Yulin Zhang, Boxuan Hu, Huimin Li, Junlin HuICML 2026

Deep Metric Learning (DML) is fundamentally about teaching neural networks to map data into an embedding space where similar items cluster together and dissimilar items are pushed apart. While Euclidean (flat) space is the default, researchers have increasingly turned to hyperbolic space to represent hierarchical data—such as biological taxonomies or product categories—because its volume grows exponentially, mirroring the structure of a tree.

However, the vast majority of hyperbolic DML research has relied on the Poincaré model. While mathematically elegant, the Poincaré model has a significant structural flaw when paired with modern deep learning architectures: its shortest paths (geodesics) are curved arcs. Modern neural network backbones, particularly Vision Transformers (ViTs), rely heavily on linear projections. Forcing these linear Euclidean features onto the curved geodesics of the Poincaré model creates a "geometric misalignment," leading to representational distortion.

To resolve this, recent research introduces the Klein model as a highly effective, structurally aligned alternative for hyperbolic metric learning.

The Klein Model: Straight Lines in a Curved World

Unlike the Poincaré model, the Klein model is a projective model of hyperbolic geometry where geodesics are straight lines in the Euclidean sense. This unique property allows it to act as a bridge, offering the hierarchical embedding benefits of hyperbolic space while maintaining the linear inductive bias of modern Euclidean encoders.

To integrate the Klein model into a deep learning framework, the authors introduce several key technical innovations:

  • Einstein Gyrovector Operations: The framework is formalized using Einstein addition and scalar multiplication, providing a rigorous algebraic foundation for the embedding space.
  • Numerically Stable Distance: Standard hyperbolic distance formulas often rely on the arcosh operator, which is notorious for causing "NaN" errors and vanishing gradients during training. The authors derive a mathematically equivalent gyrovector distance using artanh, which is significantly more stable for backpropagation.
  • Linear-Projective Alignment: Because the final layer of a Transformer is a linear projection and Klein geodesics are straight lines, the output features are naturally congruent with the manifold’s shortest paths.
  • Feature Clipping: To prevent embeddings from exploding as they approach the boundary of the hyperbolic ball, a clipping technique is adapted to maintain optimization stability.

Empirical Evidence and Key Insights

The Klein model was rigorously evaluated on four standard fine-grained image classification benchmarks: CUB-200-2011, Stanford Cars, Stanford Online Products (SOP), and In-shop Clothes. The tests spanned three different Vision Transformer backbones: ViT-S, DeiT-S, and the self-supervised DINO.

Performance Gains

The Klein model consistently matched or outperformed both Poincaré and Spherical baselines across all datasets. Notably:

  • On the Stanford Cars dataset using the DINO backbone, the Klein model achieved a Recall@1 of 86.9%, representing a 3.4% absolute improvement over the Poincaré model.
  • On the In-shop Clothes dataset, the Klein-ViT-S model reached a Recall@1 of 93.5%, setting a high standard for large-scale retrieval tasks.
  • Zero Parameter Cost: Crucially, these performance gains were achieved without increasing the number of parameters or computational complexity. It serves as a "free" upgrade simply by swapping the geometry of the output space.

Why Does It Work Better?

The paper highlights several reasons for the Klein model's success:

  1. Empirical Proof of Alignment: Using a metric called Geodesic Deviation Error (GDE), the authors demonstrated that the Klein model preserves the linear structure of Euclidean features 97.73% of the time, whereas the Poincaré model forces significant bending.
  2. Smoother Optimization: The Klein model exhibits a more gradual spatial expansion compared to the Poincaré model. This less aggressive metric expansion creates a smoother gradient landscape, making it easier for the optimizer to navigate.
  3. Stability over Curvature: The findings suggest that the structural alignment between the manifold and the encoder is often more critical to performance than the specific curvature of the space itself.

Limitations and Future Directions

While the Klein model establishes a new standard for hyperbolic DML, there is room for further exploration. Currently, the model relies on a fixed curvature parameter. Because real-world datasets possess varying hierarchical depths, introducing learnable curvature could yield even better representations.

Furthermore, because the Klein model is highly compatible with linear operations, mature loss functions originally designed for Euclidean space (such as ArcFace or CosFace) could potentially be adapted with minimal effort. Finally, while this research focuses on computer vision, the linear-friendly properties of the Klein model make it a highly promising geometric prior for Natural Language Processing (NLP) and Graph Neural Networks (GNNs), where linear transformations are equally dominant.

Summary updated

BibTeX
@inproceedings{zhang2026klein,
  author = {Yulin Zhang and Boxuan Hu and Huimin Li and Junlin Hu},
  title = {{Klein Hyperbolic Metric Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=eTcQP26TD0},
}
Figure