Category-level Text-to-Image Retrieval Improved: Bridging the Domain Gap with Diffusion Models and Vision Encoders

Faizan Farooq Khan, Vladan Stojnic, Zakaria Laskar, Mohamed Elhoseiny, Giorgos ToliasarXiv 2025

Abstract

This work explores text-to-image retrieval for queries that specify or describe a semantic category. While vision-and-language models (VLMs) like CLIP offer a straightforward open-vocabulary solution, they map text and images to distant regions in the representation space, limiting retrieval performance. To bridge this modality gap, we propose a two-step approach. First, we transform the text query into a visual query using a generative diffusion model. Then, we estimate image-to-image similarity with a vision model. Additionally, we introduce an aggregation network that combines multiple generated images into a single vector representation and fuses similarity scores across both query modalities. Our approach leverages advancements in vision encoders, VLMs, and text-to-image generation models. Extensive evaluations show that it consistently outperforms retrieval methods relying solely on text queries.

Introduction

Category-level text-to-image retrieval involves finding all relevant images in a database given a semantic query, such as "dog" or a descriptive phrase like "a hammerhead shark." While Vision-Language Models (VLMs) like CLIP provide a standard "open-vocabulary" solution, they suffer from a fundamental "modality gap." Even when text and images are mapped to a shared embedding space, they occupy distinct regions, making direct cross-modal comparison less accurate than intra-modal (image-to-image) matching.

This paper introduces CLETIR (Category-Level Text-to-Image Retrieval), which addresses this gap by using Generative Diffusion Models (GDMs) to "visualize" text queries. By generating synthetic images of a category and performing image-to-image matching with a high-performance vision-only model (DINOv2), the proposed method consistently outperforms standard cross-modal retrieval across 15 diverse benchmarks.

Methodology

The CLETIR framework follows a multi-stage pipeline designed to bridge the modality gap through query visualization and similarity fusion.

Overview of the CLETIR framework, illustrating the two-step pipeline from text query to hybrid similarity scoring.
  1. Query Visualization: The text query $y$ is processed by a GDM (e.g., Stable Diffusion, FLUX) to generate $k$ synthetic images. Varying the generation seed allows the model to capture diverse visual "modes" of the target category.
  2. Similarity Fusion:
    • Cross-Modal: A standard VLM (CLIP or SigLIP) calculates similarity between the original text and database images.
  3. Intra-Modal: A specialized Vision Model (VM), specifically DINOv2, extracts features from both the $k$ generated images and the database images.
  4. Learnable Aggregator: To combine multiple generated images, the authors employ a Symmetric Self-Attention network. This network weights generated images based on their representativeness of the category "consensus" without distorting the underlying feature space.
  5. Hybrid Scoring: The final retrieval score is a weighted combination of cross-modal and intra-modal similarities, controlled by a learned parameter $\lambda$.

Experimental Results

The method was evaluated on 15 benchmarks, ranging from general scenes (ImageNet, Places365) to fine-grained categories (Oxford Pets, Stanford Cars) and specialized domains (remote sensing, video frames).

Performance Gains

CLETIR consistently outperforms text-only CLIP baselines. For instance, on PASCAL VOC, it achieved a Mean Precision of 96.1, significantly higher than previous specialized methods (92.1). The use of multiple generators (e.g., Stable Diffusion + FLUX) further enhances performance by capturing a broader range of visual attributes.

Mean Average Precision (mAP) results showing improvements as the number of generated query images ($k$) increases and when combining multiple diffusion models.

Robustness and Zero-Shot Capabilities

In robustness tests using ImageNet-C, CLETIR showed superior resilience to image corruptions (noise, blur). At peak corruption levels, the performance drop for CLETIR (23.5%) was notably smaller than the text-only baseline (30.9%). Furthermore, in "Description-only" tasks where category names are hidden, the GDM's ability to synthesize visual features from descriptions allowed DINOv2 to match images more effectively than CLIP's text encoder.

Discussion and Conclusion

The core insight of this work is that intra-modal matching using vision-only models is inherently more powerful than cross-modal matching, provided the query can be accurately translated into the visual domain. While effective, the approach is currently limited by GDM "hallucinations"—where failure to generate key diagnostic features can lead to sub-optimal retrieval—and the computational latency of image generation at query time. Future work may involve retrieval-augmented generation to further close the gap between synthetic and real visual queries.

Summary updated

BibTeX
@misc{khan2025category,
  author = {Faizan Farooq Khan and Vladan Stojnic and Zakaria Laskar and Mohamed Elhoseiny and Giorgos Tolias},
  title = {{Category-level Text-to-Image Retrieval Improved: Bridging the Domain Gap with Diffusion Models and Vision Encoders}},
  year = {2025},
  eprint = {2509.00177},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.00177},
}
Figure