{"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/instruction-guided-visual-masking","title":"Instruction-Guided Visual Masking","arxiv_id":"2405.19783","date":"2024-05-30","proceeding":null,"authors":["Jinliang Zheng","Jianxiong Li","Sijie Cheng","Yinan Zheng","Jiaming Li","Jihao Liu","Yu Liu","Jingjing Liu","Xianyuan Zhan"],"abstract":"Instruction following is crucial in contemporary LLM. However, when extended to multimodal setting, it often suffers from misalignment between specific textual instruction and targeted local region of an image. To achieve more accurate and nuanced multimodal instruction following, we introduce Instruction-guided Visual Masking (IVM), a new versatile visual grounding model that is compatible with diverse multimodal models, such as LMM and robot model. By constructing visual masks for instruction-irrelevant regions, IVM-enhanced multimodal models can effectively focus on task-relevant image regions to better align with complex instructions. Specifically, we design a visual masking data generation pipeline and create an IVM-Mix-1M dataset with 1 million image-instruction pairs. We further introduce a new learning technique, Discriminator Weighted Supervised Learning (DWSL) for preferential IVM training that prioritizes high-quality data samples. Experimental results on generic multimodal tasks such as VQA and embodied robotic control demonstrate the versatility of IVM, which as a plug-and-play tool, significantly boosts the performance of diverse multimodal models, yielding new state-of-the-art results across challenging multimodal benchmarks. Code, model and data are available at https://github.com/2toinf/IVM.","url_abs":"https://arxiv.org/abs/2405.19783v2","url_pdf":"https://arxiv.org/pdf/2405.19783v2.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":"instruction-guided-visual-masking","repo_url":"https://github.com/2toinf/ivm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"instruction-following","task_name":"Instruction Following"},{"task_slug":"visual-grounding","task_name":"Visual Grounding"},{"task_slug":"visual-question-answering-1","task_name":"Visual Question Answering"},{"task_slug":"visual-question-answering","task_name":"Visual Question Answering (VQA)"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[{"slug":"ivm-mix-1m","name":"IVM-Mix-1M","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/visual-question-answering-on-v-bench","task":"Visual Question Answering","dataset":"V*bench","model":"IVM-Enhanced GPT4-V","rank_in_archive_order":3,"of":5,"metrics":{"Accuracy":"81.2"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.19783","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.19783"}},"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":"deterministic:regex_extraction","url":"https://github.com/2toinf/IVM","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/2toinf/ivm","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":7,"ran_fixture":8,"ran_draft_wrong":1,"unverified":12},"by_repo_kind":{"official":{"samples":28,"ran":16,"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":"b5bf903edd1dcafd","entry":"Attention","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b5bf903edd1dcafd"}},{"code_sha256_prefix":"256eb3b402dbb02a","entry":"ConditionedMaskDecoder","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"256eb3b402dbb02a"}},{"code_sha256_prefix":"738b5dcde12052ba","entry":"LayerNorm2d","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"738b5dcde12052ba"}},{"code_sha256_prefix":"d0650d05ab2c4a12","entry":"MLP","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d0650d05ab2c4a12"}},{"code_sha256_prefix":"1da9d87f536d9241","entry":"MLPBlock","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1da9d87f536d9241"}},{"code_sha256_prefix":"7ed2e6b526e58fd3","entry":"PatchEmbed","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7ed2e6b526e58fd3"}},{"code_sha256_prefix":"2cb4a7bc53ea5022","entry":"PositionEmbeddingRandom","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2cb4a7bc53ea5022"}},{"code_sha256_prefix":"30cb45bcc9fc27d0","entry":"add_decomposed_rel_pos","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30cb45bcc9fc27d0"}},{"code_sha256_prefix":"d91fd9b31c41684e","entry":"dice_loss","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d91fd9b31c41684e"}},{"code_sha256_prefix":"733d7f0bedcb74c2","entry":"get_rel_pos","repo":"2toinf/IVM","repo_kind":"official","path":"model/sam_components/image_encoder.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/model/sam_components/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"733d7f0bedcb74c2"}},{"code_sha256_prefix":"5cf5ba2c32195b02","entry":"get_rel_pos","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5cf5ba2c32195b02"}},{"code_sha256_prefix":"eeb6e13ac80aed43","entry":"llavaTextPreprocess","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"eeb6e13ac80aed43"}},{"code_sha256_prefix":"1033e9116b1e2573","entry":"sigmoid_ce_loss","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1033e9116b1e2573"}},{"code_sha256_prefix":"89c1f2e801f0e941","entry":"window_partition","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"89c1f2e801f0e941"}},{"code_sha256_prefix":"105fa08885dc36cc","entry":"window_partition","repo":"2toinf/IVM","repo_kind":"official","path":"model/sam_components/image_encoder.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/model/sam_components/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"105fa08885dc36cc"}},{"code_sha256_prefix":"3ade8cb3a2133a3f","entry":"window_unpartition","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3ade8cb3a2133a3f"}},{"code_sha256_prefix":"2dcf225b97d045ae","entry":"Block","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2dcf225b97d045ae"}},{"code_sha256_prefix":"28446a46dff45e88","entry":"IVM","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"28446a46dff45e88"}},{"code_sha256_prefix":"d930ca853fbfe859","entry":"ImageEncoderViT","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d930ca853fbfe859"}},{"code_sha256_prefix":"d6c5069b5e0fd935","entry":"LLaVAEncoder","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d6c5069b5e0fd935"}},{"code_sha256_prefix":"718ac29e8d9232bb","entry":"TwoWayAttentionBlock","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"718ac29e8d9232bb"}},{"code_sha256_prefix":"227d8c19ab9e7cbb","entry":"TwoWayTransformer","repo":"2toinf/ivm","repo_kind":"official","path":"model/IVM.py","file_url":"https://github.com/2toinf/ivm/blob/HEAD/model/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"227d8c19ab9e7cbb"}},{"code_sha256_prefix":"3a06fee7a1f09df9","entry":"apply_mask_to_rgb","repo":"2toinf/IVM","repo_kind":"official","path":"model/llava_encoder.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/model/llava_encoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3a06fee7a1f09df9"}},{"code_sha256_prefix":"58ede5faa9cd2f1c","entry":"auto_postprocess","repo":"2toinf/IVM","repo_kind":"official","path":"IVM.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"58ede5faa9cd2f1c"}},{"code_sha256_prefix":"1f0e4db7df0cd3fe","entry":"forward_batch","repo":"2toinf/IVM","repo_kind":"official","path":"IVM.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/IVM.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1f0e4db7df0cd3fe"}},{"code_sha256_prefix":"33b1f0add9c27a54","entry":"generate_boxes_mask","repo":"2toinf/IVM","repo_kind":"official","path":"utils.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"33b1f0add9c27a54"}},{"code_sha256_prefix":"7e8dcee39799a2b0","entry":"read_masks","repo":"2toinf/IVM","repo_kind":"official","path":"IVM_1M_Mix/datareader.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/IVM_1M_Mix/datareader.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7e8dcee39799a2b0"}},{"code_sha256_prefix":"27be441cc8213e52","entry":"window_unpartition","repo":"2toinf/IVM","repo_kind":"official","path":"model/sam_components/image_encoder.py","file_url":"https://github.com/2toinf/IVM/blob/HEAD/model/sam_components/image_encoder.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"27be441cc8213e52"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}