{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/efficient-token-guided-image-text-retrieval","title":"Efficient Token-Guided Image-Text Retrieval with Consistent Multimodal Contrastive Training","arxiv_id":"2306.08789","date":"2023-06-15","proceeding":null,"authors":["Chong Liu","Yuqi Zhang","Hongsong Wang","Weihua Chen","Fan Wang","Yan Huang","Yi-Dong Shen","Liang Wang"],"abstract":"Image-text retrieval is a central problem for understanding the semantic relationship between vision and language, and serves as the basis for various visual and language tasks. Most previous works either simply learn coarse-grained representations of the overall image and text, or elaborately establish the correspondence between image regions or pixels and text words. However, the close relations between coarse- and fine-grained representations for each modality are important for image-text retrieval but almost neglected. As a result, such previous works inevitably suffer from low retrieval accuracy or heavy computational cost. In this work, we address image-text retrieval from a novel perspective by combining coarse- and fine-grained representation learning into a unified framework. This framework is consistent with human cognition, as humans simultaneously pay attention to the entire sample and regional elements to understand the semantic content. To this end, a Token-Guided Dual Transformer (TGDT) architecture which consists of two homogeneous branches for image and text modalities, respectively, is proposed for image-text retrieval. The TGDT incorporates both coarse- and fine-grained retrievals into a unified framework and beneficially leverages the advantages of both retrieval approaches. A novel training objective called Consistent Multimodal Contrastive (CMC) loss is proposed accordingly to ensure the intra- and inter-modal semantic consistencies between images and texts in the common embedding space. Equipped with a two-stage inference method based on the mixed global and local cross-modal similarity, the proposed method achieves state-of-the-art retrieval performances with extremely low inference time when compared with representative recent approaches.","url_abs":"https://arxiv.org/abs/2306.08789v1","url_pdf":"https://arxiv.org/pdf/2306.08789v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"efficient-token-guided-image-text-retrieval","repo_url":"https://github.com/lcfractal/tgdt","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-text-retrieval","task_name":"Image-text Retrieval"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"text-retrieval","task_name":"Text Retrieval"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2306.08789","atlas_url":"https://app.syntology.ai/?focus=2306.08789","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.08789"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lcfractal/tgdt","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"ran_violates":1,"ran_draft_wrong":1,"unverified":9},"by_repo_kind":{"named_in_paper":{"samples":15,"ran":6,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"f2e17288ada8cf89","entry":"cosine_sim","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"utils.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f2e17288ada8cf89"}},{"code_sha256_prefix":"6a49bab714ec6122","entry":"dot_sim","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/loss.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/loss.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a49bab714ec6122"}},{"code_sha256_prefix":"894b253f35765276","entry":"generate_square_subsequent_mask","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/utils.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/utils.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"894b253f35765276"}},{"code_sha256_prefix":"66f891f51e3bec44","entry":"get_paths","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"data.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"66f891f51e3bec44"}},{"code_sha256_prefix":"e7518699cbc1bd68","entry":"get_transform","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"data.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e7518699cbc1bd68"}},{"code_sha256_prefix":"f92e514b398e75d8","entry":"l2norm","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/utils.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/utils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f92e514b398e75d8"}},{"code_sha256_prefix":"e1d7360c5be25e25","entry":"EncoderText","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/text.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/text.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e1d7360c5be25e25"}},{"code_sha256_prefix":"f0c9a29156911331","entry":"accuracy","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"train_ft.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/train_ft.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0c9a29156911331"}},{"code_sha256_prefix":"7f3908ad08980104","entry":"cosine_sim","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/loss.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f3908ad08980104"}},{"code_sha256_prefix":"36545e75ca862270","entry":"dot_sim","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"utils.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"36545e75ca862270"}},{"code_sha256_prefix":"5a365ec8a05fffb9","entry":"encode_data","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"evaluation.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/evaluation.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5a365ec8a05fffb9"}},{"code_sha256_prefix":"6e963f0bd8b4ec0f","entry":"find_nhead","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/visual.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/visual.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6e963f0bd8b4ec0f"}},{"code_sha256_prefix":"a1ea9bbed7fcc094","entry":"get_model","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"utils.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a1ea9bbed7fcc094"}},{"code_sha256_prefix":"d9047caaedf4aadb","entry":"my_collate","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"evaluate_utils/compute_relevance.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/evaluate_utils/compute_relevance.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9047caaedf4aadb"}},{"code_sha256_prefix":"da16023b8239c604","entry":"order_sim","repo":"lcfractal/tgdt","repo_kind":"named_in_paper","path":"models/loss.py","file_url":"https://github.com/lcfractal/tgdt/blob/HEAD/models/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da16023b8239c604"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}