NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Hyperbolic Vision Transformers: Combining Improvements in Metric Learning

Aleksandr Ermolov, Leyla Mirvakhabova, Valentin Khrulkov, Nicu Sebe, Ivan V. Oseledets

Abstract

This paper introduces Hyperbolic Vision Transformers (Hyp-ViT), a novel framework for metric learning that maps Vision Transformer (ViT) embeddings into hyperbolic space, specifically the Poincaré ball. By leveraging the hierarchical representational power of hyperbolic geometry and a modified pairwise cross-entropy loss, Hyp-ViT effectively captures the intrinsic tree-like structures of visual data. Experimental results across four major image retrieval benchmarks—CUB-200-2011, Cars-196, Stanford Online Product (SOP), and In-Shop Clothes Retrieval—demonstrate that Hyp-ViT achieves new state-of-the-art performance, significantly outperforming traditional Euclidean models.

Introduction

Metric learning aims to organize data in a space where similarity corresponds to mathematical distance. Traditionally, these embeddings reside in flat Euclidean space. However, many natural datasets, such as biological taxonomies or product hierarchies, possess an underlying tree-like structure.

Euclidean space is ill-suited for representing such hierarchies because its volume grows only polynomially with the radius, whereas the number of nodes in a hierarchy grows exponentially. This mismatch leads to high "distortion" when mapping complex data. In contrast, hyperbolic geometry features exponential volume growth, making it a superior "container" for hierarchical data. This paper proposes Hyp-ViT to exploit these geometric advantages for visual metric learning.

Methodology

The Hyp-ViT pipeline integrates three core components: a Vision Transformer backbone, a hyperbolic mapping head, and a specialized loss function.

  1. Vision Transformer (ViT) Backbone: The model utilizes a ViT-Small architecture. Unlike traditional CNNs, Transformers use self-attention to capture global context, producing features that align more naturally with hierarchical structures.
  2. Hyperbolic Mapping: The Euclidean output from the ViT is projected onto a Poincaré ball using an exponential mapping. This transformation shifts the representational space from flat to hyperbolic.
  3. Pairwise Cross-Entropy Loss: The authors adapt the pairwise cross-entropy loss—common in self-supervised learning like SimCLR—to operate with hyperbolic distances.
  4. Feature Clipping: To maintain numerical stability and avoid vanishing gradients near the boundary of the Poincaré ball, the model implements feature clipping to keep embeddings within a stable radius.
The Hyp-ViT architecture: Vision Transformer features are mapped to a Poincaré disk using an exponential mapping and optimized with pairwise cross-entropy loss.

Experimental Evaluation

The model was evaluated on four standard category-level retrieval datasets: CUB-200-2011 (bird species), Cars-196 (car models), Stanford Online Product (SOP), and In-Shop Clothes Retrieval. These datasets represent various levels of fine-grained and hierarchical complexity.

Key Results

Hyp-ViT established new records for Recall@1 across all benchmarks. Notably, it achieved 84.0% on CUB-200, a massive improvement over the previous state-of-the-art of approximately 73%. On Cars-196, the model reached 86.5% (using 384-dimensional embeddings), while SOP and In-Shop reached 85.9% and 92.5% respectively.

Performance comparison of Hyp-ViT against various baselines and spherical counterparts across four benchmark datasets.

As shown in the table above, the hyperbolic variants (Hyp-) consistently outperform their spherical (Sph-) counterparts, confirming that the choice of geometry is a critical driver of the performance gains.

Discussion and Insights

The success of Hyp-ViT highlights several key insights:

  • Geometric Synergy: There is a unique synergy between Transformers and hyperbolic geometry. Transformers produce more general features that map more naturally to hierarchical structures than those from CNNs.
  • Efficiency in Low Dimensions: Hyperbolic embeddings maintain high accuracy even at very low dimensions (e.g., 16 or 32), where Euclidean models typically see a sharp performance drop.
  • Pretraining Impact: Utilizing self-supervised pretraining (e.g., DINO) or large-scale datasets like ImageNet-21k significantly enhances the effectiveness of the hyperbolic head.

Conclusion

Hyp-ViT demonstrates that hyperbolic geometry provides a more efficient and accurate space for visual metric learning. While the current study focuses on category-level retrieval, the benefits of this approach are clear. Future research could explore multi-modal hyperbolic learning, mapping both images and text into a shared hyperbolic space to better capture complex conceptual hierarchies.

Summary updated

BibTeX
@inproceedings{ermolov2022hyperbolic,
  author = {Aleksandr Ermolov and Leyla Mirvakhabova and Valentin Khrulkov and Nicu Sebe and Ivan V. Oseledets},
  title = {{Hyperbolic Vision Transformers: Combining Improvements in Metric Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure