arXiv:2610.30912cs.CVOct 2026

Manuscript Offprint

arXiv:2610.30912

Hierarchical Fine-Grained Cross-Modal Alignment via Dynamic Granularity Discovery and Optimal Transport

Pengfeng Song, Shaozhong Zhang, Pengfei Shao

Abstract

Fine-grained image-text retrieval requires a model not only to assess global semantic consistency between an image and a text, but also to model visual evidence for local textual semantics, including objects, attributes, quantities, actions, and relations, so as to distinguish semantically similar candidates. Existing methods commonly use fixed image patches, detected regions, or text tokens as the basic matching units and then aggregate local interactions through max pooling, cross attention, or similarity accumulation. Such strategies remain limited in semantic unit construction and global matching consistency. This paper proposes a hierarchical fine-grained cross-modal alignment framework, termed HFCMA. The framework progressively transforms low-level patch and token representations into adaptive visual regions and textual phrases, and then performs structured region-phrase matching within a global retrieval scoring process. Specifically, HFCMA first adopts dynamic granularity discovery (DGD) to aggregate raw patches and tokens into semantically compact visual regions and textual phrases. It then formulates region-phrase matching as an entropy-regularized optimal transport problem, thereby estimating a structured alignment matrix under global marginal constraints. To reduce background noise and local semantic drift, HFCMA further introduces background debiasing, textual importance weighting, and prototype consistency regularization. Experiments on Flickr30K and MS-COCO show that HFCMA effectively combines dynamic semantic unit construction with OT-based structured matching under a dual-encoder retrieval framework. The resulting fine-grained score provides structured local alignment information for candidate ranking and improves the discrimination of subtle semantic differences.

Keywords: Image-text retrieval, Fine-grained cross-modal alignment, Dynamic granularity discovery, Optimal transport, Local semantic representation

1 Introduction

Large-scale image-text contrastive learning has substantially advanced visual-language representation learning. CLIP and ALIGN demonstrate that global alignment over massive image-text pairs can learn transferable multimodal representations [1, 2]. Subsequent work, including ViLBERT, LXMERT, and VL-BERT, improves cross-modal interaction through fusion-style pre-training [3–5]. OSCAR, ALBEF, and X-VLM further introduce object semantics, momentum distillation, and multi-grained visual concepts to strengthen image-text alignment [6–8]. Meanwhile, ViLT, BLIP, BLIP-2, CoCa, and SigLIP extend visual-language pre-training from region-free modeling, generative learning, frozen-encoder bridging, and loss design [9–13]. These advances have moved image-text retrieval from handcrafted features and region matching toward scalable pre-training frameworks.

Despite this progress, fine-grained image-text retrieval remains a weak aspect of current visual-language models. A global vector similarity is efficient for large-scale retrieval, but it is often insufficient when semantically similar candidates must be distinguished. For example, two images may contain the same object categories but differ in number, color, action, or spatial relation. A sentence may also describe only part of a visual scene rather than the whole image. In these cases, a retrieval model needs more reliable cross-modal correspondences at the levels of regions, attributes, and relations. Prior methods such as SCAN, VSR, UNITER, FILIP, SPARC, NAAF, CHAN, MSRM, CORA, and LAPS show that local interaction is important for improving the detailed discrimination of image-text retrieval [14–23].

Existing fine-grained approaches often build local interaction over backbone-produced patches, detector-based regions, tokens, words, or language-guided selected patches, and then design attention, graph reasoning, or similarity aggregation strategies for cross-modal matching. Although these designs improve local discrimination, the construction of matching units is still frequently constrained by fixed tokenization, external detectors, or predefined selection rules. As a result, the semantic granularity of local units may not be fully adaptive to each image-text pair. However, in real image-text pairs, a phrase may correspond to multiple adjacent patches, and a visual region may simultaneously carry object, attribute, and relation cues. If the matching units are semantically fragmented, subsequent local interaction can only partially remedy the mismatch. Recent studies on GroupViT, Slot Attention, TokenLearner, and Token Merging suggest that visual or textual representations can be adaptively organized into more compact semantic units [29–32]. This provides a different perspective for fine-grained retrieval: the matching granularity should not be treated merely as a by-product of the backbone, but should be explicitly modeled.

Local matching also requires global consistency. Max pooling and cross attention often select the most similar local counterpart independently for each element, which may overlook the joint constraint between a set of visual regions and a set of textual phrases. Optimal transport (OT) provides a principled formulation for structured set matching: given marginal distributions, all local correspondences are optimized jointly rather than independently [33, 34]. Although OT has been used in distribution alignment, word mover distance, domain adaptation, and vision-language prompt learning [35–39], how to combine dynamic semantic unit discovery with OT matching for fine-grained image-text retrieval remains under-explored.

Motivated by these observations, this paper proposes HFCMA, a hierarchical fine-grained cross-modal alignment framework. HFCMA addresses two questions: how to adaptively construct suitable visual regions and textual phrases for each image-text sample, and how to establish globally consistent region-phrase matching among these dynamic semantic units. HFCMA adopts a frozen CLIP-style dual encoder as the feature backbone. It first uses a dynamic granularity discovery module to organize patches and tokens into semantically more complete local units. It then solves a structured transport matrix with entropy-regularized OT and combines the resulting fine-grained score with the global similarity for candidate ranking.

The main contributions are summarized as follows.

  • We propose a dynamic granularity discovery mechanism for image-text retrieval, which bridges low-level patch/token representations and higher-level region-phrase semantic units, transforming fixed local matching into sample-adaptive region-phrase alignment.

  • We formulate fine-grained cross-modal matching as entropy-regularized optimal transport over the discovered semantic units, enabling region-phrase correspondences to be jointly optimized under global marginal constraints.

  • We introduce textual importance weighting, background debiasing, and prototype consistency regularization to improve the stability and discriminability of local semantic units.

  • We conduct comprehensive experiments covering standard retrieval, module ablation, matching mechanism comparison, parameter sensitivity, inference efficiency, cross-dataset transfer, and visualization, showing both the effectiveness and the applicable boundary of HFCMA.

References (52)