SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.03052 · CVPR · 2023

Masked Images Are Counterfactual Samples for Robust Fine-tuning

Liang Lin, Cong Liu, Pengxu Wei, Yao Xiao, Ziyi Tang

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 7 functions out of this paper's own repositories and ran 3 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
Coxy7/robust-finetuning canonical 3 of 7
FunctionStatusWhere it lives
basic_clean Ran Coxy7/robust-finetuning/models/clip/simple_tokenizer.py
code served (permissive licence) · get_code("98f385d847636a3e")
get_pairs Ran Coxy7/robust-finetuning/models/clip/simple_tokenizer.py
code served (permissive licence) · get_code("d919ae32e5e4e616")
whitespace_clean Ran Coxy7/robust-finetuning/models/clip/simple_tokenizer.py
code served (permissive licence) · get_code("9542161e9640b858")
build_model Not yet run Coxy7/robust-finetuning/models/clip/model.py
code served (permissive licence) · get_code("9015225e37e70449")
get_zeroshot_classifier Not yet run Coxy7/robust-finetuning/models/clip/zeroshot.py
code served (permissive licence) · get_code("59b24c05d9196b73")
load Not yet run Coxy7/robust-finetuning/models/clip/clip.py
code served (permissive licence) · get_code("f6f30e41636ae569")
multi_head_attention_forward Not yet run Coxy7/robust-finetuning/models/clip/multihead_attention.py
code served (permissive licence) · get_code("10db37a6179c6f22")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Deep learning models are challenged by the distribution shift between the training data and test data. Recently, the large models pre-trained on diverse data have demonstrated unprecedented robustness to various distribution shifts. However, fine-tuning these models can lead to a trade-off between in-distribution (ID) performance and out-of-distribution (OOD) robustness. Existing methods for tackling this trade-off do not explicitly address the OOD robustness problem. In this paper, based on causal analysis of the aforementioned problems, we propose a novel finetuning method, which uses masked images as counterfactual samples that help improve the robustness of the fine-tuning model. Specifically, we mask either the semantics-related or semantics-unrelated patches of the images based on class activation map to break the spurious correlation, and refill the masked patches with patches from other images. The resulting counterfactual samples are used in feature-based distillation with the pre-trained model. Extensive experiments verify that regularizing the fine-tuning with the proposed masked images can achieve a better trade-off between ID and OOD performance, surpassing previous methods on the OOD performance. Our code is available at https: //github.com/Coxy7/robust-finetuning.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2303.03052")
get_code_for_paper("2303.03052")
have("2303.03052")

Connect an agent — have() is free.