NeighborRetr: Balancing Hub Centrality in Cross-Modal Retrieval

Zengrong Lin, Zheng Wang, Tianwen Qian, Pan Mu, Sixian Chan, Cong Bai · OpenReview

Abstract

Cross-modal retrieval aims to bridge the semantic gap between different modalities, such as visual and textual data, enabling accurate retrieval across them. Despite significant advancements with models like CLIP that align cross-modal representations, a persistent challenge remains: the hubness problem, where a small subset of samples (hubs) dominate as nearest neighbors, leading to biased representations and degraded retrieval accuracy. Existing methods often mitigate hubness through post-hoc normalization techniques, relying on prior data distributions that may not be practical in real-world scenarios. In this paper, we directly mitigate hubness during training and introduce NeighborRetr, a novel method that effectively balances the learning of hubs and adaptively adjusts the relations of various kinds of neighbors. Our approach not only mitigates the hubness problem but also enhances retrieval performance, achieving state-of-the-art results on multiple cross-modal retrieval benchmarks. Furthermore, NeighborRetr demonstrates robust generalization to new domains with substantial distribution shifts, highlighting its effectiveness in real-world applications.

The Hubness Problem in Cross-Modal Retrieval

In cross-modal retrieval tasks, such as searching for a video using a text description, models like CLIP map different data types into a shared high-dimensional embedding space. However, these spaces often suffer from hubness—a phenomenon where a small subset of samples (hubs) frequently appear as the nearest neighbors to many different queries, even when they are not semantically relevant. Conversely, anti-hubs are samples that are almost never retrieved. This "popularity contest" leads to biased representations and poor retrieval accuracy.

While existing solutions often attempt to fix this after training through post-hoc normalization (e.g., QB-Norm), these methods typically require prior knowledge of the test set's data distribution. This makes them less effective in real-world scenarios where data distributions shift dynamically.

The NeighborRetr Framework

NeighborRetr addresses hubness directly during the training phase using a three-pronged strategy to create a more balanced embedding space:

  1. Centrality Weighting ($L_{Wti}$): The model utilizes a Memory Bank to track "sample centrality," measuring how much a sample acts like a hub. It then weights the contrastive loss to ensure the model prioritizes learning stable representations for these central samples.
  2. Neighbor Adjusting ($L_{Nbi}$): Recognizing that not all hubs are detrimental, NeighborRetr distinguishes between "good hubs" (semantically relevant) and "bad hubs" (noisy or mathematically sticky). It adaptively adjusts similarity scores by subtracting a centrality penalty, bringing good neighbors closer while pushing bad hubs away.
  3. Uniform Regularization ($L_{Opt}$): To elevate "anti-hubs," the authors propose a marginal constraint inspired by optimal transport. This forces the model to treat all samples as having an equal probability of being retrieved, ensuring no sample is entirely overlooked.
Overview of the NeighborRetr training framework showing the three core loss functions and memory bank architecture.

Empirical Results and Hubness Mitigation

NeighborRetr was evaluated across a wide range of benchmarks, including MSR-VTT, MSVD, and MS-COCO. The method achieved state-of-the-art (SOTA) results, such as a 49.5% R@1 on MSR-VTT (Text-to-Video), surpassing previous CLIP-based baselines.

Beyond accuracy, the method significantly mitigates the hubness problem. As shown in the frequency distributions below, standard CLIP models exhibit a heavy skew where many items are never retrieved (0 frequency) while a few hubs are retrieved hundreds of times. NeighborRetr shifts this distribution to be much more balanced and aligned with the ground truth distribution.

Comparison of k-occurrence frequency between CLIP and NeighborRetr, demonstrating the shift from a skewed to a balanced retrieval distribution.

Key Insights and Conclusion

A critical advantage of NeighborRetr is its robustness to distribution shifts. By fixing the embedding space during training rather than inference, it generalizes much better to new domains. Furthermore, because the "fix" is baked into the model weights, NeighborRetr is 300x faster during inference compared to post-hoc methods that require query banks. By distinguishing between beneficial and detrimental hubs and elevating anti-hubs, NeighborRetr provides a more equitable and accurate framework for cross-modal retrieval.

Summary updated

BibTeX
@inproceedings{lin2025neighborretr,
  author = {Zengrong Lin and Zheng Wang and Tianwen Qian and Pan Mu and Sixian Chan and Cong Bai},
  title = {{NeighborRetr: Balancing Hub Centrality in Cross-Modal Retrieval}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00865},
}
Figure