{"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/align-before-fuse-vision-and-language","title":"Align before Fuse: Vision and Language Representation Learning with Momentum Distillation","arxiv_id":"2107.07651","date":"2021-07-16","proceeding":"NeurIPS 2021 12","authors":["Junnan Li","Ramprasaath R. Selvaraju","Akhilesh Deepak Gotmare","Shafiq Joty","Caiming Xiong","Steven Hoi"],"abstract":"Large-scale vision and language representation learning has shown promising improvements on various vision-language tasks. Most existing methods employ a transformer-based multimodal encoder to jointly model visual tokens (region-based image features) and word tokens. Because the visual tokens and word tokens are unaligned, it is challenging for the multimodal encoder to learn image-text interactions. In this paper, we introduce a contrastive loss to ALign the image and text representations BEfore Fusing (ALBEF) them through cross-modal attention, which enables more grounded vision and language representation learning. Unlike most existing methods, our method does not require bounding box annotations nor high-resolution images. In order to improve learning from noisy web data, we propose momentum distillation, a self-training method which learns from pseudo-targets produced by a momentum model. We provide a theoretical analysis of ALBEF from a mutual information maximization perspective, showing that different training tasks can be interpreted as different ways to generate views for an image-text pair. ALBEF achieves state-of-the-art performance on multiple downstream vision-language tasks. On image-text retrieval, ALBEF outperforms methods that are pre-trained on orders of magnitude larger datasets. On VQA and NLVR$^2$, ALBEF achieves absolute improvements of 2.37% and 3.84% compared to the state-of-the-art, while enjoying faster inference speed. Code and pre-trained models are available at https://github.com/salesforce/ALBEF/.","url_abs":"https://arxiv.org/abs/2107.07651v2","url_pdf":"https://arxiv.org/pdf/2107.07651v2.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":"align-before-fuse-vision-and-language","repo_url":"https://github.com/salesforce/lavis","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"align-before-fuse-vision-and-language","repo_url":"https://github.com/salesforce/ALBEF","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"align-before-fuse-vision-and-language","repo_url":"https://github.com/amazon-research/mix-generation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"align-before-fuse-vision-and-language","repo_url":"https://github.com/facebookresearch/multimodal","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"align-before-fuse-vision-and-language","repo_url":"https://github.com/salesforce/pb-ovd","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"align-before-fuse-vision-and-language","repo_url":"https://github.com/yuliangcai2022/clumo","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"cross-modal-retrieval","task_name":"Cross-Modal Retrieval"},{"task_slug":"grounded-language-learning","task_name":"Grounded language learning"},{"task_slug":"image-text-retrieval","task_name":"Image-text Retrieval"},{"task_slug":"image-text-matching","task_name":"Image-text matching"},{"task_slug":"image-to-text-retrieval","task_name":"Image-to-Text Retrieval"},{"task_slug":"open-vocabulary-attribute-detection","task_name":"Open Vocabulary Attribute Detection"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"text-retrieval","task_name":"Text Retrieval"},{"task_slug":"visual-question-answering","task_name":"Visual Question Answering (VQA)"},{"task_slug":"visual-reasoning","task_name":"Visual Reasoning"},{"task_slug":"zero-shot-cross-modal-retrieval","task_name":"Zero-Shot Cross-Modal Retrieval"}],"methods":[{"method_slug":"albef","method_name":"ALBEF"}],"datasets_introduced":[],"methods_introduced":[{"slug":"albef","name":"ALBEF","full_name":"ALBEF"}],"results":[{"leaderboard":"/sota/cross-modal-retrieval-on-coco-2014","task":"Cross-Modal Retrieval","dataset":"COCO 2014","model":"ALBEF","rank_in_archive_order":15,"of":36,"metrics":{"Image-to-text R@1":"77.6","Image-to-text R@10":"97.2","Image-to-text R@5":"94.3","Text-to-image R@1":"60.7","Text-to-image R@10":"90.5","Text-to-image R@5":"84.3"},"uses_additional_data":true},{"leaderboard":"/sota/image-text-matching-on-commercialadsdataset","task":"Image-text matching","dataset":"CommercialAdsDataset","model":"ALBEF","rank_in_archive_order":8,"of":8,"metrics":{"ADD(S) AUC":"82.74"},"uses_additional_data":false},{"leaderboard":"/sota/image-to-text-retrieval-on-flickr30k","task":"Image-to-Text Retrieval","dataset":"Flickr30k","model":"ALBEF","rank_in_archive_order":7,"of":11,"metrics":{"Recall@1":"95.9","Recall@10":"100.0","Recall@5":"99.8"},"uses_additional_data":false},{"leaderboard":"/sota/open-vocabulary-attribute-detection-on-ovad-1","task":"Open Vocabulary Attribute Detection","dataset":"OVAD-Box benchmark","model":"ALBEF","rank_in_archive_order":5,"of":7,"metrics":{"mean average precision":"21.0 "},"uses_additional_data":true},{"leaderboard":"/sota/visual-question-answering-on-vqa-v2-test-dev","task":"Visual Question Answering (VQA)","dataset":"VQA v2 test-dev","model":"ALBEF (14M)","rank_in_archive_order":19,"of":56,"metrics":{"Accuracy":"75.84"},"uses_additional_data":false},{"leaderboard":"/sota/visual-question-answering-on-vqa-v2-test-std","task":"Visual Question Answering (VQA)","dataset":"VQA v2 test-std","model":"ALBEF (14M)","rank_in_archive_order":14,"of":38,"metrics":{"overall":"76.04"},"uses_additional_data":false},{"leaderboard":"/sota/visual-reasoning-on-nlvr2-dev","task":"Visual Reasoning","dataset":"NLVR2 Dev","model":"ALBEF (14M)","rank_in_archive_order":11,"of":15,"metrics":{"Accuracy":"83.14"},"uses_additional_data":false},{"leaderboard":"/sota/visual-reasoning-on-nlvr2-test","task":"Visual Reasoning","dataset":"NLVR2 Test","model":"ALBEF (14M)","rank_in_archive_order":10,"of":14,"metrics":{"Accuracy":"82.55"},"uses_additional_data":false},{"leaderboard":"/sota/zero-shot-cross-modal-retrieval-on-coco-2014","task":"Zero-Shot Cross-Modal Retrieval","dataset":"COCO 2014","model":"ALBEF","rank_in_archive_order":7,"of":18,"metrics":{"Image-to-text R@1":"68.7","Image-to-text R@10":"94.7","Image-to-text R@5":"89.5","Text-to-image R@1":"50.1","Text-to-image R@10":"84.5","Text-to-image R@5":"76.4"},"uses_additional_data":false},{"leaderboard":"/sota/zero-shot-cross-modal-retrieval-on-flickr30k","task":"Zero-Shot Cross-Modal Retrieval","dataset":"Flickr30k","model":"ALBEF","rank_in_archive_order":10,"of":22,"metrics":{"Image-to-text R@1":"90.5","Image-to-text R@10":"99.7","Image-to-text R@5":"98.8","Text-to-image R@1":"76.8","Text-to-image R@10":"96.7","Text-to-image R@5":"93.7"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2107.07651","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2107.07651"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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/salesforce/lavis","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/salesforce/pb-ovd","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/amazon-research/mix-generation","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yuliangcai2022/clumo","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/salesforce/ALBEF","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/multimodal","reach":null}],"summary":{"ran_draft_wrong":1,"ran_fixture":2,"unverified":2},"by_repo_kind":{"listed":{"samples":5,"ran":3,"repositories":2}},"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":3,"samples":[{"code_sha256_prefix":"0ebf6e3d4677547a","entry":"encode_image","repo":"facebookresearch/multimodal","repo_kind":"listed","path":"examples/albef/finetune_retrieval.py","file_url":"https://github.com/facebookresearch/multimodal/blob/HEAD/examples/albef/finetune_retrieval.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"0ebf6e3d4677547a"}},{"code_sha256_prefix":"e59b9b43e8146d5e","entry":"encode_text","repo":"facebookresearch/multimodal","repo_kind":"listed","path":"examples/albef/finetune_retrieval.py","file_url":"https://github.com/facebookresearch/multimodal/blob/HEAD/examples/albef/finetune_retrieval.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"e59b9b43e8146d5e"}},{"code_sha256_prefix":"c7f85279d772ea19","entry":"itm_eval","repo":"yuliangcai2022/clumo","repo_kind":"listed","path":"Retrieval.py","file_url":"https://github.com/yuliangcai2022/clumo/blob/HEAD/Retrieval.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":false,"mcp_get_code":{"code_sha256":"c7f85279d772ea19"}},{"code_sha256_prefix":"06916278a4ead58c","entry":"avg_distance","repo":"yuliangcai2022/clumo","repo_kind":"listed","path":"CLOVE.py","file_url":"https://github.com/yuliangcai2022/clumo/blob/HEAD/CLOVE.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":false,"mcp_get_code":{"code_sha256":"06916278a4ead58c"}},{"code_sha256_prefix":"73cecca9f3575f09","entry":"concat_all_gather","repo":"yuliangcai2022/clumo","repo_kind":"listed","path":"models/model_pretrain.py","file_url":"https://github.com/yuliangcai2022/clumo/blob/HEAD/models/model_pretrain.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":false,"mcp_get_code":{"code_sha256":"73cecca9f3575f09"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}