Abstract
Achieving high accuracy in image-text retrieval often comes at the cost of significant computational overhead during inference. This paper introduces the Token-Guided Dual Transformer (TGDT), a framework designed to bridge the gap between efficient coarse-grained retrieval and precise fine-grained matching. By leveraging a novel Consistent Multimodal Contrastive (CMC) loss and a two-stage inference strategy, TGDT achieves state-of-the-art performance while reducing inference times from hundreds of minutes to mere seconds.
Introduction
Image-text retrieval—the task of matching visual content with descriptive text—is a cornerstone of modern multimodal search engines. Historically, models have faced a trade-off between speed and precision. Coarse-grained models, which represent images and text as single global vectors, offer high speed but lack the nuance to capture complex relationships. Conversely, fine-grained models utilize cross-attention mechanisms to compare individual image regions and words, providing high accuracy at the cost of extreme computational latency. This paper presents TGDT, a framework that integrates global and local features to provide a scalable, high-performance solution for large-scale retrieval.
The Challenge: The Semantic Gap
The primary hurdle in retrieval is the "semantic gap" between visual and textual modalities.
- Coarse-grained retrieval models are efficient for large-scale databases because they rely on simple distance metrics between global embeddings. However, they often fail to capture specific object-word interactions.
- Fine-grained retrieval models excel at understanding these interactions but are impractical for real-world applications. Because they require cross-modal attention for every possible pair in a database, the inference time scales poorly as the dataset grows.
Methodology
Token-Guided Dual Transformer (TGDT)
The TGDT architecture utilizes a dual-branch approach. It employs a vision transformer (extracting features from regions identified by Faster R-CNN) and a text transformer (based on BERT). Unlike traditional models, TGDT simultaneously learns global features for the entire sample and local features for individual tokens (objects and words). This dual-feature approach allows the model to mimic human cognition by processing both the overall scene and specific details concurrently.
Consistent Multimodal Contrastive (CMC) Loss
A key innovation of this work is the CMC loss. Standard contrastive training typically focuses on aligning matching image-text pairs across modalities. CMC loss extends this by enforcing intra-modal consistency. It ensures that the relative distances between images in the visual embedding space are consistent with the distances between their corresponding captions in the textual space. This creates a more organized and robust common embedding space, improving the model's ability to generalize to unseen data.
Two-Stage Inference Strategy
To maximize efficiency, the authors implement a "global-then-local" retrieval process:
- Stage 1 (Global Search): A rapid search is performed using global features to identify the top-K candidates (e.g., the top 100 matches).
- Stage 2 (Local Re-ranking): The model applies precise local feature matching only to these top-K candidates. This strategy filters out 99% of irrelevant data quickly, allowing the computationally expensive fine-grained logic to focus only on the most promising matches.
Experimental Evaluation
Datasets
The framework was evaluated on the Flickr30K and MS-COCO (1K and 5K splits) benchmarks. These datasets represent the standard for measuring the effectiveness of image-text retrieval systems.
Results and Efficiency
The TGDT-GL model demonstrated a remarkable balance of speed and accuracy:
- Speed: On the Flickr30K dataset, TGDT-GL completed retrieval tasks in seconds. In comparison, the state-of-the-art VinVL model required hundreds of minutes on identical hardware.
- Accuracy: TGDT-GL achieved a Recall@1 (R@1) of 77.4% for text-to-image retrieval on Flickr30K, outperforming several significantly larger pre-trained models.
- Ablation Studies: Results confirmed that both the CMC loss and the joint global-local retrieval strategy were critical to the model's success; removing either component led to a significant drop in performance.
Conclusion and Future Work
TGDT successfully addresses the efficiency-accuracy trade-off in image-text retrieval. By combining global-local feature learning with a consistency-focused loss function, the model provides a practical solution for large-scale deployment.
A current limitation is the reliance on a frozen Faster R-CNN backbone for region extraction, which may limit the model's ability to learn novel visual features. Future research will focus on jointly training the visual backbone with the retrieval framework to further optimize the system for the nuances of multimodal matching.
Summary updated