Automatic Domain Adaptation by Transformers in In-Context Learning
Ryuichiro Hataya, Kota Matsui, Masaaki Imaizumi
TL;DR
The paper addresses the challenge of selecting and applying domain adaptation methods under covariate shift without retraining models at test time. It demonstrates that Transformers in an in-context learning setup can approximate both instance-based (uLSIF/IWL) and feature-based (DANN) UDA algorithms, and can automatically choose the appropriate method based on dataset properties. Theoretical results provide constructive proofs that suitable Transformer architectures can implement the necessary linear and minimax updates with bounded error, while experiments on two-moon and colorized-MNIST tasks show practical gains over traditional UDA baselines. This work suggests that foundation-models, via in-context learning, can serve as adaptive, cross-framework domain adapters, potentially reducing the manual effort required to select and tune transfer techniques in real-world applications.
Abstract
Selecting or designing an appropriate domain adaptation algorithm for a given problem remains challenging. This paper presents a Transformer model that can provably approximate and opt for domain adaptation methods for a given dataset in the in-context learning framework, where a foundation model performs new tasks without updating its parameters at test time. Specifically, we prove that Transformers can approximate instance-based and feature-based unsupervised domain adaptation algorithms and automatically select an algorithm suited for a given dataset. Numerical results indicate that in-context learning demonstrates an adaptive domain adaptation surpassing existing methods.
