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.
- 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.
- 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.
- Pairwise Cross-Entropy Loss: The authors adapt the pairwise cross-entropy loss—common in self-supervised learning like SimCLR—to operate with hyperbolic distances.
- 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.
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.
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