Paper: Adaptive Invariant Representation Learning for Non-stationary Domain Generalization (ICLR-2024)

Reviewer comment (Theory):
The theoretical analysis is trivial and there is little novelty in it. Firstly, Theorem 4.5 is a conventional generalization bound via Rademacher Complexity, and the constant term \(C\) is the **upper bound** of the loss function, which means the upper bound is quite loose and not quite meaningful to guide the design of methods. That is, if the upper bound is too loose, one could add any term to it that is consistent to the method. Also, the meaning of \(K\) is not demonstrated in the paper.

Author response:
> **Q1. Regarding Theorem 4.5.**

We clarify that the usage of Rademacher complexity is not our main contribution. Rademacher complexity is one conventional way to relate the learning bound with finite data setting (in practice we only have access to finite data). It has been used to construct learning bounds for many domain adaptation/generalization settings [1,2,3]. The key contribution in **Theorem 4.5** is to construct a learning bound based on the non-stationary mechanism $M^{\ast}$ which provides the guarantee for the proposed algorithm.

We also clarify that the assumption about bounded loss function is common in domain adaptation/generalization literature [1,4,5]. This assumption is mild and can be easily satisfied by many loss functions. For example, cross-entropy loss can be bounded by $C$ modifying the softmax output from $\left(p\_1, p\_2, \cdots. p\_{|\mathcal{Y}|} \right)$ to $\left(\hat{p}\_1, \hat{p}\_2, \cdots. \hat{p}\_{|\mathcal{Y}|} \right)$ where $\hat{p}\_i = p\_i (1 - \exp(-C)|\mathcal{Y}|) + \exp(-C)$.

$K$ is a constant that depends on statistical distance $\mathcal{D}$ used measures the distance between two distributions. In particular, $K = \frac{1}{\sqrt{2}}$ when $\mathcal{D}$ is KL-divergence and $K = \sqrt{2}$ when $\mathcal{D}$ is JS-divergence. The details of $K$ are already given in the proof of **Lemma A.1** in **Appendix A**. Based on your suggestion, we revised **Theorem 4.5** to include this information.

Reviewer comment (Theory):
Proposition 4.6 is also trivial, and the reweighting method that it inspired has little relationship with invariance.

Author response:
> **Q2. Regarding Proposition 4.6 and reweighting method.**

Could you provide more details for your argument “Secondly, Proposition 4.6 is also trivial”? We note that this proposition is not trivial and the goal of this one is to help us to connect **Theorem 4.5** (which suggests us finding the mapping $m\_{t-1}^{\ast}: \mathcal{X} \times \mathcal{Y} \rightarrow \mathcal{X} \times \mathcal{Y}$ such that distance of the joint distributions $P^{X,Y}$ between two domains $D\_t$ and $D\_t^{\ast} = m\_{t-1} \sharp D\_{t-1}$ is minimized $\forall t \in [2,T]$) to our 2-stage algorithm shown in **Remark 4.7** (which minimizes (1) distance of label distribution $P(Y)$ by importance weighting and (2) distance of label-conditional feature distribution $P(X|Y)$ by invariant representation learning).

We also clarify that importance weighting method is used to minimize the distance of label distribution $P(Y)$ between two domains $D\_t$ and $D\_t^{\ast}$ rather than achieving label-conditional invariance representation learning which is equivalent to minimizing the distance of label-conditional distribution $P(X|Y)$.

Reviewer comment (Theory):
In the model design, it is unclear why the alignment of distributions could lead to invariance. The authors did not formally define the invariance property and it seems vague.

Author response:
> **Q3. Regarding invariant property.**

As suggested by **Proposition 4.6**, after conducting importance weighting, we need to find the sequence of mappings in the input space $\mathcal{X}$ that can help to minimize the distance of label-conditional distribution $P(X|Y)$ between 2 consecutive source domains. However, finding such mappings in input space may not be trivial due to the complexity of input space. We alleviate this issue by finding the sequence of mappings in the representation space $\mathcal{Z}$ such that each $m\_t^{\ast}$ can be replaced by $f\_t^{\ast}: \mathcal{X} \rightarrow \mathcal{Z}$ and $g\_t^{\ast}: \mathcal{X} \rightarrow \mathcal{Z}$. In essence, we find $f\_t^{\ast}$ and $g\_t^{\ast}$ such that the distance of the label-conditional distribution $P^{Z|Y}$ between two consecutive source domains is minimized. This objective is equivalent to finding label-conditional invariant representation between two consecutive source domains. (i.e., $P^{Z|Y}$ is invariant across 2 domains $D\_t$,  $D\_{t+1}$ is equivalent to $\mathcal{D}\left( P^{Z|Y}\_{D\_t},  P^{Z|Y}\_{D\_{t+1}} \right) = 0$).

Reviewer comment (Evaluation):
In the experiments, the authors did not report the variance of different runs.

Author response:
> **Q5. Regarding standard deviation and validation protocol.**

Thanks for your comment. We’ve revised **Table 1** to include standard deviation calculated from results of 5 different random seeds. In our experiment, models are trained on a sequence of source domains and are evaluated on target domains under 2 setting: Eval-S and Eval-D. In Eval-S, models are trained one time on the first half of domain sequence and are deployed to make predictions on the second half of domain sequence. In Eval-D, source and target domains are not static but are updated periodically as new data/domain becomes available. In both settings, we split the training set into smaller subsets with a ratio 81 : 9 : 10; these subsets are used as training, validation, and in-distribution testing sets. The details of datasets and evaluation settings are shown in **Appendix C** of our manuscript.

Reviewer comment (Evaluation):
The evaluation section lacks significance testing and does not report standard deviations in the results table. Given the close performance across many results, the inclusion of standard deviations is crucial to affirm the method's efficacy.

Author response:
Thanks for your suggestion. We’ve revised **Table 1** to include standard deviation calculated from results of 5 different random seeds.

Reviewer comment (Reproducibility):
While the theoretical analysis provided is compelling, the practical implementation details in Section 5 are complex and challenging to comprehend, even with the pseudo-code. A more detailed and clearer illustration would greatly enhance understanding.

Author response:
Thanks for your suggestion. Could you provide more details about what thing we should do to improve clarification for section 5? We will revise this section based on your comments in our final version.

Reviewer comment (Theory):
Description of the setting is not clear and the key assumption seems strong.

Author response:
> **Q1. Regarding problem setting and invariant learning.**

We consider DG in non-stationary environment where domains evolve along specific direction (e.g., time, space). This setting is different from conventional DG setting considered in existing methods (including IRM). In essence, conventional DG assumes domains are sampled from a stationary environment and target domains lie on or are near the mixture of source domains. In addition, evaluation protocol is also different between non-stationary and conventional DG. Models designed for conventional DG follow “leave-one-out” evaluation (i.e., one domain is target while the remaining domains are source) because the goal is to generalize to arbitrary domains near the mixture of source domains. Meanwhile, in non-stationary DG, models are trained on previous domains and evaluated on future domains in domain sequences. We also note that dataset (colored MNIST) used in IRM paper is different from the one (rotated MNIST) used in our work. 

Under the assumption that target domains lie on or are near the mixture of source domains, existing works that enforce invariant representations across all source domains can help to generalize the model to target domains [1,2,3]. However, this assumption may not hold in non-stationary DG where the target domains may be far from the mixture of source domains resulting in the failure of the existing methods. In non-stationary DG, the key is to capture non-stationary patterns from the sequence of source domains which can help us to estimate the target domains. Our proposed method captures these patterns in the representation space via learning the sequence of invariant representation space in which each space is for a pair of consecutive source domains. Note that, this method is different from the existing works that learn a general invariant representation space for all source domains.

Reviewer comment (Experiments):
Do you implicitly assume that the domain indexes and their order are given? If so, this setting is limited in this sense, noting that most benchmark methods do not utilize the order information. Please clarify.

Author response:
> **Q2. Regarding the usage domain index and order.**

We clarify that both our method and all currently existing baselines for non-stationary DG rely on the utilization of domain order information. This information is necessary to capture non-stationary patterns over the source domains, thereby playing a pivotal role in facilitating models to generalize to target domains in the context of non-stationary DG. It is noteworthy that in numerous applications in computer vision [4], natural language processing [5], and healthcare [6], this information naturally emerges and does not necessitate additional efforts for collection.

Reviewer comment (Theory):
Assumption 4.3 may be rather strong. It is not equivalent to assuming there exists a pattern in the hypothesis space; instead, it involves a specific one that minimizes the divergence of observed datasets and could provide an almost optimal estimate of an unseen domain. This would be a strong assumption on the relationship between observed and unseen domains. Please clarify.

Author response:
> **Q4. Regarding Assumption 4.3.**

We clarify that **Assumption 4.3** about $\Theta\left( M^{\ast} \right)$ is reasonable. If **Assumption 4.3** does not hold, it means that non-stationary patterns underlying target domain are very different from the patterns estimated from the source domains, making the task to generalize to target domain infeasible. It is noteworthy that we do not mention **Assumption 4.3** is equivalent to “assuming that there exists a pattern in the hypothesis space” because it only applied for optimal mechanism $M^{\ast}$. We only mentioned that **Assumption 4.3** implies that assumption. We’ve revised our writing to avoid this ambiguity.

Reviewer comment (Writing):
Section 5 is hard to follow. Please be more concise.

Author response:
> **Q5. Regarding section 5 writing.**

Thanks for your suggestion. Could you provide more details about what thing we should do to improve clarification for section 5? We will revise this section based on your comments in our final version.

Reviewer comment (Theory):
Definition of $\Phi$ is a bit ambiguous. In Definition 4.1 and Remark 4.2, $\Phi(\widehat{M})$ consists of an average error of $\widehat{M}$ and on the source domains and error of $\widehat{M}$ on the target domain. It doesn't consider whether each error is low enough but only considers their difference. Thus, based on the definition, $\widehat{M}$ is generalizable even if $\widehat{M}$ has high errors on both source and target domains. I am unsure if such $\widehat{M}$ is generalizable.

Author response:
> **Q1. Regarding definition of generalizability term $\Theta\left(\widehat{M}\right)$.**

To clarify, $\Theta\left(\widehat{M}\right)$ is defined as the difference between two terms: error of  $\widehat{M}$ on sequence of source domains $\frac{1}{T-1}\sum\_{t=2}\mathcal{D}\left( P^{X,Y}\_{D\_t},P^{X,Y}\_{\widehat{D}\_t}\right)$ and error of  $\widehat{M}$ on target domain $\mathcal{D}\left(P^{X,Y}\_{D\_{T+1}},P^{X,Y}\_{\widehat{D}\_{T+1}}\right)$. In other words, $\Theta\left(\widehat{M}\right)$ measures how consistent in terms of performance of mechanism $\widehat{M}$ on capturing non-stationary patterns on source and target domains, and the term “generalizability” used in **Definition 4.1** implies it. Clearly, good $\widehat{M}$ makes $\Theta\left(\widehat{M}\right)$ small but $\Theta\left( \widehat{M} \right)$ does not imply $\widehat{M}$ can capture the evolving on target domain because $\widehat{M}$ may have large error on both source and target domains. Thanks for your comment, we’ve revised **Definition 4.1** by replacing the term **“generalizability”** with **“non-stationary consistency”** to avoid ambiguity.

Reviewer comment (Theory):
Moreover, Assumption 4.3 tells us that we can find a decent $\widehat{M}$ with a small error on the source domains but seems to tell nothing about the error on the target domain. I am unsure if I understood this statement correctly, but it doesn't seem like Assumption 4.3 implies that the error of $M^{*}$ on the target domain is small. I think this is one of the key statements of this study so it needs to be clarified.

Author response:
> **Q2. Regarding Assumption 4.3.**

We clarify that **Assumption 4.3** implies error of $M^{\ast}$ on target domain is small. Note that **Assumption 4.3** holds only for the optimal mechanism $M^{\ast} = argmin\_{\widehat{M} \in \mathcal{M}} \frac{1}{T-1} \sum\_{t=2} \mathcal{D} \left( P^{X,Y}\_{D_t}, P^{X,Y}\_{\widehat{D}\_t} \right)$ instead of arbitrary $\widehat{M}$. During training, we can feasibly achieve small source error for $M^{\ast}$ (i.e., $\frac{1}{T-1} \sum\_{t=2} \mathcal{D} \left( P^{X,Y}\_{D\_t}, P^{X,Y}\_{D^{\ast}\_t} \right)$ by using high-capacity hypothesis class (e.g., neural network). This fact combining with **Assumption 4.3** ($\left \| \mathcal{D} \left( P^{X,Y}\_{D\_{T+1}}, P^{X,Y}\_{ D^{\ast}\_{T+1}} \right) - \frac{1}{T-1} \sum\_{t=2} \mathcal{D} \left( P^{X,Y}\_{D\_t}, P^{X,Y}\_{D^{\ast}\_t} \right) \right| < \epsilon$) implies that error of $M^{\ast}$ on target domain $\mathcal{D} \left( P^{X,Y}\_{D\_{T+1}}, P^{X,Y}\_{ D^{\ast}\_{T+1}} \right)$ is small.

Reviewer comment (Evaluation):
The authors need to add an uncertainty metric to Table 1.

Author response:
> **Q3. Regarding uncertainty metric to Table 1.**

Thanks for your suggestion. We’ve revised **Table 1** to include standard deviation calculated from results of 5 different random seeds.

Reviewer comment (Theory):
I appreciate the theoretical analysis and experimental evidence that the authors presented. Could the authors further provide under what condition the proposed approach will have guaranteed improvement compared to either the ERM or some conventional DG method?

Author response:
> **Q4. Regarding the setting the proposed approach outperforms conventional DG methods.**

To clarify, our method is designed for the setting where data evolves along a specific direction (e.g., space, time), and by taking non-stationary environment into consideration, our method achieves better performance compared to existing DG methods in this setting. In essence, existing DG methods often enforce invariant representations across all domains, and it has been shown that when target domains lie on or are near the mixture of source domains, enforcing invariant representations across all source domains can help to generalize the model to target domains [1,2,3]. However, this assumption may not hold in non-stationary DG where target domains may be far from the mixture of source domains resulting in the failure of existing methods.

To further support this argument, we conduct an experiment on rotated RMNIST dataset with DANN [4] – a model that learns invariant representations across all domains. Specifically, we create 5 domains by rotating images by 0, 15, 30, 45, and 60 degrees, respectively, and follow leave-one-out evaluation (i.e., one domain is target while remaining domains are source). Clearly, the setting where target domain is images rotated by 0 or 60 degrees can be considered as non-stationary DG while other settings can be considered as conventional DG. The performances of DANN with different target domains are shown in the following table. As we can see, the accuracy drops significantly when target domain is images rotated by 0 or 60 degrees. This result demonstrates that conventional DG methods are not suitable for non-stationary DG.

| Target domain     | 0    | 15   | 30   | 45   | 60   |
|-------------------|------|------|------|------|------|
| DANN performance | 51.2 | 59.1 | 70.0 | 69.2 | 53.9 |

Reviewer comment (Experiments):
I think the FMoW dataset from the WILDS benchmark aligns with the problem setup in the paper. (The authors already included sufficient experimental results, so I do not request the authors to add an additional dataset.)

Author response:
> **Q5. Regarding FMoV dataset.**

Thanks for pointing out the great resource related to our research. We will explore this dataset in future works.

Reviewer comment (Presentation):
The authors may want to add some dotted lines to Table 1 to differentiate different approaches - ERMs / conventional DA/DGs, ...

Author response:
> **Q6. Regarding Table 1 presentation.**

Thanks for your suggestion. We’ve revised **Table 1** to distinguish different approaches.