arXiv:2608.22665cs.CVAug 2026

Manuscript Offprint

arXiv:2608.22665

Hyperbolic Hierarchical Clustering for Visual Representation Learning

Jianan Wei, Guikun Chen, Zhiyuan Weng, Chunchao Guo, Yujia Wang, Wenguan Wang

Jianan Wei 1^{1}, Guikun Chen 1^{1}, Zhiyuan Weng 1^{1}, Chunchao Guo 2^{2}, Yujia Wang 3†^{3\dagger}, and Wenguan Wang 1^{1}

1^{1}Zhejiang University 2^{2}Tencent Hunyuan 3^{3}Zhejiang Sci-Tech University https://github.com/weijianan1/HCFormer

Abstract. We investigate the token mixer in vision backbones by revisiting clustering, one of the most classic approaches in machine learning. An effective token mixer is a fundamental component of modern vision backbones like vision Transformers, facilitating information exchange between image patches. Mainstream token mixers, which rely on convolution, attention, MLP, or their hybrids, primarily focus on navigating the trade-off between accuracy and computational cost. However, a significant drawback of these methods is their black-box nature; their encoding process is opaque and lacks interpretability. Diverging from these opaque designs, we introduce ClusterMixer, a transparent token mixer that is grounded in a clustering paradigm and interpretable by design. ClusterMixer explicitly formulates the token mixing process through a hierarchical clustering mechanism. To model the natural, tree-like relationships inherent in visual data, the clustering is performed in hyperbolic space, which is well-suited for embedding hierarchies with low distortion. Building on this innovation, we present HCFORMER, a new backbone architecture that integrates ClusterMixer with a series of meticulously designed clustering strategies to ensure robust performance across tasks. Extensive experiments demonstrate that HCFORMER consistently outperforms its counterparts across diverse tasks, including image classification, object detection, instance segmentation, and semantic segmentation. Considering its transparency and efficacy, we hope HCFORMER can facilitate a paradigm shift toward interpretable backbones.

Keywords: Representation learning · Hyperbolic geometry · Clustering

1 Introduction

Convolutional Networks (ConvNets) and Vision Transformers (ViTs) are the dominant paradigms in computer vision. ConvNets serve as the de facto standard since the pioneering success of AlexNet [31], owing to their strong inductive bias (i.e., locality and translation equivariance). Marking a paradigm shift, ViTs [16] introduce self-attention mechanisms with fewer inductive biases, enabling effective scaling

† Corresponding author: Yujia Wang.

J. Wei et al.

and superior generalization over ConvNets. Building on this, MLP-Mixer [59] conceptualizes token mixing and proposes a convolution- and attention-free alternative, which replaces the self-attention layers with spatial MLPs. This work spurs research into alternative token mixers in the vision community. For instance, VAN [21] employs convolution as the token mixer, while Uniformer [32] integrates both convolution and self-attention. Despite their incremental performance gains, the reasoning process of these models remains opaque to humans. Recently, there has been growing research interest in clustering-based vision backbones [9, 46], which can provide enhanced interpretability. Albeit promising, it has not yet fully exploited the capabilities of clustering algorithms for visual representation learning, as evidenced by their suboptimal performance, indicating a notable gap that merits further investigation.

Figure

Fig. 1: Top-1 accuracy of HCFormer and other SOTAs on ImageNet-1K [13].

In this work, we introduce an efficient token mixer based on clustering algorithms, dubbed ClusterMixer, which operates via: i) initializing data points and cluster centers based on token representations, ii) assigning data points to centers to form distinct clusters, and iii) performing token mixing based on the established clusters. Nevertheless, the direct application of ClusterMixer presents a dual challenge in terms of computational efficiency and model performance. First, it faces analogous challenges of computational complexity as self-attention and spatial MLPs, stemming from data point and cluster center counts. This efficiency limitation becomes more pronounced for vision tasks that require extensive token sets to accomplish dense prediction or high-resolution image representation. A straightforward approach is to reduce the number of cluster centers; however, it leads to an undesirable tradeoff by degrading model performance. Second, the similarity estimation of clustering algorithms is primarily conducted in Euclidean geometry [46, 52]. However, the flat geometry of Euclidean space limits its ability in modeling hierarchical relation [34], leading to distortions in the semantic distance and suboptimal performance. In other words, even if two embeddings are close in Euclidean geometry, they may be distant in the semantic hierarchy.

To bridge these gaps, we propose HCFORMER, a framework for visual representation learning that enhances ClusterMixer via two meticulously designed strategies: i) hierarchical clustering. Here input patches are partitioned into several non-overlapping windows, with token mixing restricted to local windows to reduce computational complexity in clustering operations. To capture global contextual information, we further apply a mixing operation over these windows, which introduces only minimal computational overhead. ii) hyperbolic hierarchical clustering. Unlike Euclidean geometry, which excels in flat, simple structures, hyperbolic geometry naturally models hierarchical relationships as a continuous analog of trees [29], thereby better capturing abstract and complex semantics.

To leverage these complementary properties, we extend the ClusterMixer to use Euclidean space for fine-grained patch-level clustering and hyperbolic space for abstract window-level clustering.

Despite its attractive properties (e.g., grasping abstract and complex semantic relationships), hyperbolic geometry is numerically unstable, whereas Euclidean geometry demonstrates superior performance and stability in simple scenarios. Besides, the operations defined in hyperbolic geometry incur greater computational overhead compared to their Euclidean counterparts. To address these trade-offs, we extend the ClusterMixer to perform clustering across dual geometries: Euclidean similarity is computed at the finer-grained and computationally demanding patch-level, while hyperbolic similarity is estimated at the abstract and computationally efficient window-level.

HCFORMER enjoys several desirable virtues: First, efficiency. Based on the proposed clustering strategies, HCFORMER can reduce the quadratic computational complexity associated with increasing data points and cluster centers to a linear one. This reduction in complexity is especially beneficial for downstream tasks, e.g., semantic segmentation and object detection, which facilitates the use of a greater number of cluster centers for improved performance. Second, holistic hierarchy. HCFORMER conducts ClusterMixer in both Euclidean and Hyperbolic geometries, enabling the model to handle similarity estimation across diverse scenarios, from simple (e.g., flat relation) to complex (e.g., tree-like structure). Third, flexibility. Owing to its non-parametric and clustering-based design, ClusterMixer enables HCFORMER to be effectively applied to various downstream tasks (see §4).

For comprehensive evaluation, HCFORMER is benchmarked on three datasets covering diverse application scenarios, including ImageNet-1K [13] for image classification, ADE20K [76] for semantic segmentation, COCO [38] for instance detection and segmentation. In §4.1, by training from scratch, HCFORMER outperforms mainstream counterparts with similar parameter counts, e.g., exceeding ResNet-50 by 2.6% and Swin-Tiny by 1.1% in top-1 accuracy. Notably, HCFORMER also improves over prior clustering-based backbones across model scales, with gains of 1.2–3.3% over CoC [46] and 0.3–2.4% over FEC [9]. In §4.2, as the backbone with Semantic FPN [30], HCFORMER achieves performance gains of 0.7%~2.8% mIoU for semantic segmentation. In §4.3, HCFORMER integrated with Mask R-CNN [23] demonstrates competitive performance for instance detection and segmentation. These results are impressive for a clustering-based backbone like HCFORMER, which also enjoys built-in interpretability.

References (77)