Sequential Learning for Domain Generalization

Da Li, Yongxin Yang, Yi-Zhe Song, Timothy M. Hospedales

Abstract

Domain Generalization (DG) is a critical challenge in machine learning, where models must perform reliably on unseen target domains that differ from the training distribution. Traditional meta-learning approaches for DG typically utilize a "one-step" strategy, splitting source domains into meta-train and meta-test sets to simulate a single domain shift. However, this approach often fails to capture the complexity of real-world shifts. This paper introduces a Sequential Learning for Domain Generalization (S-DG) framework that treats training as a continuous, lifelong learning process. By simulating sequences of domain shifts, the model encounters a vastly larger number of training trajectories, effectively "practicing" generalization. We present S-MLDG and a computationally efficient Fast First-Order (FFO) variant. Our results across multiple benchmarks, including PACS and VLCS, show that S-DG consistently outperforms existing methods while maintaining high computational efficiency.

Introduction

The fundamental assumption in standard machine learning—that training and testing data are independent and identically distributed (i.i.d.)—frequently breaks down in practice. When a model encounters a "domain shift," where the test data distribution differs from the training data, its performance often degrades significantly. Domain Generalization (DG) seeks to address this by designing models that are inherently robust to such shifts without requiring access to target domain data during training.

A popular strategy in DG is meta-learning, which mimics the train-test shift during the training phase. For instance, Meta-Learning for Domain Generalization (MLDG) splits $N$ source domains into $N-1$ meta-train domains and 1 meta-test domain. While effective, this "one-step" approach is limited. With $N$ domains, it only provides $N$ distinct episodes of domain shift. In contrast, humans learn to adapt through a lifetime of varied experiences. This paper proposes that models should similarly learn from sequences of domains to better prepare for unseen environments.

Methodology

The Sequential Framework

The core innovation of this work is the Sequential Learning for Domain Generalization (S-DG) framework. Instead of a single jump from a training set to a validation set, the model is exposed to domains in a structured sequence (e.g., Domain A $\rightarrow$ Domain B $\rightarrow$ Domain C). In this setup, the model learns on Domain A, evaluates how that knowledge transfers to Domain B, and then assesses how the combined updates from A and B facilitate performance on Domain C.

Overview of the Sequential Learning for Domain Generalization (S-DG) framework.

As illustrated in Figure 1, this hierarchical approach allows for $N!$ (N factorial) possible training trajectories. This exponential increase in training episodes provides the model with significantly more "practice" at generalizing across diverse shifts compared to the linear number of episodes in standard meta-learning.

S-MLDG and Fast First-Order Optimization

The authors apply this sequential logic to the MLDG algorithm, creating S-MLDG. By backpropagating through the entire sequence of domain updates, the model optimizes its initial parameters such that learning on early domains specifically enhances performance on all subsequent domains in the chain.

However, full sequential backpropagation is computationally demanding due to the requirement for high-order gradients. To address this, the authors developed FFO-S-MLDG, a Fast First-Order version. Inspired by the "Reptile" algorithm used in few-shot learning, this variant recursively updates model parameters across the domain sequence and then performs a final update moving the original weights toward the end-of-sequence result. Mathematically, this approach encourages gradient alignment across all pairs of domains, effectively seeking a "domain-invariant" optimization path.

Experimental Evaluation

Datasets and Benchmarks

The S-DG framework was evaluated on three diverse and challenging DG benchmarks:

  • PACS: A standard benchmark for cross-domain image recognition featuring four styles: Photo, Art Painting, Cartoon, and Sketch.
  • VLCS: Comprising four distinct photographic datasets (VOC, LabelMe, Caltech, Sun), testing robustness to dataset bias.
  • IXMAS: A multi-view action recognition dataset where the model must generalize across different camera perspectives.

Key Results

The experimental results demonstrate the superiority of the sequential approach:

  1. Accuracy Gains: S-MLDG and FFO-S-MLDG consistently outperformed both the "Aggregation" baseline (training on all source data simultaneously) and the original MLDG. On the PACS benchmark, S-MLDG achieved an average accuracy of 81.5%, surpassing the baseline (79.1%) and standard MLDG (80.7%).
  2. Domain Invariance: The authors used a domain-classification adversary to measure feature universality. Features learned via S-MLDG were significantly harder for the adversary to classify by domain, indicating that the model successfully learned domain-invariant representations.
  3. Efficiency: Despite the increased complexity of the training sequences, the FFO-S-MLDG variant is remarkably fast. On PACS, it required only 11 minutes of training time, whereas other meta-learning methods like CrossGrad took over 146 minutes.

Discussion and Conclusion

The success of S-DG stems from the "practice effect." By simulating a vast array of domain-shift sequences, the model becomes more adept at identifying features that are robust across various environments. The alignment of gradients across domain pairs ensures that the optimization process favors solutions that are universally applicable rather than domain-specific.

While highly effective, the benefits of S-DG are most pronounced when multiple source domains are available; with only two domains, the sequence length is insufficient to provide a significant advantage over standard methods. Future work may involve combining sequential learning with advanced data augmentation to further synthesize diverse domain shifts, potentially enhancing generalization even in low-domain scenarios. In conclusion, Sequential Learning offers a powerful, efficient, and scalable framework for building models that truly generalize to the unknown.

Summary updated

BibTeX
@inproceedings{li2020sequential,
  author = {Da Li and Yongxin Yang and Yi-Zhe Song and Timothy M. Hospedales},
  title = {{Sequential Learning for Domain Generalization}},
  booktitle = {Workshops @ ECCV},
  year = {2020},
  doi = {10.1007/978-3-030-66415-2\_39},
}
Figure