SlowGuess/NeurIPS_2023_OCR huggingface dataset:
[1] I. Ahmad and P.-E. Lin. A nonparametric estimation of the entropy for absolutely continuous distributions (corresp.). IEEE Transactions on Information Theory, 22(3):372-375, 1976. (Cited on page 27)
[2] K. Ahuja, E. Caballero, D. Zhang, J.-C. Gagnon-Audet, Y. Bengio, I. Mitliagkas, and I. Rish. Invariance principle meets information bottleneck for out-of-distribution generalization. In Advances in Neural Information Processing Systems, 2021. (Cited on pages 9 and 32)
[3] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019. (Cited on pages 8, 9, 30 and 32)
[4] M. I. Belghazi, A. Baratin, S. Rajeshwar, S. Ozair, Y. Bengio, A. Courville, and D. Hjelm. Mutual information neural estimation. In International Conference on Machine Learning, volume 80, pages 531-540, 10-15 Jul 2018. (Cited on page 27)
[5] B. Bevilacqua, Y. Zhou, and B. Ribeiro. Size-invariant graph representations for graph classification extrapolations. In International Conference on Machine Learning, pages 837-851, 2021. (Cited on page 21)
[6] G. Chen, Y. Wang, F. Guo, Q. Guo, J. Shao, H. Shen, and X. Cheng. Causality and independence enhancement for biased node classification. In ACM International Conference on Information and Knowledge Management, pages 203–212, 2023. (Cited on page 21)
[7] Y. Chen, H. Yang, Y. Zhang, K. Ma, T. Liu, B. Han, and J. Cheng. Understanding and improving graph injection attack by promoting unnoticeability. In International Conference on Learning Representations, 2022. (Cited on page 21)
[8] Y. Chen, Y. Zhang, Y. Bian, H. Yang, K. Ma, B. Xie, T. Liu, B. Han, and J. Cheng. Learning causally invariant representations for out-of-distribution generalization on graphs. In Advances in Neural Information Processing Systems, 2022. (Cited on pages 1, 2, 3, 4, 5, 6, 9, 19, 20, 21, 22, 25, 27, 31, 32 and 33)
[9] Y. Chen, K. Zhou, Y. Bian, B. Xie, K. Ma, Y. Zhang, H. Yang, B. Han, and J. Cheng. Pareto invariant risk minimization. arXiv preprint, arXiv:2206.07766, 2022. (Cited on page 30)
[10] Y. Chen, W. Huang, K. Zhou, Y. Bian, B. Han, and J. Cheng. Towards understanding feature learning in out-of-distribution generalization. arXiv preprint arXiv:2304.11327, 2023. (Cited on page 7)
[11] S. Chopra, R. Hadsell, and Y. LeCun. Learning a similarity metric discriminatively, with application to face verification. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2005), 20-26 June 2005, San Diego, CA, USA, pages 539-546, 2005. (Cited on page 27)
[12] E. Creager, J. Jacobsen, and R. S. Zemel. Environment inference for invariant learning. In International Conference on Machine Learning, pages 2189–2200, 2021. (Cited on pages 4, 21 and 32)
[13] E. Creager, J. Jacobsen, and R. S. Zemel. Environment inference for invariant learning. In International Conference on Machine Learning, volume 139, pages 2189-2200, 2021. (Cited on pages 9 and 32)
[92] Z. Zhou, C. Zhou, X. Li, J. Yao, Q. Yao, and B. Han. On strengthening and defending graph reconstruction attack with markov chain approximation. In International Conference on Machine Learning, 2023. (Cited on page 21)
[93] Q. Zhu, Y. Jiao, N. Ponomareva, J. Han, and B. Perozzi. Explaining and adapting graph conditional shift. arXiv preprint, arXiv:2306.03256, 2023. (Cited on page 21)
[94] D. Zou, S. Liu, S. Miao, V. Fung, S. Chang, and P. Li. GDL-DS: A benchmark for geometric deep learning under distribution shifts. arXiv preprint, abs/2310.08677, 2023. (Cited on page 1)
Appendix of GALA
A Notations 19
B Limitations and Future Directions 19
C Full Details of the Background 19
D More Details about the Failure Cases 21
E Proofs for Theorems and Propositions 23
E.1 Proof of Proposition 3.2 23
E.2 Complementary discussion for Sec. 3.1 23
E.3 Proof of Proposition 3.4 24
E.4 Proof of Corollary 3.6 24
E.5 Proof of Theorem 4.1 24
F More Discussions on Practical Implementations of GALA 27
G More Details about the Experiments 30
G.1 Datasets 30
G.2Baselines and Evaluation Setup 31
G.3 Software and Hardware 33
G.4 Computational analysis 34
Typically, for graphs that appeared in the discussion, we will use the superscript to denote the sampling process (e.g.,  $G^p$  is the positive graph), and the subscript to denote the specific invariant (i.e.,  $G_c$ ) or spurious subgraph (i.e.,  $G_s$ ). Graph symbols with  $\widehat{G}$  are the predicted graphs of a model (i.e., the estimated invariant subgraph  $\widehat{G}_c$ . Below, we list some examples of graphs involved in this paper.
Table 4: Notations for graphs involved in this paper
Symbols	Definitions
G	the graph space
Gc	the space of subgraphs with respect to the graphs from G
Y	the label space
G ∈ G	a graph
G = (A, X)	a graph with the adjacency matrix A ∈ {0,1}n×n and node feature matrix X ∈ Rn×d
{G}	a set of graphs
Gp	a graph sampled as positive samples
Gn	a graph sampled as negative samples
Gs	a graph sampled according to CIGA [8]
Gc	the invariant subgraph with respect to G
Gs	the spurious subgraph with respect to G
Gcp	the invariant subgraph of a positive graph Gp
Gps	the spurious subgraph of a positive graph Gp
Gc	the estimated invariant subgraph
Gs	the estimated spurious subgraph
Gcp	the estimated invariant subgraph of a positive graph Gp
Gsp	the estimated spurious subgraph of a positive graph Gp
ΔGc⊆ Gc	the part of the underlying invariant subgraph Gc appeared in Gc
ΔGc=Gc-ΔGc	the complementary part of ΔGc with respect to the invariant subgraph Gc
B Limitations and Future Directions
Although our work establishes a set of minimal assumptions for feasible invariant graph learning when the environment partitions and auxiliary information about the environment are both not available, our work is built upon the minimal availability of the environment knowledge. Nevertheless, there could exist some additional information that may be helpful for environment augmentation. Therefore, it remains interesting to explore more theoretically grounded strategies to discover and leverage more environment information for identifying the graph invariance. When the direct environment augmentation is not feasible, GALA provides a suitable framework that one could easily manipulate the environment assistant model or the partitioning of the positive and negative graphs, to select the spurious features via the additional information and better identify the graph invariance.
In addition to the correlation strengths discussed in this work, there exist other factors, such as the size of spurious and invariant subgraphs, that affect the fitting of spurious and invariant patterns, another promising future direction is to discuss the influence of these factors to the design of environment assistant model and OOD generalization on graphs.
Besides, a better data partitioning strategy can be developed with uncertainty measures [51].
C Full Details of the Background
We give a more detailed background introduction about GNNs and Invariant Learning in this section.
Graph Neural Networks. Let  $G = (A, X)$  denote a graph with  $n$  nodes and  $m$  edges, where  $A \in \{0, 1\}^{n \times n}$  is the adjacency matrix, and  $X \in \mathbb{R}^{n \times d}$  is the node feature matrix with a node feature dimension of  $d$ . In graph classification, we are given a set of  $N$  graphs  $\{G_i\}_{i=1}^N \subseteq \mathcal{G}$  and their labels
$\{Y_{i}\}_{i = 1}^{N}\subseteq \mathcal{V} = \mathbb{R}^{c}$  from  $c$  classes. Then, we train a GNN  $\rho \circ h$  with an encoder  $h:\mathcal{G}\to \mathbb{R}^h$  that learns a meaningful representation  $h_G$  for each graph  $G$  to help predict their labels  $y_{G} = \rho (h_{G})$  with a downstream classifier  $\rho :\mathbb{R}^h\rightarrow \mathcal{V}$ . The representation  $h_G$  is typically obtained by performing pooling with a READOUT function on the learned node representations:
$$
h _ {G} = \operatorname {R E A D O U T} \left(\left\{h _ {u} ^ {(K)} \mid u \in V \right\}\right), \tag {10}
$$
where the READOUT is a permutation invariant function (e.g., SUM, MEAN) [75], and  $h_u^{(K)}$  stands for the node representation of  $u \in V$  at  $K$ -th layer that is obtained by neighbor aggregation:
$$
h _ {u} ^ {(K)} = \sigma \left(W _ {K} \cdot a \left(\left\{h _ {v} ^ {(K - 1)} \right\} \mid v \in \mathcal {N} (u) \cup \{u \}\right)\right), \tag {11}
$$
where  $\mathcal{N}(u)$  is the set of neighbors of node  $u$ ,  $\sigma(\cdot)$  is an activation function, e.g., ReLU, and  $a(\cdot)$  is an aggregation function over neighbors, e.g., MEAN.
(a) Graph generation SCM
(c) PIIF SCM
Figure 4: Full SCMs on Graph Distribution Shifts [8].
(d) MIIF SCM
Graph generation process. This work focuses on graph classification, while the results generalize to node classification as well using the same setting as in Wu et al. [72]. Specifically, we are given a set of graph datasets  $\mathcal{D} = \{\mathcal{D}_e\}_e$  collected from multiple environments  $\mathcal{E}_{\mathrm{all}}$ . Samples  $(G_i^e,Y_i^e)\in \mathcal{D}^e$  from the same environment are considered as drawn independently from an identical distribution  $\mathbb{P}^e$ . We consider the graph generation process proposed by Chen et al. [8] that covers a broad case of graph distribution shifts. Fig. 4 shows the full graph generation process considered in Chen et al. [8]. The generation of the observed graph  $G$  and labels  $Y$  are controlled by a set of latent causal variable  $C$  and spurious variable  $S$ , i.e.,
$$
G := f _ {\text {g e n}} (C, S).
$$
$C$  and  $S$  control the generation of  $G$  by controlling the underlying invariant subgraph  $G_{c}$  and spurious subgraph  $G_{s}$ , respectively. Since  $S$  can be affected by the environment  $E$ , the correlation between  $Y$ ,  $S$  and  $G_{s}$  can change arbitrarily when the environment changes.  $C$  and  $S$  control the generation of the underlying invariant subgraph  $G_{c}$  and spurious subgraph  $G_{s}$ , respectively. Since  $S$  can be affected by the environment  $E$ , the correlation between  $Y$ ,  $S$  and  $G_{s}$  can change arbitrarily when the environment changes. Besides, the latent interaction among  $C$ ,  $S$  and  $Y$  can be further categorized into Full Informative Invariant Features (FIIF) when  $Y \perp S|C$  and Partially Informative Invariant Features (PIIF) when  $Y \perp S|C$ . Furthermore, PIIF and FIIF shifts can be mixed together and yield Mixed Informative Invariant Features (MIIF), as shown in Fig. 4. We refer interested readers to Chen et al. [8] for a detailed introduction of the graph generation process.
Invariant graph representation learning. To tackle the OOD generalization challenge on graphs from Fig. 4, the existing invariant graph learning approaches generically aim to identify the underlying invariant subgraph  $G_{c}$  to predict the label  $Y$  [8, 72]. Specifically, the goal of OOD generalization on graphs is to learn an invariant GNN  $f \coloneqq f_{c} \circ g$ , which is composed of two modules: a) a featurizer  $g: \mathcal{G} \to \mathcal{G}_{c}$  that extracts the invariant subgraph  $G_{c}$ ; b) a classifier  $f_{c}: \mathcal{G}_{c} \to \mathcal{Y}$  that predicts the label  $Y$  based on the extracted  $G_{c}$ , where  $\mathcal{G}_{c}$  refers to the space of subgraphs of  $\mathcal{G}$ . The learning objectives of  $f_{c}$  and  $g$  are formulated as
$$
\max  _ {f _ {c}, g} I \left(\widehat {G} _ {c}; Y\right), \text {s . t .} \widehat {G} _ {c} \perp E, \widehat {G} _ {c} = g (G). \tag {12}
$$
Since  $E$  is not observed, many strategies are proposed to impose the independence of  $\widehat{G}_c$  and  $E$ . A common approach is to augment the environment information. For example, based on the
estimated invariant subgraphs  $\widehat{G}_c$  and spurious subgraphs  $\widehat{G}_s$ , Liu et al. [45], Wu et al. [72, 73] proposed to generate new environments, while Li et al. [41], Yang et al. [77] proposed to infer the underlying environment labels. However, we show that it is fundamentally impossible to augment faithful environment information in Sec. 3. Miao et al. [55, 56], Yu et al. [81, 82, 83] adopt graph information bottleneck to tackle FIIF graph shifts, and they cannot generalize to PIIF shifts. Our work focuses on PIIF shifts, as it is more challenging when without environment labels [43]. Fan et al. [17] generalized [40] to tackle severe graph biases, i.e., when  $H(S|Y) < H(C|Y)$ . Chen et al. [8] proposed a contrastive framework to tackle both FIIF and PIFF graph shifts, but limited to  $H(S|Y) > H(C|Y)$ . However, in practice it is usually unknown whether  $H(S|Y) < H(C|Y)$  or  $H(S|Y) > H(C|Y)$  without environment information.
More OOD generalization on graphs. In addition to the aforementioned invariant learning approaches, Bevilacqua et al. [5], Li et al. [42], Yehudai et al. [78], Zhou et al. [89] study the OOD generalization as an extrapolation from small graphs to larger graphs in the task of graph classification and link prediction. In contrast, we study OOD generalization against various graph distribution shifts formulated in Fig. 4. In addition to the standard OOD generalization tasks studied in this paper, Mahdavi et al. [52], Xu et al. [76] study the OOD generalization in tasks of algorithmic reasoning on graphs. Jin et al. [29] study the test-time adaption in the graph regime. Kamhoua et al. [31] study the 3D shape matching under the presence of noises. Gui et al. [22] propose an independence constraint onto the target label and environment label to improve the OOD generalization when environment labels are available. Liu et al. [48] adopt a flexible framework to tackle shifting graph distributions. Chen et al. [7], Tao et al. [65], Zhou et al. [91, 92] study the OOD generalization on graphs from the adversarial robustness perspective.
In addition to graph classification, Chen et al. [6], Wu et al. [72] study node classification. Liu et al. [47] propose a structural reweighting strategy to improve the OOD generalization of node classification. Lee et al. [39] propose to incorporate multiple modules to handle different degree modes in OOD node classification. You et al. [80], Zhu et al. [93] study unsupervised graph domain adaption. Gao et al. [19], Zhou et al. [88, 90] study the OOD link prediction.
Besides, Lucic et al. [49] aims to find counterfactual subgraphs for explaining GNNs, which focuses on post-hoc explainability while this work focuses on intrinsic interpretability.
Invariant learning without environment labels. There are also plentiful studies in invariant learning without environment labels. Creager et al. [12] proposed a minmax formulation to infer the environment labels. Liu et al. [46] proposed a self-boosting framework based on the estimated invariant and variant features. Liu et al. [44], Zhang et al. [85] proposed to infer labels based the predictions of an ERM trained model. Deng et al. [14], Pezeshki et al. [61] improve the inference of group labels based on feature learning and prediction correctness. However, Lin et al. [43] found failure cases in Euclidean data where it is impossible to identify the invariant features without given environment labels. Moreover, as the OOD generalization on graphs is fundamentally more difficult than Euclidean data [8], the question about the feasibility of learning invariant subgraphs without environment labels remains unanswered.
D More Details about the Failure Cases
We provide more empirical results and details about the failure case verification experiments in complementary to Sec. 3. The results are shown in Fig. 5. We compared different environment augmentation approaches the vanilla GNN model trained with ERM (termed ERM), and an interpretable GNN model trained with ERM (termed XGNN).
The failure cases are constructed according to the two-piece graph generation models. The specific description is given as the following.
Definition D.1 (3-class two-piece graphs). Each environment is defined with two parameters,  $\alpha_{e},\beta_{e}\in [0,1]$ , and the dataset  $\mathcal{D}_e$  is generated as follows:
(a) Sample  $y^{e} \in \{0,1,2\}$  uniformly;
(b) Generate  $G_{c}$  and  $G_{s}$  via :
$$
G _ {c} := f _ {g e n} ^ {G _ {c}} (Y \cdot R a d (\alpha_ {e})), G _ {s} := f _ {g e n} ^ {G _ {s}} (Y \cdot R a d (\beta_ {e})),
$$
(a) Failures of env. generation
(b) Failures of env. inferring
(c) Failures of resolving env. consistency
(d) Failures of env. generation
(e) Failures of env. inferring
(f) Failures of resolving env. consistency
Figure 5: Failures of finding faithful environment information. Results shown in the figure are based on the 3 class two-piece graphs (Def. D.1), where the invariant correlation strength is fixed as 0.7 while the spurious correlation strength is varied from 0.5 to 0.7. We can find that both environment augmentation and inferring approaches suffer from severe performance decreases or even underperform ERM and XGNN when the dominated correlation is not suitable for the method. In contrast, GALA maintains strong OOD performance for both cases.
where  $f_{\text{gen}}^{G_c}, f_{\text{gen}}^{G_s}$  respectively map input  $\{0,1,2\}$  to a specific graph selected from a given set, and  $\text{Rad}(\alpha)$  is a random variable with probability  $\alpha$  taking a uniformly random value from  $\{0,1,2\}$ , and a probability of  $1 - \alpha$  taking the value of  $+1$ ;
(c) Synthesize  $G$  by randomly concatenating  $G_{c}$  and  $G_{s}$ :
$$
G := f _ {g e n} ^ {G} \left(G _ {c}, G _ {s}\right).
$$
In experiments, we implement the 3-class two-piece graphs with the BA-motifs [50] model.
In experiments, we adopt a 3-layer GIN [75] with a hidden dimension of 32 and a dropout rate of 0.0 as the GNN encoder. The XGNN architecture is implemented via two GNNs following the original implementation as CIGA. The optimization is proceeded with Adam [34] using a learning rate of  $1e - 3$ . All experiments are repeated with 5 different random seeds of  $\{1,2,3,4,5\}$ . The mean and standard deviation are reported from the 5 runs.
We implement DIR [73], GREA [45], MoleOOD [77], GIL [41], DisC [17], and CIGA [8], according to the author provided codes (if available). As for the hyperparameters in each method, we use a penalty weight of  $1e - 2$  for DIR following its original experiment in spurious motif datasets generated similarly using BA-motifs [73]. We use a penalty weight of 1 for GREA as we empirically it does not affect the performance by changing to different weights. For MoleOOD and GIL, we set the number of environments as 3. We tune the penalty weights of MoleOOD with values from  $\{1e - 2, 1e - 1, 1, 10\}$  but did not observe much performance differences. We tune the penalty weights of GIL with values from  $\{1e - 5, 1e - 3, 1e - 1\}$  recommended by the authors. For DisC, we tune only the  $q$  weight from  $\{0.9, 0.7, 0.5\}$  in the GCE loss as we did not observe performance differences by changing the weight of the other term. We tune the penalty weight of CIGA with values from  $\{0.5, 1, 2, 4, 8, 16, 32\}$  as recommended by the authors.
E Proofs for Theorems and Propositions
E.1 Proof of Proposition 3.2
Proposition E.1. (Restatement of Proposition 3.2) Consider the two-piece graph dataset  $\mathcal{E}_{tr} = \{(\alpha, \beta_1), (\alpha, \beta_2)\}$  with  $\alpha \geq \beta_1, \beta_2$  (e.g.,  $\mathcal{E}_{tr} = \{(0.25, 0.1), (0.25, 0.2)\}$ ), and its corresponding mixed environment  $\mathcal{E}_{tr}^{mix} = \{(\alpha, (\beta_1 + \beta_2)/2)\}$  (e.g.,  $\mathcal{E}_{tr}^{mix} = \{(0.25, 0.15)\}$ ). When  $\widehat{G}_c = G_s$  and  $\widehat{G}_s = G_c$ , it holds that the augmented environment  $\mathcal{E}_v$  is also a two-piece graph dataset with
$$
\mathcal {E} _ {v} = \left\{\left(0. 5, \left(\beta_ {1} + \beta_ {2}\right) / 2\right) \right\} (e. g., \mathcal {E} _ {v} = \left\{\left(0. 5, 0. 1 5\right) \right\}).
$$
Proof. From Definition 3.1, we know that for each graph  $G_{i} \sim \mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}} = \{(\alpha, (\beta_{1} + \beta_{2}) / 2)\}$ ,  $G_{i}$  is the concatenation of the  $G_{c}^{i}$  and  $G_{s}^{i}$  defined as
$$
G _ {c} ^ {i} := f _ {\text {g e n}} ^ {G _ {c}} \left(Y _ {i} \cdot \operatorname {R a d} (\alpha) _ {i}\right), \quad G _ {s} ^ {i} := f _ {\text {g e n}} ^ {G _ {s}} \left(Y _ {i} \cdot \operatorname {R a d} \left(\left(\beta_ {1} + \beta_ {2}\right) / 2\right) _ {i}\right),
$$
where  $\operatorname{Rad}(\cdot)_i$  denotes the  $i$ th sample of the random variable  $\operatorname{Rad}(\cdot)$ .
$$
G _ {A} = f _ {\text {g e n}} ^ {G _ {c}} (+ 1), G _ {B} = f _ {\text {g e n}} ^ {G _ {c}} (- 1),
$$
$$
G _ {C} = f _ {\text {g e n}} ^ {G _ {s}} (+ 1), G _ {D} = f _ {\text {g e n}} ^ {G _ {s}} (- 1),
$$
Considering applying the augmentation to  $2n$  samples randomly sampled from  $\mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}$ , since the featurizer  $g$  separates each  $G \in \mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}$  into  $\widehat{G}_c = G_s$  and  $\widehat{G}_s = G_c$ , and the augmented graph  $G^i$  is obtained by
$$
G ^ {i, j} = f _ {\text {g e n}} ^ {G} \left(\widehat {G} _ {c} ^ {i}, \widehat {G} _ {s} ^ {j}\right), \forall i, j \in \{1 \dots n \}.
$$
Then, the new  $\alpha_v, \beta_v$  in  $\mathcal{E}_v$  can be obtained by summing up the overall numbers of  $G_A, G_B, G_C, G_D$  concatenated into  $2n^2$  samples in  $\mathcal{E}_v$ .
Specifically, we can inspect the changes of the distributions of motifs and labels. Let  $\bar{\beta} = (\beta_{1} + \beta_{2}) / 2$ , without loss of generality, we focus on inspecting the changes given  $Y = +1$ , since the changes given  $Y = -1$  is symmetric as  $Y = +1$ . The original distribution is shown as follows:
Y = +1	GA	GB
GC	(1 - α)(1 - β)n	α(1 - β)n
GD	(1 - α)βn	αβn
Then, new distributions of the motifs and labels are determined by the number of original motifs identified as  $\widehat{G}_c$  and  $\widehat{G}_s$ , respectively. When  $\widehat{G}_c = G_s$  and  $\widehat{G}_s = G_c$ , in the new environment  $\mathcal{E}_v$ , given  $Y = +1$ ,  $G_C$  contributes  $(1 - \bar{\beta})n * 2n$  samples as the "invariant" subgraph. More specifically,  $G_C$  will be concatenated with  $G_A$  and  $G_B$  by  $n$  times, respectively. Then we have the new distribution tables shown as follows:
Y = +1	GA	GB
GC	(1-β)n2	(1-β)n2
GD	βn2	βn2
Since given the same  $Y$ , the spurious subgraph  $G_{C}$  and  $G_{D}$  will still have the same chance being flipped, we have  $\beta_v = \bar{\beta}$ . While as  $G_{A}$  and  $G_{B}$  appear the same times given the same  $Y$ , it suffices to know that  $\alpha_v = 0.5$ .
E.2 Complementary discussion for Sec. 3.1
Proposition E.2. Given the same graph generation process as in Fig. 2, when there exists spurious subgraph  $G_{s}$  such that  $P^{e_1}(Y|G_s) = P^{e_2}(Y|G_s)$  for any two environments  $e_1,e_2\in \mathcal{E}_{tr}$ , where  $P^e (Y|G_s)$  is the conditional distribution  $P(Y|G_{s})$  under environment  $e\in \mathcal{E}_{all}$ , it is impossible for any learning algorithm applied to  $f_{c}\circ g$  to differentiate  $G_{c}$  from  $G_{s}$ .
Proof. Let  $G_{s}^{*}$  be the spurious subgraph such that  $P^{e_1}(Y|G_s) = P^{e_2}(Y|G_s)$  for any two environments  $e_1, e_2 \in \mathcal{E}_{\mathrm{tr}}$ , and  $G_{c}$  be the invariant subgraph which  $P^{e_1}(Y|G_c) = P^{e_2}(Y|G_c)$ ,  $\forall e_1, e_2 \in \mathcal{E}_{\mathrm{tr}}$  by definition. Consider a learning algorithm applied to  $f_{c} \circ g$  that accepts the input of  $\mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}$ , and extracts a subgraph  $\widehat{G}_c = g(Y)$  as an estimation of the invariant subgraph for any  $G$  to predict  $Y$  via  $f_{c}(\widehat{G}_{c})$  in a deterministic manner. If the algorithm succeeds to extract  $G_{c}$  from  $\mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}$ , then there always exists a  $\mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}'$  with the desired spurious subgraph  $G_{s}'$  and a underlying invariant subgraph  $G_{c}'$ , such that  $G_{s}' = G_{c}$  and  $G_{c}' = G_{s}^{*}$ . Due to the deterministic nature, the algorithm fails to identify  $G_{c}'$  in  $\mathcal{E}_{\mathrm{tr}}^{\mathrm{mix}}'$ .
E.3 Proof of Proposition 3.4