{"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/ot-vp-optimal-transport-guided-visual","title":"OT-VP: Optimal Transport-guided Visual Prompting for Test-Time Adaptation","arxiv_id":"2407.09498","date":"2024-06-12","proceeding":null,"authors":["Yunbei Zhang","Akshay Mehra","Jihun Hamm"],"abstract":"Vision Transformers (ViTs) have demonstrated remarkable capabilities in learning representations, but their performance is compromised when applied to unseen domains. Previous methods either engage in prompt learning during the training phase or modify model parameters at test time through entropy minimization. The former often overlooks unlabeled target data, while the latter doesn't fully address domain shifts. In this work, our approach, Optimal Transport-guided Test-Time Visual Prompting (OT-VP), handles these problems by leveraging prompt learning at test time to align the target and source domains without accessing the training process or altering pre-trained model parameters. This method involves learning a universal visual prompt for the target domain by optimizing the Optimal Transport distance.OT-VP, with only four learned prompt tokens, exceeds state-of-the-art performance across three stylistic datasets-PACS, VLCS, OfficeHome, and one corrupted dataset ImageNet-C. Additionally, OT-VP operates efficiently, both in terms of memory and computation, and is adaptable for extension to online settings.","url_abs":"https://arxiv.org/abs/2407.09498v2","url_pdf":"https://arxiv.org/pdf/2407.09498v2.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":"ot-vp-optimal-transport-guided-visual","repo_url":"https://github.com/zybeich/ot-vp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"prompt-learning","task_name":"Prompt Learning"},{"task_slug":"test-time-adaptation","task_name":"Test-time Adaptation"},{"task_slug":"visual-prompting","task_name":"Visual Prompting"}],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2407.09498","atlas_url":"https://app.syntology.ai/?focus=2407.09498","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.09498"}},"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/zybeich/ot-vp","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran":9,"unverified":4},"by_repo_kind":{"official":{"samples":16,"ran":12,"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":"ce7990d7ad5821ff","entry":"Classifier","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/networks.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/networks.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ce7990d7ad5821ff"}},{"code_sha256_prefix":"289f47229057c748","entry":"compute_conditional_wd","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/adapt_algorithms.py","link_basis":"first_harvest_node","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":"289f47229057c748"}},{"code_sha256_prefix":"09762c09de098b26","entry":"configure_model","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/adapt_algorithms.py","link_basis":"first_harvest_node","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":"09762c09de098b26"}},{"code_sha256_prefix":"8722522e3721ebfe","entry":"dataloader","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/torchmisc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/torchmisc.py","link_basis":"first_harvest_node","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":"8722522e3721ebfe"}},{"code_sha256_prefix":"53fac8d8d949e72b","entry":"get_test_records","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/model_selection.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/model_selection.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"53fac8d8d949e72b"}},{"code_sha256_prefix":"b5becb520f35423a","entry":"grad_reverse","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/torchmisc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/torchmisc.py","link_basis":"plan_row","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":"b5becb520f35423a"}},{"code_sha256_prefix":"71a3a61ceed99bf3","entry":"hashable","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/query.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"71a3a61ceed99bf3"}},{"code_sha256_prefix":"1fdaff04251a0d51","entry":"l2_between_dicts","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/misc.py","link_basis":"first_harvest_node","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":"1fdaff04251a0d51"}},{"code_sha256_prefix":"2f8af5779e1edcb6","entry":"make_selector_fn","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/query.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":"2f8af5779e1edcb6"}},{"code_sha256_prefix":"3cb172d2f57f12cf","entry":"make_weights_for_balanced_classes","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/misc.py","link_basis":"first_harvest_node","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":"3cb172d2f57f12cf"}},{"code_sha256_prefix":"d3981d403538b1d3","entry":"net_dist","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/torchmisc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/torchmisc.py","link_basis":"first_harvest_node","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":"d3981d403538b1d3"}},{"code_sha256_prefix":"196cab71d7129d62","entry":"remove_batch_norm_from_resnet","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/networks.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/networks.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":"196cab71d7129d62"}},{"code_sha256_prefix":"b0bc80b1655a6802","entry":"get_algorithm_class","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/adapt_algorithms.py","link_basis":"plan_row","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":"b0bc80b1655a6802"}},{"code_sha256_prefix":"d0ea85d74c20dea9","entry":"get_dataset_class","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/datasets.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/datasets.py","link_basis":"plan_row","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":"d0ea85d74c20dea9"}},{"code_sha256_prefix":"73f32252eedba6a4","entry":"num_environments","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/datasets.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/datasets.py","link_basis":"plan_row","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":"73f32252eedba6a4"}},{"code_sha256_prefix":"6fe6cf9070a01da7","entry":"print_row","repo":"zybeich/ot-vp","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/zybeich/ot-vp/blob/HEAD/domainbed/lib/misc.py","link_basis":"first_harvest_node","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":"6fe6cf9070a01da7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}