When Does Group Invariant Learning Survive Spurious Correlations?
Abstract
By inferring latent groups in the training data, recent works introduce invariant learning to the case where environment annotations are unavailable.
Typically, learning group invariance under a majority/minority split is empirically shown to be effective in improving out-of-distribution generalization on many datasets.
However, theoretical guarantee for these methods on learning invariant mechanisms is lacking.
In this paper, we reveal the insufficiency of existing group invariant learning methods in preventing classifiers from depending on spurious correlations in the training set.
Specifically, we propose two criteria on judging such sufficiency.
Theoretically and empirically, we show that existing methods can violate both criteria and thus fail in generalizing to spurious correlation shifts.
Motivated by this, we design a new group invariant learning method, which constructs groups with statistical independence tests, and reweights samples by group label proportion to meet the criteria.
Experiments on both synthetic and real data demonstrate that the new method significantly outperforms existing group invariant learning methods in generalizing to spurious correlation shifts.
Introduction
In many real-world applications, machine learning models inevitably encounter data that are rarely presented in the training environment, i e. being out-of-distribution (OOD).
For example, data collected under new weather [38], locations [6] or light conditions [9] in vision tasks.
However, machine learning models often fail in generalizing to OOD data, which blocks their deployment to critical applications [12; 40].
The dependence on spurious correlations that are prone to change across environments has been recognized as a major cause of such failure [4; 12; 39].
For example, it has been shown that models trained on MNLI [41] usually classify sentence pairs with high word overlap as the label ‘entailment’, regardless of their semantics [27].
On a new dataset where such relation no longer holds, the performance drops over 25% [27; 7].
A notable line of research on improving the robustness of models to distribution shifts is learning features with invariant conditioned label distribution across training environments [30; 4; 15], which has been termed invariant learning (IL).
These methods are based on the assumption that the causal mechanism keeps invariant across environments [30], while the spurious correlation varies.
By penalizing the variance of model prediction across environments, models are then encouraged to capture the causal mechanism instead of spurious correlations.
Recently, invariant learning has been introduced to the scenario where environment labels are unknown [35; 8], which we term the group invariant learning (group-IL).
These methods utilize prior knowledge of spurious correlations to split the training data into groups.
For example, Teney et al.
[35] cluster training samples with their predefined spurious features.
A more generic method,
EIIL [8], splits training data into the majority/minority sets on which the spurious feature conditioned label distribution varies maximally.
Similar to a priori environments, these groups are supposed to encode variations of spurious information, while holding the causal mechanism.
Though some performance improvements have been gained on several datasets, much uncertainty still exists on the effectiveness of group-IL methods.
In particular, when these methods can effectively address spurious correlations remain a question.
Though some theoretical analysis on the success and failure cases of IL with known environments has been proposed [2; 33; 23; 3], they are not sufficient for group-IL.
First, inferred groups may not meet the assumptions on environments in existing theoretical analysis, thus their conclusions cannot generalize to group-IL.
For example, in each environment, the spurious feature is assumed to have a Gaussian type distribution in [33].
However, the inferred group may not satisfy that condition, for example each group may only contain one unique value of spurious feature.
Second, as environments are known and defined with causal structures, exiting analysis on the effect of environment on IL focus mostly on their number [33; 3] but less on their property or validity.
However, the later are important for group-IL.
Therefore, we need specific theoretical analysis under the setting of group-IL.
In this study, we discuss necessary conditions for group-IL to survive spurious correlations.
For this purpose, we first formalize the setting of group-IL and clarify the necessary assumptions required for group-IL, which underlie our theoretical analysis.
We then propose two criteria for group-IL, namely falsity exposure criterion and label balance criterion .
They are respectively for judging whether spurious correlations are sufficiently exposed through their variation across groups and whether group invariance can reach spurious-free conditions.
Based on that, we discuss the success and failure cases of existing methods.
In some synthetic benchmarks (e.g. colored-MNIST in [4; 8]), the majority/minority groups meet the two criteria.
However, in a case when the spurious feature is multivariate, the majority/minority split violates both criteria according to our theoretical analysis and observations on real datasets.
As a result, existing group-IL methods are insufficient for solving spurious correlations.
To fix these problems, we propose a new group-IL method guided by the two criteria.
Specifically, this method contains the following two steps to meet the two criteria.
First, groups are defined by stratifying the prediction of a reference predictor which encodes spurious correlations.
The strata is constructed with statistical tests, such that the spurious prediction is independent of the label on each group.
Second, the label proportion of each inferred group is balanced by attaching weights to each instance within the group.
Models are then trained with invariant learning objectives on the defined groups.
We term this method Spurious-Correlation-Strata Invariant Learning with Label-balancing, abbreviated as SCILL.
We further show that SCILL is provably sufficient in reaching spurious-free with ideal reference models.
To demonstrate the effectiveness of our proposed strategy, we conduct experiments on both synthetic and real data benchmarks on spurious correlations shifts in image classification and natural language inference (NLI).
Specifically, we adopt two different invariant learning objectives, IRM (IRMv1) [4] and REx (V-REx) [15], to show the consistency of SCILL.
To show the availability of SCILL, we also experiment with PGI [1] and cMMD [17; 1], which are feature invariance targets used with EIIL [8] in [1].
The experimental results show that SCILL with all the four invariance objectives consistently outperforms the existing state-of-the-art method EIIL in generalizing to spurious correlation shifts.
Ablation study further shows the effectiveness of each component in SCILL.
Our main contributions can be summarized as follows.
• We propose two criteria for group-IL, and theoretically show the insufficiency of existing methods.
• Guided by the two criteria, we propose a new practical group-IL method which is provably sufficient in solving spurious correlations.
• Extensive experiments on both synthetic and real-data benchmarks show that SCILL significantly outperforms existing methods on image classification and NLI tasks.
[Figure]
Related works
Combating spurious correlations.
A typical kind of distribution-shift is caused by the shift of spurious correlations [40], which are correlations between meaningless features (e.g. hospital tokens on a lung scan) and labels (e.g. has pneumonia or not) in the training set.
The existence of spurious correlations in popular benchmarks have been revealed by many works [13; 31; 27; 34].
For example, predictive models with only incomplete semantic inputs or syntactic statistics can achieve high accuracy in NLI benchmarks [13; 31].
Geirhos et al.
[11] point out that deep neural networks are prone to take easy-to-fit spurious correlations, i.e. shortcut strategies, in solving problems.
As a result, resolving model’s dependence on spurious correlation is important for their robustness to distribution shifts.
Invariant learning (IL).
Many works on domain generalization focus on capturing invariances across training environments [12].
Recently a new kind of strategy which has made significant impacts is to learn features that permit an invariant predictor across environments [30; 4; 15; 39], termed invariant learning in this paper.
Such strategy is grounded upon the theory of causality [29], where Structural Equation Models [30] or causal graphs [39] are used to describe assumptions on the data generation process.
The feature-conditioned label distribution invariance is then induced by the invariance of causal mechanisms in different environments.
Group invariant learning.
In recent works, IL is extended to the scenario without a priori environment labels, but with knowledge on spurious correlations in the training data [35; 8].
Such knowledge is proven to be necessary in this setting [18].
They are utilized to split the training data into groups, which are supposed to encode variations of spurious information so that they can be avoided by learning the invariance.
For example, Teney et al.
[35] cluster samples according to their question types.
Liu et al.
[20] construct groups with varying spurious correlations, based on the spurious features uncovered with feature selection.
A more generic method proposed in EIIL [8] assume the access to a reference predictor which encodes spurious correlations, and exploit the outputs of the reference predictor to split training data into two groups, namely the majority and the minority.
This strategy is shown effective, sometimes even outperform an oracle method using true environment labels in proving the OOD generalization [8] and also systematic generalization [1].
Formalization of group invariant learning
In this section, we introduce the problem setting and formalization of the scheme of group-IL.
Consider the task of learning a classifier f : X → Y , which maps a value x ∈ X of the input variable
X to a value y ∈ Y of the target variable Y .
For example, map an image of horse on grass to the label ‘horse’.
We denote x inv as the essential features of an instance x of the input
variable X which define its class label (e.g. the shape of the horse), while x sp as features of x should not inform the label of x (e.g. the grass background).
X inv , X sp denote the corresponding random variables.
The target is then to learn a spurious-free predictor whose predictions only depend on the feature x inv , thus is supposed to have invariant performance on any dataset.
We first introduce the setting of IL.
IL methods suppose that the training data D are collected under multiple environments E ,
i.e. D =
{ D e } e ∈E .
D e
= { x ei , y ei } n e i =1 contains data i.i.d.
sampled from the probability distribution P e ( X ×Y ) .
P e ( Y | X inv ) is invariant among different e , while P e ( Y | X sp ) varies.
Such an idea is based on the invariance of causal mechanisms across environments [30; 4], with assumptions on the causal structure of the data generating process.
Figure 1 demonstrates four kinds of different assumptions in existing works on invariant learning.
In these causal structures, environment is treated as a random variable E take values in E all , which satisfies E ⊂ E all .
P e ( · ) := P ( ·| E = e ) .
X inv and X sp are latent feature variables generating the observation X , i.e. X = r
( X inv , X sp ) .
Here r is generally assumed as a bijective function so that the latent features can be recovered from the observations [33; 2; 39].
Align with the formalization in the former paragraph where X sp , X inv are assumed recognizable from X , in this paper we adopt the same assumption.
In all the four kinds of causal graphs, P e ( Y | X inv ) :
= P ( Y | X inv , E = e ) keeps invariant under different e ∈ E all , while P e ( Y | X sp ) , P e ( X sp ) , P e ( X inv ) , and P e ( X inv | Y ) can vary across different e ∈ E all .
Suppose the predictor f can be decomposed into f = c ◦ Φ , where Φ : X → H denotes a feature encoder which maps the input into a representation space H , c : H → Y is a classifier.
The target of invariant learning is then to search for a Φ which satisfies the following constraint:
[Equation]
It is termed as Environment Invariance Constraint (EIC).
Note that the EIC stated in [8] is a weaker form of this EIC.
The constraint is incorporated into the training target via a penalty term.
In a generic form, the learning target of invariant learning methods can be written as follows:
[Equation]
where R e ( f ) stands for the expected loss of f on the environment e , weighted by a scalar λ e .
S e ( f ) stands for some statistics of f on e , and the penalty is on the variation of S e ( f ) to measure the deviation degree of EIC.
In IRM [4], the penalty is the summation of S e ( f ) =
∥∇ w R e ( w ◦ f ) ∥ 2 , where w is a constant scalar multiplier of 1.0 for each output dimension.
In V-REx [15], S e ( f ) =
R e ( f ) , and the penalty is the variance of S e ( f ) on different environments.
In CLOvE [39], the penalty is defined as the summation of calibration errors of the model on each environment.
Group invariant learning methods release the dependency of invariant learning on predefined environments by splitting the training data into groups.
Suppose D is sampled from the distribution P ( X ×Y ) .
Intuitively, those groups are expected to hold the invariant mechanism P ( Y | X inv ) , while informing the variation of X sp .
As a result, it is meaningless to divide groups according to X inv .
In group-IL methods [35; 20; 8], group inference algorithms are designed to utilize knowledge on X sp or the correlation between X sp and Y .
Formally, denote the inferred groups as G := { g 1 , g 2 , . .
g m } .
Define
G : X × Y → I as the function which maps a sample to its group identity, i.e. G ( x, y ) =
i if and only if ( x, y ) ∈
g i .
G is then the set of events { G = i } , i ∈ I .
We have G is σ ( X sp , Y ) -measurable, i.e. it is a function of X sp , as in [35; 20], or both X sp and Y [8].
In the following sections, we ground our analysis on group-IL with the causal structures in Figure 1 (a) and (b), while without additional assumptions on the causal models.
Our choice of causal structures is based on the following two observations.
First, in the causal graph (d), X sp is a backdoor variable [29] between X inv and Y and confounded with X inv by an unobserved variable.
As a result, whether the invariant mechanism holds on each group is indeterminate without additional assumptions on the mechanisms between X sp and X inv .
Second, as shown by Ahuja et al.
[2], invariance itself can not deal with spurious feature for causal structure (c).
Additional knowledge or penalty, e.g. information bottleneck, is needed together with group-IL.
Therefore, we investigate group-IL under the causal structures depicted by graphs (a) and (b).
Two group criteria
With the above formulation, we are ready to theoretically analyze the ability of existing group-IL methods in learning spurious-free predictors.
For this purpose, in this section we derive two necessary conditions for group-IL in surviving spurious correlations, i.e. falsity exposure, and label balance.
Both conditions can be used as criteria to judge the sufficiency of group-IL methods.
We then show that existing methods can violate the two criteria, thus become insufficient for learning a spurious-free predictor.
4.1 Falsity exposure criterion
As groups are supposed to expose variance of spurious features so that they can be avoided by invariant learning, a natural idea is to take into account the sufficiency of such exposure on inferred groups.
Ideally, if groups are split according to X sp , any variance of P ( Y | X sp ) is then fully exposed.
However, such split is only practical when the value of X sp is accessible and sparse.
On the contrary, we consider the condition when groups provide insufficient exposure.
Intuitively, if some spurious correlation keeps invariant across groups, its variation is then not exposed, thus group invariant predictor may still depend on such correlation.
Formally, this can be written as the following criterion.
Criterion 4.1 (Falsity Exposure) .
For any σ ( X sp ) -measurable function h that satisfies ∀ g, g ′ ∈ G , P
( Y | h
( X sp ) , g )
=
P ( Y | h
( X sp ) , g ′ ) , it must satisfies P ( Y | h
( X sp ))
=
P ( Y ) .
Intuitively, if the falsity exposure criterion is not satisfied, h ( X sp ) will be an invariant feature across environments, with predictive ability on Y .
The predictor depending on both X inv and h ( X sp ) can satisfy EIC but fails to be free of spurious features.
The following theorem formalizes the significance of the falsity exposure criterion.
Theorem 4.2.
Suppose the falsity exposure criterion is violated,
i.e.
∃ h which satisfies P ( Y | h
( X sp ) , g )
=
P ( Y | h
( X sp ) , g ′ )
̸
= P ( Y ) , ∀ g, g ′ ∈ G .
Then the optimal solution of group-IL is f ( X )=
P [ Y | X inv , h ( X sp )] , which fails to generalize when P ( Y | X sp ) shifts.
4.2 Label balance criterion
Even if we have sufficient falsity exposure, would the constraint in group-IL, i.e. EIC, guarantee the model to be free of spurious correlations?
We study this problem by analyzing the relation between EIC and the constraint for a predictor to be spurious-free.
In our assumed causal structures,
X inv ⊥⊥ X sp | Y .
Thus, a spurious-free predictor, which only depends on X inv , satisfies f ( X ) ⊥⊥
X sp | Y .
In fact, it can be proved that this is a sufficient condition for a predictor f ( X ) to be invariant to the intervention [29] on X sp (See the appendix).
As a result, we term f ( X ) ⊥⊥ X sp | Y as the spurious-free constraint , i.e.
[Equation]
where B is the image set of X sp .
The following is a necessary condition for EIC to induce the above constraint, which we term as the label balance criterion.
It states that the label proportion in different groups should be the same.
Criterion 4.3 (Label Balance) .
For any g, g ′ ∈ G and y, y ′ ∈ Y with non-zero P ( Y = y | g ) , P ( Y = y ′ | g ) , P ( Y = y | g ′ ) and P ( Y =
y ′ | g ′ ) , the following equation holds.
[Equation]
Formally, the following theorem shows the significance of this criterion on the effectiveness of group-IL.
Theorem 4.4.
With a set of groups G inferred by ( X sp , Y ) , i.e. G ⊂ σ ( X sp , Y ) , if the label balance criterion is violated, functions satisfying EIC can not satisfy SFC.
4.3 Analysis of existing group invariant learning methods
Now we analyze whether the groups in existing group-IL methods meet the two criteria.
Directly, randomly grouped clusters of X sp as in [35] do not guarantee to meet either criteria, and clusters of P ( Y | X sp ) [20] do not meet the label balance criterion.
In the following discussions, we focus on the majority/minority groups inferred by the EI algorithm in EIIL [8].
We find that in some synthetic datasets where the spurious feature only has two distinct values, the majority/minority groups satisfy the two criteria.
However, observation on real datasets and theoretical results on the case when the spurious feature is multivariate show that they can violate both criteria.
On some synthetic datasets constructed in existing works [1; 8], the majority/minority groups satisfy these two criteria.
For example, on both colored-MNIST [4] and coloured-MNIST [1], Y has a uniform distribution, and the spurious correlation has the same ratio for any spurious features, e.g.
P ( Y =
| color = green )
=
P ( Y = 1 | color = red ) on colored-MNIST.
It can be proved that in this case, the majority/minority groups satisfy both criteria (See the appendix).
However, it no longer holds in general cases.
Empirically, we observe that on MNLI, the label distributions of the two groups inferred by EI are significantly different.
Specifically, the ratio of the counts of label 0 and label 1 in the two groups are 2.87 and 0.17 respectively.
The following proposition theoretically provides a case where the majority/minority split satisfies the label balance but breaks the falsity exposure, and invariant learning objectives fail to find the spurious-free classifier.
Proposition 4.5.
Suppose we have ( X, Y ) ∼ P ( X, Y ) .
Y takes value in { 0 , 1 } .
X is formed with spurious feature variable X sp =
( B 0 , B 1 ) , and invariant feature variable S , i.e. X = r
( B 0 , B 1 , S ) , for some bijective function r .
B 0 and B 1 are both binary variables, which take values in { b 00 , b 10 } and { b 01 , b 11 } respectively.
B 0 , B 1 and S are conditionally independent given Y .
Suppose P ( Y =
j | B i
=
b ji )
=
p i , ∀ i, j ∈ { 0 , 1 } , and p 0 > p 1 .
Then we have 1) the majority/minority groups e mar , e min violate the falsity exposure criterion.
2) the optimal classifier under invariant learning objectives depends on B 1 .
In this case, we suppose the spurious feature can be decomposed into two variables that are conditionally independent with each other given the label.
Such case can realize when the dataset contains multiple kinds of spurious features.
For example, in the image classification task, the background pattern and the color of an object can be independent but both correlate with the label spuriously.
SCILL: a new method
According to the above discussion in Section 4, existing group-IL methods may fail to meet the two criteria, leading to insufficient training loss for solving spurious correlations.
Faced with this challenge, we propose a new group-IL method, to satisfy the two criteria.
For the generality, we only assume the access to a reference model, as in EIIL, instead of spurious features.
Our new method includes two steps.
In the group inference step, we define groups as spurious correlation strata constructed with the reference model, for the falsity exposure criterion.
While in the training objective step, we reweight each sample with group label proportion to meet the label balance criterion.
To highlight the two parts, our method is named as Spurious-Correlation-strata Invariant Learning with
Label-balance, abbreviated as SCILL.
Theoretically, we prove that this method is provably sufficient with ideal reference models, i.e. its optimal solution is spurious-free.
5.1 Group inference with statistical split
We first introduce the group inference step in SCILL.
As in EIIL, we assume a reference classifier f r is available, which is expected to predict only depending on X sp .
f r can be a model trained with empirical risk minimization (ERM) [8] or a model designed to capture spurious correlations [21].
We propose to construct groups G by stratify the outputs of f r , with the target that Y ⊥⊥ f r ( X ) | g , ∀ g ∈ G .
The motivation for introducing spurious correlation strata comes from the deduction of the falsity exposure criterion, i.e. when groups meet the requirements that X sp ⊥⊥ Y | g , the falsity exposure criterion is satisfied.
That is because with the above condition, we have for any function h , h
( X sp ) ⊥⊥ Y | g , as a result P ( Y | h
( X sp ) , g )
=
P ( Y | g ) .
If P ( Y | h ( X sp ) , g ) =
P ( Y | h
( X sp ) , g ′ ) , ∀ g, g ′ ∈ G , we have P ( Y | g )
=
P ( Y | g ′ )
=
P ( Y ) .
Thus P ( Y | h ( X sp ) , g ) =
P ( Y ) .
As a result, the falsity exposure criterion is satisfied.
As different output values of the reference model f r inform the difference in P ( Y | X sp ) , Y ⊥⊥ f r ( X ) | g approximates P ( Y | X sp ) ⊥⊥ Y | g , which is equivalent to
X sp ⊥⊥ Y | g .
We propose to construct such groups through the statistical-split algorithm, inspired by the algorithm proposed in [14] for propensity score estimation.
Specifically, we split current groups into subgroups according to the hypothesis-test statistics.
For example, for the binary classification case, a sample set B is first divided into two subsets L 0 , L 1 according to the labels of samples.
Then the two-sample t-statistics t B of log[ f r ( x ) 0 /f r ( x ) 1 ] are computed on the two sets.
If t B exceeds a fixed threshold thr , B is then split into two subsets according to the median of f r ( x ) 0 on B .
In this way, we enhance f r ( X ) ⊥⊥ Y in each group.
Note that thr is a hyperparameter of this algorithm.
Empirical robustness analysis on thr is conducted in our experiments.
More details about the algorithm and the robustness study are provided in the appendix.
5.2 Training with reweighted loss
Now we introduce the second step.
To guarantee the label balance criterion, we reweight each sample with group label proportion in the training loss.
Correspondingly, the objective of invariant learning becomes the following form:
[Equation]
where ˜ R g ( f ) =
E [ w g ( Y ) L g ( f ( X ) , Y )] , ω g ( y ) :
= P ( Y = y ) / P ( Y = y | g ) for nonzero P ( Y = y | g ) .
The weight function is defined to balance the label distribution between groups, i.e. P ( Y | g )
=
P ( Y | g ′ ) , ∀ g, g ′ , for achieving the label balance criterion.
With the above two steps, SCILL is then able to meet the two group criteria.
Now we further investigate the theoretical capability of SCILL in solving spurious correlations.
The following theorem shows that with a purely spurious reference model, SCILL can find spurious-free predictors.
Theorem 5.1.
If G satisfies f ∗ r ( X ) ⊥⊥ Y | g , ∀ g ∈ G , where f ∗ r : X → Y is spurious-only, i.e. σ ( X sp ) -measurable, and minimizes the prediction loss L rce
= E [ (cid:80) y P ( Y = y
| X ) log f r ( X ) y ] , the optimal model minimizing the objective (3) satisfies SFC.
Experiments
In this section, we first conduct experiments to show that SCILL outperforms existing group-IL methods in generalizing to spurious correlation shifts.
Then we empirically analyze whether the experimental improvements are consistent with the theoretical findings.
Code is availiable at https: //github.com/Beastlyprime/group-invariant-learning .
6.1 Experimental settings
Now we describe our experimental settings, including datasets, models, and some training details.
More details are provided in the appendix.
Datasets We conduct experiments on both synthetic and real-world datasets.
The synthetic dataset,
Patched-Colored MNIST (PC-MNIST), is constructed as a realization of the conditions in the Proposition 4.5 to verify the proposed criteria.
It is derived from MNIST, by assigning two conditionally independent spurious features given label, namely the color and patch bias to each image.
The design of the patch bias is inspired by [5].
MNLI-HANS is a benchmark widely used in many previous works on combating spurious correlations, such as [7; 36].
In our experiments, we follow the practice to utilize MNLI [41] as the training data and HANS [27] as the test data.
Baselines and configurations In our experiments, we compare SCILL with two baselines, i.e. ERM and EIIL [8].
ERM represents the method with the traditional empirical risk minimization (ERM) approach.
EIIL is a state-of-the-art group-IL method, where groups are inferred by searching an assignment to make the reference model maximally violates the invariant learning principle.
We experiment with four different invariance penalties: IRM [4], REx (V-REx) [15], cMMD [17; 1] and
PGI [1].
Note that cMMD and PGI target to learn group invariant predictions conditioning on the label, different from EIC.
See Appendix for more details of the four penalties.
The training configurations are presented as follows.
For PC-MNIST, we adopt the classifier proposed in [4] for Colored MNIST, which is a MLP with two hidden layers of 390 neurons.
The reference model is a MLP with the same structure trained with ERM on the training set, following the setting in EIIL on Colored MNIST.
While for MNLI, we use a BERT-based classifier with the standard setup for sentence pair classification [10].
The reference model is the same as the biased classifier propose in [36], which is trained on top of some hand-crafted syntactic features.
For each task, all implementations of SCILL and EIIL adopt the same model configurations and pretrained reference models.
Since models are tested with OOD data, it is important to specify the model selection strategy, as has been revealed by Gulrajani and Lopez-Paz [12] for the case of domain generalization.
In our experiments, we report results with 3 different model selection strategies, including ID, Oracle, and
TEV.
ID refers to the strategy based on model performance on the in-distribution validation set as
[Table] [Table]
used in [36].
Oracle refers to the selection based on data from the test data distribution, as used in [8; 12].
While TEV is a new strategy adapted from the training-domain validation method in [12] to the inferred groups
[Table]
which alleviates the dependence on the test data as ID.
Details can be found in the appendix.
6.2 Experimental results
Now we demonstrate our experimental results, including performance comparison and detailed analysis.
More empirical results including the robustness analysis on the hyperparameter in SCILL can be found in the appendix.
6.2.1 Performance comparison
Table 1 and 2 show the experimental results on PC-MNIST and MNLI-HANS, respectively.
The main observation is that all implementations of SCILL consistently outperform the counterpart of EIIL across all model selection strategies, in terms of the performance on OOD data.
Comparing different model selection strategies, Oracle performs the best for both EIIL and SCILL.
However, SCILL with the TEV strategy has the ability to outperform EIIL with Oracle, demonstrating the superiority of our new objective.
Additionally, SCILL also gains improvements against some debiasing methods utilizing the same reference model (See the appendix).
6.2.2 Ablation study and verification of the two criteria
Our main theoretical results in Section 4, i.e. Theorem 4.2 and 4.4, reveal that the two group criteria are necessary conditions for group-IL to survive spurious correlations.
Now we discuss the empirical verification of the significance of the two criteria.
Falsity exposure criterion.
To show the significance of the falsity exposure criterion, we compare the performance of methods under the case when the label balance criterion is satisfied.
On PCMNIST, both SCILL and EIIL groups satisfy the label balance criterion 3 , while EIIL groups provably violate the falsity exposure, according to Proposition 4.5.
The significant improvement of SCILL over EIIL on Table 1 then shows the importance of the falsity exposure criterion.
To exclude the effect of the noise in the reference model in the group inference, we further implement SCILL with the ground-truth spurious predictor, obtaining SCILL gt in Table 1.
The groups then satisfy the falsity exposure criterion.
We construct the ground truth majority/minority split and experiment with IL methods, obtaining results in the row maj./min.
in Table 1.
The significant performance drop of maj./min.
compared with SCILL gt verifies the importance of falsity exposure for group-IL.
On MNLI, the label in EIIL groups is unbalanced (See the appendix).
Therefore we attach the instance reweight step as in SCILL to EIIL, obtaining EIIL lb which satisfies the label balance criterion.
As shown in
Table 2, EIIL lb fails to achieve improved performance, which verifies the necessity of falsity exposure.
Label balance criterion.
To verify the necessity of the label balance criterion, we investigate the cases when the falsity exposure is satisfied.
As the SCILL gt on PC-MNIST satisfies the falsity exposure, we construct such cases by disturbing the label balancing weights in SCILL.
We multiply the estimated label proportion of class 0 by 0.5 to get the unbalanced SCILL ub .
As shown in Table 1, under Oracle selection, the test accuracy of SCILL ub drops approximately 15% compared with
SCILL gt , thus verifying the impact of label balance.
More results can be found in the appendix.
We further show the importance of the instance reweight step in SCILL, which is designed following the label balance criterion.
For this, we remove the instance reweight step in SCILL, obtaining
SCILL uw .
The experimental results in Table 1 and 2 show that SCILL uw performs worse than SCILL, demonstrating the importance of the instance reweight step in SCILL.
Discussions
The main limitation of the paper is our assumptions on the causal structure.
In fact, our conclusions can be generalized to more complex structures, e.g. those in [37] (See the appendix).
The most central assumption is the conditional independence between X inv and X sp given Y , which is adopted in many existing works on solving spurious correlations [7; 37; 42].
It would be an important direction to find causal structures on which the assumption is not satisfied while group-IL can still be effective.
An extended discussion is provided in the appendix.
As this paper focuses on analyzing group invariant learning, comparing SCILL with other algorithms besides group-IL is beyond the scope of this paper.
Notably, the form of the objective of SCILL appears to be similar to two recent methods in solving spurious correlations [26; 32], though the penalties are different.
However, they are only applied for the case when spurious features can be explicitly defined [32], and are also discrete as assumed in [26].
Besides the setting of group invariant learning, the two criteria may also bring benefits to the study of domain generalization.
Furthermore, our empirical results show SCILL can achieve good performance with other kinds of invariances besides that in invariant learning, e.g. the invariance of the distribution of model outputs conditioned on the label.
Discussing the effect of the two group criteria on other kinds of group invariance is a potential research direction.
Conclusion
This paper is concerned with when group invariant learning (group-IL) can survive spurious correlations.
We first formulate the setting of group-IL and necessary assumptions.
Then we theoretically analyze the necessary conditions for group-IL in learning spurious-free predictors, and obtain two group criteria, i e. falsity exposure and label balance.
Considering the limitations of previous group-IL methods, we propose a new method SCILL to satisfy the two criteria.
Furthermore, we theoretically prove that SCILL has the ability to learn a spurious-free predictor.
Finally, we conduct extensive experiments on both synthetic and real data to evaluate the proposed new method.
Experimental results show that SCILL significantly outperforms existing SOTA group-IL methods, owing to its ability to satisfy the two criteria.
The empirical studies validate our theoretical findings.
Acknowledgement
This work was supported by National Key R&D Program of China No. 2021YFF1201600,
Vanke Special Fund for Public Health and Health Discipline Development, Tsinghua University (NO.20221080053) and Beijing Academy of Artificial Intelligence (BAAI).
The authors would like to thank Keyue Qiu and Yuan Li for providing useful feedback on the draft
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Section 7.
(c) Did you discuss any potential negative societal impacts of your work?
[No]
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] See Section(b)
Did you include complete proofs of all theoretical results?
[Yes] In the appendix. 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes]
In the supplemental material.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See the appendix.
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[No] 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL?
[N/A] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total
amount spent on participant compensation?
[N/A]
A The statistical split algorithm
This section introduces details of the statistical split algorithm, which is for the binary classification case.
For the multi-class case, the two-sample t-test here should be substituted by one-way
ANOVA [22] or Kruskal-Wallis Test [16].
Algorithm 1 Statistical split
Input: S = { f r ( x ) | x ∈ the training set } , threshold for the t-statistic.
Initialize queue =
[ S ] , G = [ ] repeat
Pop the head item B in queue
Divide B into L 0 , L 1 according to the label, i.e. L 0 :=
{ f r ( x ) ∈ B | the label of x is 0 } and
L 1 :=
B \ L
Compute the two-sample t-statistic T B of log( f r ( x ) / (1 − f r ( x ))) on L 0 , L 1 and the corresponding p value if T B > threshold then
Split B using the median value m of { f r ( x ) 0 | x ∈ B } , i.e. B ′ :
= { f r ( x ) |
f r ( x ) 0 < m, x ∈
B } , B ′′ :=
B \ B ′
Append B ′ , B ′′ to the end of the queue else
Append B to G end if until queue is empty
Output: G
In our main experiments on PC-MNIST and MNLI, we set the threshold for T B to 10 .
It can be seen in Table 3 that the number of groups increases as T B decreases.
The two-sample t-statistic is computed with the function scipy.stats.ttest _ ind in the Python package scipy .
We also experimented with the case when the condition for split the block is set as p < p thr , where p is the p-value of the two sample test, p thr is a threshold for the p-value.
We set p thr = 0 .
Results are shown in Table 3.
B Experimental Details B.1 Model Selection
It has been argued that model selection is at the heart of domain generalization [12].
In our experiments, methods are also tested with out-of-distribution data, thus it is important to specify the model selection criteria as well.
Existing works
adopt
either training set validation [36] or oracle validation
using test
data
8] to perform model selection.
In-distribution validation (ID) Hyper-parameters are selected using the in-distribution validation set, i
e. the validation set randomly split from the training set.
Test-distribution validation (Oracle) Hyper-parameters are selected using the test validation set,
i
e. the validation set randomly split from the test set.
However, both approaches are suggested as non-optimal, by discussions in several literature [12].
Specifically, in-distribution validation sets can fall short in distinguishing the reference models.
Oracle validation supposes the access of test distribution, which sometimes contradicts the setting of debiasing.
As a result, we also test with TEV, by adapting the widely used strategy in domain generalization, i.e. Training Environments Validation (TEV)
[12] to the inferred reweighted groups.
A major advantage of TEV is that it supposes no access to the test data.
Training environments validation (TEV)
We split the training set into training and validation subsets.
In the validation step, samples in the validation set are allocated to the inferred groups in the training set.
Specifically, we denote the average outputs of f r on each group as its center.
Each
[Table]
B.2 Dataset Details
Patched-Colored MNIST (PC-MNIST) is a synthetic binary classification dataset.
It is derived from
MNIST, by assigning color and patch to each image as the spurious features.
The design of the patch feature is inspired by [5].
Firstly, the handwriting with original digit label 0-4 are labeled 0, and those with 5-9 are labeled 1.
Label noise is then added by flipping the label y with probability p noise .
After that, the color label is assigned by flipping the label y with probability p color , i.e. P ( Y = 0 | color = 0)
= 1 − p color .
Similarly, the patch label is assigned by flipping the label y with probability p patch .
We attach a 3 × 3 black patch on the left top corner to the sample with patch label 1 , otherwise on the right bottom corner.
In our experiments, the training dataset has p color = 0 .
1 , p patch = 0 .
3 , and in the test set p color and p patch are both set as 0 . 5 , i.e. uncorrelated with label y .
The p noise is set to 0 .
25 following that on Colored-MNIST [4].
The accuracy on test set is regarded as the performance of the model in solving model’s dependence on spurious correlations.
MNLI-HANS is a benchmark widely used in many previous debiasing works, such as [7; 36].
In our experiments, we follow the practice to utilize MNLI [41] as the training data and HANS (Heuristic
Analysis for NLI Systems)
[27] as the test data.
In our experiments, we consider the syntactic spurious correlations, e.g. the lexical overlap between premise and hypothesis sentences is strongly correlated with the entailment label [27].
While for HANS, the specific syntactic correlations are eliminated with manually constructed samples.
Therefore, the accuracy on HANS is regarded as the performance of a concerned model in generalizing to the spurious correlation shift.
The statistics of the two datasets are shown as follows.
PC-MNIST.
The training set contains 50000 instances from MNLI.
In-distribution validation set, oracle set, and test set all contain 5000 instances.
All four sets are generated by the same algorithm, only vary in the p color and p patch parameters.
The training and validation set have p color = 0 .
1 , p patch = 0 .
In the oracle and test set p color and p patch are both set as 0 . 5 , i.e. uncorrelated with
label
y .
MNLI-HANS.
MNLI contains approximately 393 thousand training samples.
HANS contains 30000 samples.
We use the MNLI-matched development as the in-distribution validation set, which contains approximately 10000 samples.
The oracle set contains 1000 instances randomly selected from HANS.
B.3 Experimental Settings and Hyper-parameter Tuning
PC-MNIST.
The classifier on PC-MNIST is a MLP with two hidden layers of 390 neurons.
The reference model has the same structure but was trained with ERM for 100 epochs on the training set.
We train each model with 800 epochs.
Following Arjovsky et al.
[4], the penalty is applied after
[Table]
training for several annealing epochs.
Models are tested every 60 epochs to get their accuracy onvalidation sets.
We conduct grid search on hyper-parameters.
The learning rate is searched over { 1 e − 4 , 5 e − 4 , 1 e − 3 , 5 e − 3 } for all the method.
For each invariant learning based method, the penalty weight λ is searched over the range of { 0 . 1 , 1 , 10 , 100 } .
The number of annealing epochs is searched over { 100 , 300 , 500 , 700 } .
MNLI-HANS.
On MNLI, the reference model is the bias-only classifier proposed in [36] which is trained on top of some hand-crafted syntactic features, including (1) whether all words in the hypothesis exist in the premise; (2) whether the hypothesis is a continuous sub-sequence of the premise; (3) the fraction of premise words that shared with hypotheses; (4) the mean, min, max of cosine similarities between word vectors in the premise and the hypothesis.
We follow the default setting in [36] to fine-tune the bert-base-uncased model 3 epochs, with the learning rate set to 5 × 10 − 5 .
We follow [1] to set a rate which linearly ramp up the penalty weight according to batch counts.
Grid search is also conducted.
For each group-IL method, the penalty weight λ is searched over the range of { 1 e − 2 , 1 e − 3 , 1 e − 4 } .
The rate to to linearly ramp up λ is searched over { 0 . 2 , 0 . 4 , 0 . 6 } .
B.4 Additional Comparisons
We additionally cite the results on MNLI-HANS of other state-of-the-art methods solving spurious correlations reported in [36].
These methods use the same reference model adopted in our experiments, but adjust the training objective directly based on its outputs.
For example, PoE [7] reweights the sample importance via the product-of-expert method.
From the table, it shows that SCILL-REx outperforms methods in out-of-distribution accuracy with ID selection strategy.
When SCILL is selected with TEV, SCILL-IRM and SCILL-cMMD also show improved performance.
However, these baseline methods do not admit the TEV selection strategy, as no group is defined in their algorithms.
B.5 Empirical verification for the two criteria
We conduct experiments on PC-MNIST to verify the significance of the two criteria for group-IL.
To verify the significance of the falsity exposure criterion, we compare the performance of methods under the case when label balance criterion is satisfied.
On PC-MNIST, to exclude the effect of the noise in reference model in the group inference, we implement SCILL with the ground-truth spurious predictor, obtaining SCILL gt in Table 6.
The groups then satisfy the falsity exposure criterion.
We construct the ground truth majority/minority split, which violates the falsity exposure, and experiment
[Table] [Table]
with IL methods, obtaining results in the row maj./min..
The significant performance drop of maj./min.
compared with SCILL gt verifies the importance of falsity exposure for group-IL.
To verify the necessity of label balance criterion
[Table]
we investigate the cases when the falsity exposure is satisfied.
As SCILL gt on PC-MNIST satisfies the falsity exposure
[Table]
we construct such cases by disturbing the label balancing weights in SCILL.
We multiply the estimated label proportion of class 0 by different values 1 /p err to obtain different degrees of imbalance.
As shown in Table
[Table]
label imbalance causes significant performance drop of SCILL-IRM, which verifies the impact of label balance.
We further show the importance of the instance reweight step in SCILL, which is designed following the label balance criterion.
For this, we remove the instance reweight step in SCILL, obtaining
SCILL uw .
The experimental results in Table 5 show that SCILL uw performs worse than SCILL, demonstrating the importance of the instance reweight step in SCILL.
B.6 Robustness analysis
As shown in Section 5.1 in the main paper, the statistical-split algorithm contains a hyper-parameter thr .
So We study the robustness of SCILL w.r.t.
thr by experiments on PC-MNIST with thr set as 5 , 10 , 15 , 20 in SCILL-IRM.
From the results shown in Table 3, the models are robust with different thr = 10 , 15 , 20 , though the model with thr = 5 is worse than others.
B.7 Label proportion of EI groups on MNLI
Figure 2 shows the label proportion of the two groups inferred by the EI algorithm in EIIL.
It can be seen that P ( Y = 0 | g 0 ) /
P ( Y = 1 | g 0 )
̸
= P ( Y =
| g 1 ) / P ( Y = 1 | g 1 ) .
As a result, the label balance criterion is violated.
[Table]
[Figure]
B.8 Penalties
We experiment with 4 kinds of invariant learning penalties: IRM [4], REx [15], cMMD [17; 1]
[Table]
and
PGI [1].
We follow the notations in the main paper.
The penalty of IRM is defined as
[Equation]
where R g denotes the expected risk on group g , w is a constant scalar multiplier of 1.0 for each output dimension.
With the same notations, the penalty in V-REx writes as follows.
[Equation]
where Var ( · ) denotes the variance.
Different from IRM and V-REx which enhance the invariance of feature conditioned label distribution, cMMD and PGI are two penalties to enhance the invariance of the label conditioned feature distribution across groups, i.e.
[Equation]
The two penalties are shown to improve model’s out-of-distribution generalization performance when used with EIIL in [1].
To show the availability of SCILL, we also experiments the two penalties with
SCIIL.
In cMMD, the penalty is defined as the summation of the estimated MMD distances between each pair of conditional distributions, i.e.
[Equation]
where g y :=
g ∩ { Y = y } , K is a kernel function, which in our implementation is a mixture of
Gaussians with bandwidths [1, 5, 10], following [1].
We set f ( x ) as the logarithm of the model’s output probability, as advised in [37].
X sp E
Y
X
X inv (a) [4; 37]
X sp E
Y
X
X inv (b) [33; 26; 37]
X sp
Y
X E
X inv (c) [2; 25]
X sp
Y
X E
X inv (d) [39; 23]
With the same notations, in PGI, the penalty is defined as
[Equation]
Here f ( x ) is the probability estimation of the predictor, which follows [1].
f ( · ) y denotes the component of f ( · ) on the dimension corresponding to class y .
C Extended Discussions
Assumptions in this paper.
In Section 3, we stated our assumptions on the data generating process as depicted by the causal graphs (a), (b) in Figure 1 of the main paper.
In fact, our conclusions can be further extended to causal structures shown in Figure 3 (a), (b).
Compared with Figure 1, Figure 3 (a) further includes the case when E is a child of both X sp and Y , depicting the case that X sp and Y are subject to different selection mechanisms in different domains, as introduced in [37].
Figure(b) further includes 1) E is a child of both X sp and Y ; 2) E is a confounder of X sp and Y .
In all these cases, we have X inv ⊥⊥ X sp | Y .
It is the only condition required in our proofs for theorems and statements in this paper, except for SFC, which needs Y to be a backdoor variable between X sp and
X .
The conditional independence condition X inv ⊥⊥ X sp
| Y is an essential assumption in many related works on solving spurious correlations [37; 7; 42; 32].
For example, it is required in the proof of conditions of Theorem 4.2 in [37].
The nuisance-varying family defined in [32] satisfies that p ( x | x b , y ) keeps invariant, which is equivalent to X inv ⊥⊥ X sp | Y .
It would be an important direction to find causal structures on which the assumption is not satisfied while group invariant learning can still be effective.
For example, for the causal structure in Figure 3 (c), group invariant learning may still handy when combined with an additional information bottleneck penalty [2].
The algorithm SCIIL.
In this paper, the algorithm SCIIL is proposed as a possible but not necessarily optimal solution to meet the two criteria for group-IL.
As this paper focuses on analyzing group invariant learning, comparing SCILL with other algorithms besides group-IL is beyond the scope of this paper.
However, it can be observed that SCILL has some advantages compared with existing methods on solving spurious correlations.
Notably, the form of the objective of SCILL appears to be similar to those in two recent methods [26; 32].
They both contain a risk term reweighted by estimations of spurious correlations and an feature invariance penalty.
However, they are only applied for the case when spurious features can be explicitly defined [32], and are also discrete as assumed in [26].
Also, their feature invariance penalty is different from that in IL.
Specifically, Makar et al.
[26] divide samples into groups according to their spurious feature, and define the pairwise MMD distance of the distributions of embeddings on these groups as the penalty.
It is equivalent to SCILL+cMMD when the spurious feature takes binary values.
[32] suppose the access of X sp and use a parameterized penalty term which approximates the mutual information
I [( f ( X ) , Y ) | X sp ] .
Instead, SCILL only assume the access of a reference model, which fits for more general cases when X sp is high dimensional or not predefined.
Compared with some other methods that exploiting a reference model [7; 24; 36; 28; 19; 42], the first term in SCIIL resembles their targets where samples are reweighted according to the outputs of the reference model.
However, the IL penalty in SCIIL serves as an additional regularization.
Results in
Section B.4 empirically show SCILL outperforms methods in [7; 36] with the same reference model in out-of-distribution accuracy.
D Proofs
This section contains the following proofs: D.2 proof for the statement in Section 3 on the causal graph; D.3 proof for Theorem 4.2; D.4 proof for the statement in Section 4.2 that SFC is sufficient for f ( X ) to be invariant to the intervention on spurious features; D.5 proof for Theorem 4.4; D. proof for the statement in Section 4.3;
D.7 proof for Proposition 4.5; and D.8 proof for Theorem 5.1.
Notations.
In the following contents, we denote that ( X, Y ) ∼ P ( X × Y ) .
The image set of X sp ,
X inv is respectively denoted as B , S .
X
= r
( X sp , X inv ) , where r is a bijective function.
We denote x sp , x inv as the corresponding values of X sp , X inv for a given value x ∈ X , i.e. x = r ( x sp , x inv ) .
G denotes a set of sets in X × Y which satisfies ∪ g ∈G g =
X
× Y .
G Y := { g ∩ { Y = y }} g ∈G ,y ∈Y .
As f ( x ) =
f ( r ( x sp , x inv )) , for convenience we abbreviate f ( x ) =
f ( x sp , x inv ) .
D.1 Lemmas
We first prove the following lemmas.
Lemma D.1.
If a set g ∈ X × Y can be formed by a set of sets { g i } i ∈I ⊂
G Y under set union, then ∀ g ′ , g ′′ ∈ G
P ( f
[Equation] [Equation]
[Equation]
g
[Equation]
, Y = y ) , ∀ y induces ∀ g ′ ∈
G
P
[Equation]
f
[Equation]
) | g, Y = y ) =
P ( f
[Equation]
| g ′ , Y = y ) , ∀ y
Proof.
We only need to prove the case when for any y , ∃ g 1 , g 2 ∈ G Y , g ∩ { Y = y }
=
g 1 ∪ g 2 .
As
P ( f ( X ) | g, Y = y ) =
P ( f ( X ) | g 1 , Y = y ) P ( g 1 , Y
[Equation]
P
[Equation] [Equation]
[Equation] [Equation]
y ) P (
[Equation] [Equation]
y ) )
By P ( f ( X ) | g 1 , Y = y )
=
P ( f ( X ) | g 2 , Y = y ) , P ( g, Y = y ) =
P ( g 1 , Y = y )
+ P ( g 2 , Y = y ) , we have P ( f ( X ) | g, Y =
y )
=
P ( f ( X ) | g 1 , Y = y ) =
P ( f ( X ) | g 2 , Y = y ) .
Lemma D.2.
Suppose the following conditions are satisfied:
(a) P ( Y = y | g ) / P ( Y =
y ′ |
g )
=
P ( Y = y | g ′ ) /
P ( Y = y ′ | g ′ ) , ∀ g, g ′ ∈ G and ∀ y,
y ′ ∈ Y
satisfying
P ( Y = y | g ) , P ( Y = y ′ | g ) , P ( Y = y | g ′ ) , P ( Y = y ′ | g ′ ) ̸
= 0 .
(b) G only depends on X sp , and ∀ g ∈ G , ∃ c g,y s.t.
P [ X sp = x sp , Y =
y ]
=
c g,y , ∀ x ∈ g, y ∈ Y .
(c) f ( X ) ⊥⊥ X sp | g
, and f ( X ) differs with different P ( Y | X inv ) given g .
Then EIC induces SFC.
Proof.
Denote S b a := { s ∈ S| f
( r ( s, b )) = a } , B g := { b ∈ B|∃ s, r ( s, b ) ∈ g } .
As ∀ b, b ′ ∈
B b , P ( X sp =
b, Y = y )
=
P ( X sp = b ′ , Y = y ) , ∀ y , we have P ( X sp = b ) =
P ( X sp = b ′ ) .
Then P ( Y = y
| X sp =
b ) =
P ( Y = y
| X sp =
b ′ ) , ∀ y .
As
P ( Y = y | g ) =
(cid:88)
b ∈B g
P ( Y = y
| X sp = b ) P ( X sp =
b | g ) =
P ( Y = y
| X sp = b ) .
Suppose ∀ y, b, P ( Y = y | X sp =
b ) ̸
= 0 .
Then we have ∀ b, b ′ ∈ B ,
P ( Y = y
| X sp =
b ) =
P ( Y = y
| X sp = b ′ )
=
P ( Y = y ) , ∀ y.
Now
[Equation]
As X inv ⊥⊥ X sp | Y , we have
[Equation]
As a result,
[Equation]
where b g is any element in B g , S g a :=
∪ b ∈B g S b a .
Note that condition (c) induces S b a = S b ′ a = S g a , ∀ b, b ′ ∈ g , and the condition (b) induces X sp ⊥⊥ X inv | g .
We have
[Equation]
S g a ) P ( g ) =
P ( Y = y, X sp =
b g ) P ( Y = y
| X inv ∈ S g a )
P ( Y = y ) P ( g ) =
P ( X sp =
b g )
P ( g )
P ( Y = y | X inv ∈ S g a )
We have
P ( X sp =
b g )
P ( g ) = P ( X sp =
b g ′ )
P ( g ′ ) , P ( Y = y | X inv ∈ S g a )
=
P ( Y = y
| X inv ∈ S g ′ a )
As f ( X ) ⊥⊥ X sp | g , we have S b a = S g a , ∀ b ∈ g .
Then we have ∀ b, b ′ ∈ B , P ( Y = y
|
X inv ∈ S b a ) =
P ( Y = y | X inv ∈ S b ′ a ) .
As P ( Y | X inv = s ) is constant, ∀ s ∈ S b a , we have f ( X ) ⊥⊥ X sp .
As a result
S b a = S a .
As
P ( f ( X ) = a | g, Y = y ) =
(cid:88)
b
P ( X inv ∈ S b a | X sp =
b, Y = y ) P ( X sp =
b | g, Y = y ) =
P ( X sp =
b g )
P ( g )
P ( X inv ∈ S a | Y = y )
We have
P ( f ( X ) = a | g, Y = y ) =
P ( f ( X ) = a | g ′ , Y = y ) .
And P ( f ( X ) = a | X sp =
b, Y = y )
=
P ( X inv ∈ S a | Y = y ) =
P ( f ( X ) = a | X sp = b ′ , Y = y ) , i.e. SFC is satisfied.
D.2 Proof for the statement in Section
The statement in Section 3.
When the causal model of the data generating process follows the causal graph in Figure 1(d) in the main paper, whether the invariant mechanism holds on each group is indeterminate without additional assumptions on the mechanisms between X sp and X
Proof.
Consider P ( Y | X sp , X inv ) , we have
[Equation]
It shows that the relation between P ( Y | X sp , X inv ) and P ( Y | X inv ) is affected by P ( X sp | Y, X inv ) .
However,
[Equation]
As the mechanisms between Y , E and X sp , and between E and X inv are unknown, so does P ( X sp | Y, X inv ) .
As a result, the relation between P ( Y | X inv , X sp ) and P ( Y | X inv ) is indeterminate.
As g ∈ G is an event in σ ( X sp , Y ) , we have the relation between P ( Y | X inv , g ) and P ( Y | X inv ) is indeterminate.
D.3 Proof for Theorem
Theorem 4.2 in the main paper states as follows.
Theorem D.3.
Suppose the falsity exposure criterion is violated, i.e. ∃ h satisfies P ( Y | h ( X sp ) , g )
=
P (
[Equation]
Then the optimal solution of group-IL is f ( X ) =
P [ Y | X inv , h ( X sp )] , which fails to generalize when P ( Y | X sp ) shifts.
Proof.
We first prove that Φ( X ) =
( X inv , h ( X sp )) satisfies EIC.
As X inv and X sp are conditionally independent given Y , and groups are only defined by X sp and Y , we have ∀ g, g ′ ∈G ,
P
[Equation]
( X sp ) , g | Y ] P ( Y ) P [ X inv , h ( X sp ) , g ] = P [ X inv | Y ] P [ h ( X sp ) , g | Y ] P ( Y )
P [ X inv , h ( X sp )]
=
P [ Y, X inv ] P [ Y | h ( X sp ) , g ] P [ h ( X sp ) , g ]
P [ X inv , h ( X sp ) , g ] P ( Y ) ∝ P
[ Y | X inv ] P [ Y | h
( X sp ) , g ]
P ( Y )
As a result, P [ Y | X inv , h ( X sp ) , g ] =
P [ Y | X inv , h ( X sp ) , g ′ ] =
P [ Y | X inv , h ( X sp )] , and P [ Y | X inv , h ( X sp )]
̸ = P [ Y | X inv ] .
Without the loss of generality, we suppose any other h ′ which satisfies P ( Y | h
( X sp ) , g )
=
P ( Y | h
( X sp ) , g ′ )
̸
= P ( Y ) , ∀ g,
g ′ ∈ G is a function of h , i.e. ∃ l s.t.
h ′ ( x ) =
l ( h ( x )) .
In the objective function of group-IL, the optimal predictor is optimized with the cross-entropy loss.
By the Jensen-Inequality, among all the functions of Φ( X ) , P [ Y | X inv , h ( X sp )] minimizes the loss.
When P ( Y | X sp ) encounters arbitrary changes, so does P ( Y | h
( X sp )) .
As P [ Y | X inv , h ( X sp )] is propositional to P ( Y | h ( X sp )) , it can also change in a new domain.
D.4 Proof for the sufficiency of SFC
The statement in Section 4.2.
SFC is a sufficient condition for a function f ( X ) to be invariant to the intervention [29] on X sp .
Proof.
Specifically, the condition " f ( X ) is invariant to the intervention on X sp " writes as
[Equation]
Equivalently, we can say X sp has no causal effects on f ( X ) .
We consider the causal structures (a) and (b) shown in Figure 3.
In both graphs, Y is a backdoor variable from X sp to X , as it blocks all the backdoor path from X sp to X with an arrow into X sp , and it is not a child of X sp (note that, in (b), we assume the arrows between ( E, Y ) points to Y only when E is the con-founder of Y and
X sp ).
Then by the Back-door criterion [29],
[Equation]
As a result, for any function f ,
[Equation]
It is straightforward that when
[Equation]
we have ∀ b, b ′ ∈ B ,
[Equation]
That ends our proof.
D.5 Proof for Theorem 4.
We repeat Theorem 4.4 here.
Theorem D.4.
With a set of groups G inferred by ( X sp , Y ) , if the label balance criterion is violated, functions satisfying EIC can not satisfy SFC.
Proof.
Suppose a function f satisfies EIC, i.e.
[Equation]
where G is defined by some function h G of ( X sp , Y ) , i.e. ∀ g ∈ G , g :
=
{ ( x, y ) | h G ( x sp , y ) ∈
S g } for some set S g .
Note that here we do not distinguish whether f is the predictor or the feature extractor Φ , because the two has no clear theoretical distinction.
Recall that SFC is stated as
[Equation]
Suppose f also satisfies SFC.
Define S
Bg := { b ∈ B|∃ y, h G ( b, y
) ∈
S g } , we have
[Equation]
we have for ∀ y ∈ Y , g, g ′ ∈ G , satisfying P
[Equation]
g
[Equation]
Y
[Equation]
y
[Equation]
P
[Equation]
g ′
[Equation]
by EIC, we have
[Equation]
Then for another y ′ ∈ Y satisfying P ( g, Y = y ′ )
̸
[Equation]
0 , P
[Equation]
g ′ , Y
[Equation]
y ′ )
[Equation] [Equation]
As a result, if f satisfies SFC, the above condition must be satisfied.
D.6 Proof for the statement in
Section
The statement in Section 4.3.
On both colored-MNIST [4] and coloured-MNIST [1], Y has a uniform distribution, and the spurious correlation has the same ratio for any spurious features, e.g. P ( Y =
| color = green )
=
P ( Y = 1 | color = red )) on colored-MNIST.
It can be proved that in this case the majority/minority groups satisfy both criteria.
Proof.
Denote
[Equation]
As P ( Y = 0) =
P ( Y = 1) , we have
[Equation]
then P ( color = green | Y = 0) =
P ( color = red | Y = 1)
= p .
The majority group g maj , as proved in
Proposition 1 in [8], consists of { color = green , Y = 0 } and { color = red , Y = 1 } .
As a result,
[Equation]
Similarly, for the minority group g min ,
[Equation]
The label-balance criterion is thus satisfied.
As any function h of the color feature satisfies P ( Y =
| h, g maj ) =
P ( Y =
| g maj )
=
P ( Y = 0) , the falsity exposure criterion is satisfied.
D.7 Proof for Proposition 4.
The proposition states as follows.
Proposition D.5.
Suppose we have ( X, Y ) ∼ P ( X, Y ) .
Y takes value in { 0 , 1 } .
X is formed with spurious feature variables X sp
=
( B 0 , B 1 ) , and invariant feature variable S , i.e. X = r
( B 0 , B 1 , S ) , for some injective function r .
B 0 and B 1 are both binary variables, which take values in { b 0 0 , b 1 0 } and { b 01 , b 11 } respectively.
B 0 , B 1 and S are conditionally independent given Y .
Denote P ( Y = j
| B i
=
b ji )
=
p i , ∀ j = 0 , 1 .
Suppose p 0 > p 1 .
Then we have 1) the majority/minority split e maj , e min violates falsity exposure criterion.
2) the optimal classifier under invariant learning objectives depends on B 1 .
Proof.
Without the loss of generality, we suppose P ( Y = 0) =
P ( Y = 1) .
Denote B i takes value in { b
i , b 1 i } .
We have P ( Y =
j | B i
=
b ji )
=
p i , i = 0 , 1 , j = 0 , 1 .
As B i are conditionally independent given Y , we have P ( Y | B 0 , B 1 ) ∝ P ( Y | B 1 ) P ( Y | B 0 ) .
As p 0 > p 1 , we have
P ( Y =
| B 0 = b 00 , B 1 = b 11 ) >
P ( Y = 1 | B 0 = b 00 , B 1 = b 11 )
P ( Y = 1 | B 0 = b 10 , B 1 = b 01 ) > P ( Y =
| B 0 = b 00 , B 1 = b 11 )
The majority group e maj then consists of the following data sets:
[Equation]
In the majority set,
[Equation]
As a result, P ( Y = 0 | B 1 = b 01 , e maj ) =
P ( Y =
| B 1 = b 01 ) .
Similarly,
P
[Equation] [Equation]
[Equation] [Equation]
0 , B
[Equation]
As a result P ( Y = 1 | B 1 = b 11 , e maj )
=
P ( Y =
|
B
=
b 11 )
Then we have P ( Y | B 1 , e maj ) =
P ( Y | B 1 , e min ) , which means B 1 satisfies EIC.
As S is invariant, according to the proof of Theorem.
4.2 in D.3, we have f ∗ =
P ( Y | S, B 1 ) .
D.8 Proof for Theorem 5.
We repeat the theorem as follows.
Theorem D.6.
If G satisfies f ∗ r ( X ) ⊥⊥ Y | g , ∀ g ∈ G , where f ∗ r : X → Y is spurious-only, i.e. σ ( X sp ) -measurable, and minimizes the prediction loss L rce
= E [ (cid:80) y P ( Y = y
| X ) log f r ( X ) y ] , the optimal model minimizing the following objective satisfies SFC.
[Equation]
where ˜ R g ( f ) is defined as
[Equation]
Proof.
For convenience, in the following we denote w gy := ω g ( y ) , x ( b, s ) :
= r
( X sp =
b, X inv = s ) , x
= r
( X sp = x b , X inv = x s ) .
We use p with lower-cased letters to denote the probability of the event that the corresponding random variable denoted by the upper-cased letter equals that value, e.g. p ( x, y ) :
= P ( X = x, Y = y ) , p ( x | g ) = P ( X = x | g ) .
f ( · ) y denotes the component of f ( · ) on the dimension corresponding to class y .
Denote f r as the reference model, which satisfies f r ( x ) =
l ( x b ) , where l is a classifier l : B → Y .
Denote θ r as the parameter of f r , the training loss of f r is defined as
[Equation]
The above equation induces that for f ∗ r :=
f r ( x, θ ∗ ) , where θ ∗ :=
arg min L ce ( f r , θ ) , f ∗ r ( x ) =
f ∗ r ( x ′ )
if and only if p ( y, x b ) = p ( y, x b ′ ) .
If we define g a := { x | f ∗ r ( x ) = a } , we have P ( X sp =
b | g a ) =
P ( X sp = b ′ | g a ) , ∀ b, b ′ ∈ B , and p ( y | g a )
= a y .
We denote the set of strata of f r as G f r .
Now for any g ∈ G f r , ˜
[Equation]
By the conditional independence of X inv and X sp given Y ,
[Equation]
As e is a function of X sp , Y , we have
[Equation] [Equation]
By the above, we have ˜
[Equation]
X
[Equation]
) =
[Equation]
b
[Equation] [Equation]
y
[Equation] [Equation]
P
[Equation]
y
[Equation]
s ))
[Equation]
By the definition of g , we have
[Equation]
So we have
[Equation]
As P ( X sp =
b | g ) is uniform, we have ˜ R g
( f ) ∝ (cid:80)
y
[Equation]
b ∈ g,s P ( X inv = s | y ) log
[Equation]
f y ( x ( b, s ))) .
As a result
[Equation]
where C g is a constant depend on g .
This equation indicates that the loss on f ( · ) y only depends on g and P ( X inv = s | Y = y ) .
By imposing invariance constraints on P ( Y | f, g ) , by Lemma D.2, we have
SFC is satisfied, which ends the proof.