  Human beings can quickly adapt to environmental changes by leveraging
learning experience. However, the poor ability of adapting to dynamic
environments remains a major challenge for AI models. To better understand this
issue, we study the problem of continual domain adaptation, where the model is
presented with a labeled source domain and a sequence of unlabeled target
domains. There are two major obstacles in this problem: domain shifts and
catastrophic forgetting. In this work, we propose Gradient Regularized
Contrastive Learning to solve the above obstacles. At the core of our method,
gradient regularization plays two key roles: (1) enforces the gradient of
contrastive loss not to increase the supervised training loss on the source
domain, which maintains the discriminative power of learned features; (2)
regularizes the gradient update on the new domain not to increase the
classification loss on the old target domains, which enables the model to adapt
to an in-coming target domain while preserving the performance of previously
observed domains. Hence our method can jointly learn both semantically
discriminative and domain-invariant features with labeled source domain and
unlabeled target domains. The experiments on Digits, DomainNet and
Office-Caltech benchmarks demonstrate the strong performance of our approach
when compared to the state-of-the-art.
