{"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/memo-test-time-robustness-via-adaptation-and","title":"MEMO: Test Time Robustness via Adaptation and Augmentation","arxiv_id":"2110.09506","date":"2021-10-18","proceeding":null,"authors":["Marvin Zhang","Sergey Levine","Chelsea Finn"],"abstract":"While deep neural networks can attain good accuracy on in-distribution test points, many applications require robustness even in the face of unexpected perturbations in the input, changes in the domain, or other sources of distribution shift. We study the problem of test time robustification, i.e., using the test input to improve model robustness. Recent prior works have proposed methods for test time adaptation, however, they each introduce additional assumptions, such as access to multiple test points, that prevent widespread adoption. In this work, we aim to study and devise methods that make no assumptions about the model training process and are broadly applicable at test time. We propose a simple approach that can be used in any test setting where the model is probabilistic and adaptable: when presented with a test example, perform different data augmentations on the data point, and then adapt (all of) the model parameters by minimizing the entropy of the model's average, or marginal, output distribution across the augmentations. Intuitively, this objective encourages the model to make the same prediction across different augmentations, thus enforcing the invariances encoded in these augmentations, while also maintaining confidence in its predictions. In our experiments, we evaluate two baseline ResNet models, two robust ResNet-50 models, and a robust vision transformer model, and we demonstrate that this approach achieves accuracy gains of 1-8\\% over standard model evaluation and also generally outperforms prior augmentation and adaptation strategies. For the setting in which only one test point is available, we achieve state-of-the-art results on the ImageNet-C, ImageNet-R, and, among ResNet-50 models, ImageNet-A distribution shift benchmarks.","url_abs":"https://arxiv.org/abs/2110.09506v3","url_pdf":"https://arxiv.org/pdf/2110.09506v3.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":"memo-test-time-robustness-via-adaptation-and","repo_url":"https://github.com/zhangmarvin/memo","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"memo-test-time-robustness-via-adaptation-and","repo_url":"https://github.com/kowshikthopalli/sista","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"test-time-adaptation","task_name":"Test-time Adaptation"}],"methods":[{"method_slug":"1x1-convolution","method_name":"1x1 Convolution"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"bottleneck-residual-block","method_name":"Bottleneck Residual Block"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"kaiming-initialization","method_name":"Kaiming Initialization"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"max-pooling","method_name":"Max Pooling"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-block","method_name":"Residual Block"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"test","method_name":"Test"},{"method_slug":"vision-transformer","method_name":"Vision Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2110.09506","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2110.09506"}},"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/zhangmarvin/memo","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kowshikthopalli/sista","reach":null}],"summary":{"ran_draft_wrong":11,"ran_honours":3,"unverified":4},"by_repo_kind":{"official":{"samples":3,"ran":0,"repositories":1},"listed":{"samples":15,"ran":14,"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":15,"samples":[{"code_sha256_prefix":"8483567c5466c7c8","entry":"_augmix_aug","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8483567c5466c7c8"}},{"code_sha256_prefix":"89316c660137f3f8","entry":"aug_randconv","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"89316c660137f3f8"}},{"code_sha256_prefix":"3ee3bf864db8867f","entry":"autocontrast","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3ee3bf864db8867f"}},{"code_sha256_prefix":"ca3e2158c52023d8","entry":"equalize","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ca3e2158c52023d8"}},{"code_sha256_prefix":"d6ad456eb790edde","entry":"float_parameter","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d6ad456eb790edde"}},{"code_sha256_prefix":"cce32b359dda4b20","entry":"int_parameter","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cce32b359dda4b20"}},{"code_sha256_prefix":"c9440646eb995ea0","entry":"posterize","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c9440646eb995ea0"}},{"code_sha256_prefix":"4eaeb136b1e28c9e","entry":"rand_lvl","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4eaeb136b1e28c9e"}},{"code_sha256_prefix":"344ae735e72e78f3","entry":"rotate","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"344ae735e72e78f3"}},{"code_sha256_prefix":"4e80aa228ea65fb6","entry":"shear_x","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4e80aa228ea65fb6"}},{"code_sha256_prefix":"137c0aa9944debc9","entry":"shear_y","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"137c0aa9944debc9"}},{"code_sha256_prefix":"7d16ac5dad904d6e","entry":"solarize","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7d16ac5dad904d6e"}},{"code_sha256_prefix":"b462f8c8b2eb6462","entry":"translate_x","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b462f8c8b2eb6462"}},{"code_sha256_prefix":"9680c9d24fbc511b","entry":"translate_y","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9680c9d24fbc511b"}},{"code_sha256_prefix":"4f66e7faa13aae34","entry":"adapt_single","repo":"kowshikthopalli/sista","repo_kind":"listed","path":"SISTA_DA/image_target_memo.py","file_url":"https://github.com/kowshikthopalli/sista/blob/HEAD/SISTA_DA/image_target_memo.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4f66e7faa13aae34"}},{"code_sha256_prefix":"51595c44d66f1ef9","entry":"build_model","repo":"zhangmarvin/memo","repo_kind":"official","path":"imagenet-exps/utils/train_helpers.py","file_url":"https://github.com/zhangmarvin/memo/blob/HEAD/imagenet-exps/utils/train_helpers.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":"51595c44d66f1ef9"}},{"code_sha256_prefix":"cf7f3571664dea5d","entry":"prepare_test_data","repo":"zhangmarvin/memo","repo_kind":"official","path":"imagenet-exps/utils/train_helpers.py","file_url":"https://github.com/zhangmarvin/memo/blob/HEAD/imagenet-exps/utils/train_helpers.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":"cf7f3571664dea5d"}},{"code_sha256_prefix":"66aed7eda3403742","entry":"prepare_test_data","repo":"zhangmarvin/memo","repo_kind":"official","path":"cifar-10-exps/utils/prepare_dataset.py","file_url":"https://github.com/zhangmarvin/memo/blob/HEAD/cifar-10-exps/utils/prepare_dataset.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":"66aed7eda3403742"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}