{"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/test-time-adaptation-via-self-training-with","title":"Test-Time Adaptation via Self-Training with Nearest Neighbor Information","arxiv_id":"2207.10792","date":"2022-07-08","proceeding":null,"authors":["Minguk Jang","Sae-Young Chung","Hye Won Chung"],"abstract":"Test-time adaptation (TTA) aims to adapt a trained classifier using online unlabeled test data only, without any information related to the training procedure. Most existing TTA methods adapt the trained classifier using the classifier's prediction on the test data as pseudo-label. However, under test-time domain shift, accuracy of the pseudo labels cannot be guaranteed, and thus the TTA methods often encounter performance degradation at the adapted classifier. To overcome this limitation, we propose a novel test-time adaptation method, called Test-time Adaptation via Self-Training with nearest neighbor information (TAST), which is composed of the following procedures: (1) adds trainable adaptation modules on top of the trained feature extractor; (2) newly defines a pseudo-label distribution for the test data by using the nearest neighbor information; (3) trains these modules only a few times during test time to match the nearest neighbor-based pseudo label distribution and a prototype-based class distribution for the test data; and (4) predicts the label of test data using the average predicted class distribution from these modules. The pseudo-label generation is based on the basic intuition that a test data and its nearest neighbor in the embedding space are likely to share the same label under the domain shift. By utilizing multiple randomly initialized adaptation modules, TAST extracts useful information for the classification of the test data under the domain shift, using the nearest neighbor information. TAST showed better performance than the state-of-the-art TTA methods on two standard benchmark tasks, domain generalization, namely VLCS, PACS, OfficeHome, and TerraIncognita, and image corruption, particularly CIFAR-10/100C.","url_abs":"https://arxiv.org/abs/2207.10792v2","url_pdf":"https://arxiv.org/pdf/2207.10792v2.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":"test-time-adaptation-via-self-training-with","repo_url":"https://github.com/mingukjang/tast","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"test-time-adaptation-via-self-training-with","repo_url":"https://github.com/Claydon-Wang/OFTTA","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"pseudo-label","task_name":"Pseudo Label"},{"task_slug":"test-time-adaptation","task_name":"Test-time Adaptation"}],"methods":[{"method_slug":"test","method_name":"Test"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2207.10792","atlas_url":"https://app.syntology.ai/?focus=2207.10792","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.10792"}},"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/Claydon-Wang/OFTTA","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mingukjang/tast","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":6,"ran":7,"ran_violates":1,"unverified":5},"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":19,"samples":[{"code_sha256_prefix":"ce7990d7ad5821ff","entry":"Classifier","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/networks.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/networks.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"ce7990d7ad5821ff"}},{"code_sha256_prefix":"5d1f700db67751f1","entry":"accuracy_ent","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"5d1f700db67751f1"}},{"code_sha256_prefix":"09762c09de098b26","entry":"configure_model","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/adapt_algorithms.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":false,"mcp_get_code":{"code_sha256":"09762c09de098b26"}},{"code_sha256_prefix":"ee80cf467065076b","entry":"conv1x1","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/big_transfer.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/big_transfer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"ee80cf467065076b"}},{"code_sha256_prefix":"f01b8d3901f0b289","entry":"conv3x3","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/big_transfer.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/big_transfer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"f01b8d3901f0b289"}},{"code_sha256_prefix":"53fac8d8d949e72b","entry":"get_test_records","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/model_selection.py","file_url":"https://github.com/mingukjang/tast/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":false,"mcp_get_code":{"code_sha256":"53fac8d8d949e72b"}},{"code_sha256_prefix":"71a3a61ceed99bf3","entry":"hashable","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/mingukjang/tast/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":false,"mcp_get_code":{"code_sha256":"71a3a61ceed99bf3"}},{"code_sha256_prefix":"2f8af5779e1edcb6","entry":"make_selector_fn","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/mingukjang/tast/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":false,"mcp_get_code":{"code_sha256":"2f8af5779e1edcb6"}},{"code_sha256_prefix":"5f576ed342c48a0a","entry":"make_weights_for_balanced_classes","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/misc.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":false,"mcp_get_code":{"code_sha256":"5f576ed342c48a0a"}},{"code_sha256_prefix":"196cab71d7129d62","entry":"remove_batch_norm_from_resnet","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/networks.py","file_url":"https://github.com/mingukjang/tast/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":false,"mcp_get_code":{"code_sha256":"196cab71d7129d62"}},{"code_sha256_prefix":"e6171e29ed623a12","entry":"softmax_entropy","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"e6171e29ed623a12"}},{"code_sha256_prefix":"b5d67732e5b29f2b","entry":"softmax_entropy","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/adapt_algorithms.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":false,"mcp_get_code":{"code_sha256":"b5d67732e5b29f2b"}},{"code_sha256_prefix":"18e820e42046bc45","entry":"split_dataset","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/misc.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":false,"mcp_get_code":{"code_sha256":"18e820e42046bc45"}},{"code_sha256_prefix":"7023eb86801bb3a3","entry":"tf2th","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/big_transfer.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/big_transfer.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"7023eb86801bb3a3"}},{"code_sha256_prefix":"57634636fcd54537","entry":"generate_featurelized_loader","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"57634636fcd54537"}},{"code_sha256_prefix":"b0bc80b1655a6802","entry":"get_algorithm_class","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/adapt_algorithms.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/adapt_algorithms.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":false,"mcp_get_code":{"code_sha256":"b0bc80b1655a6802"}},{"code_sha256_prefix":"d0ea85d74c20dea9","entry":"get_dataset_class","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/datasets.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/datasets.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":false,"mcp_get_code":{"code_sha256":"d0ea85d74c20dea9"}},{"code_sha256_prefix":"73f32252eedba6a4","entry":"num_environments","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/datasets.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/datasets.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":false,"mcp_get_code":{"code_sha256":"73f32252eedba6a4"}},{"code_sha256_prefix":"af3c9a80c8fd1f7a","entry":"print_row","repo":"mingukjang/tast","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/mingukjang/tast/blob/HEAD/domainbed/lib/misc.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":false,"mcp_get_code":{"code_sha256":"af3c9a80c8fd1f7a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}