Modern deep learning systems are fragile and do not generalize well under distribution shifts. While much promising work has been accomplished to address these concerns, a systematic study of the role of optimizers and their out-of-distribution generalization performance has not been undertaken. In this study, we examine the performance of popular first-order optimizers for different classes of distributional shift under empirical risk minimization and invariant risk minimization. We address the problem settings for image and text classification using DomainBed, WILDS, and Backgrounds Challenge as out-of-distribution datasets for the exhaustive study. We search over a wide range of hyperparameters and examine the classification accuracy (in-distribution and out-of-distribution) for over 20,000 models. We arrive at the following findings: i) contrary to conventional wisdom, adaptive optimizers (e.g., Adam) perform worse than non-adaptive optimizers (e.g., SGD, momentum-based SGD), ii) in-distribution performance and out-of-distribution performance exhibit three types of behavior depending on the dataset – linear returns, increasing returns, and diminishing returns. We believe these findings can help practitioners choose the right optimizer and know what behavior to expect.
- Python >= 3.6.5
- Pytorch >= 1.6.0
- cuDNN >= 7.6.2
- CUDA >= 10.0
- ColoredMNIST
- RotatedMNIST
- VLCS
- PACS
- OfficeHome
- DomainNet
- TerraIncognita
- Background Challenge
- WILDS Amazon
- WILDS CivilComment
As for the DomainBed, WILDS and Background Challenge implementations, we follow the official implementations shown in the links below.
TMLR (2023) / Paper Link / OpenReview
@article{
naganuma2023empirical,
title={Empirical Study on Optimizer Selection for Out-of-Distribution Generalization},
author={Hiroki Naganuma and Kartik Ahuja and Shiro Takagi and Tetsuya Motokawa and Rio Yokota and Kohta Ishikawa and Ikuro Sato and Ioannis Mitliagkas},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2023},
url={https://openreview.net/forum?id=ipe0IMglFF},
note={}
}