SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\begin{array}{l} \mathbf {P} _ {1} (\mathbf {y} _ {u} = c _ {1} | \mathbf {f} _ {u}) = \frac {\mathbf {P} _ {1} (\mathbf {f} _ {u} | \mathbf {y} _ {u} = c _ {1}) \mathbf {P} (\mathbf {y} _ {u} = c _ {1})}{\mathbf {P} _ {1} (\mathbf {f} _ {u} | \mathbf {y} _ {u} = c _ {1}) \mathbf {P} (\mathbf {y} _ {u} = c _ {1}) + \mathbf {P} _ {1} (\mathbf {f} _ {u} | \mathbf {y} _ {u} = c _ {2}) \mathbf {P} (\mathbf {y} _ {u} = c _ {2})} \\ \underset {(a)} {=} \frac {\mathbf {P} _ {1} \left(\mathbf {f} _ {u} \mid \mathbf {y} _ {u} = c _ {1}\right)}{\mathbf {P} _ {1} \left(\mathbf {f} _ {u} \mid \mathbf {y} _ {u} = c _ {1}\right) + \mathbf {P} _ {1} \left(\mathbf {f} _ {u} \mid \mathbf {y} _ {u} = c _ {2}\right)} \tag {22} \\ = \frac {\exp \left(\frac {(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}) ^ {2}}{\sigma^ {2}}\right)}{\exp \left(\frac {(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}) ^ {2}}{\sigma^ {2}}\right) + \exp \left(\frac {(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 2} ^ {\prime}) ^ {2}}{\sigma^ {2}}\right)} \\ \end{array}
$$
where (a) we utilize the assumption  $\mathbf{P}(\mathbf{y} = c_1) = \mathbf{P}(\mathbf{y} = c_2)$ . Notably, such assumption aims to simplify for an elegant expression and better understanding, which is not necessary in our proof.
Hence, we have:
$$
\begin{array}{l} \left| \mathbf {P} _ {1} \left(\mathbf {y} _ {u} = c _ {1} \mid \mathbf {f} _ {u}\right) - \mathbf {P} _ {2} \left(\mathbf {y} _ {v} = c _ {1} \mid \mathbf {f} _ {v}\right) \right| \\ = \left| \frac {\exp \left(- \frac {\left\| \mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right)}{\exp \left(- \frac {\left\| \mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {\left\| \mathbf {f} _ {u} - \boldsymbol {\mu} _ {2 1} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right)} - \frac {\exp \left(- \frac {\left\| \mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right)}{\exp \left(- \frac {\left\| \mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {\left\| \mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime} \right\| ^ {2}}{\sigma^ {2}}\right)} \right| \\ = \frac {\left| \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \exp \left(- \frac {\left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) - \exp \left(- \frac {\left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {2 1} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \right|}{\left[ \exp \left(- \frac {| | \mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime} | | ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {| | \mathbf {f} _ {u} - \boldsymbol {\mu} _ {2 1} ^ {\prime} | | ^ {2}}{\sigma^ {2}}\right) \right] \left[ \exp \left(- \frac {| | \mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime} | | ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {| | \mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime} | | ^ {2}}{\sigma^ {2}}\right) \right]} \tag {23} \\ \end{array}
$$
Notably, the denominator can be denoted as
$$
\mathbf {m} = \left[ \exp \left(- \frac {\left| \left| \mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime} \right| \right| ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {\left| \left| \mathbf {f} _ {u} - \boldsymbol {\mu} _ {2 1} ^ {\prime} \right| \right| ^ {2}}{\sigma^ {2}}\right) \right] \left[ \exp \left(- \frac {\left| \left| \mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime} \right| \right| ^ {2}}{\sigma^ {2}}\right) + \exp \left(- \frac {\left| \left| \mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime} \right| \right| ^ {2}}{\sigma^ {2}}\right) \right] \tag {24}
$$
where each exponential component is in  $\exp \left(-\frac{||\mathbf{f}_i - \boldsymbol{\mu}_{ij}'||^2}{\sigma^2}\right) \in [0,1]$ . Therefore, the denominator  $\mathbf{m}$  is in the range  $[0,4]$ . We then denote  $\mathbf{m} = \exp (-A)$ , where  $A$  is a constant, correspondingly. Hence,
we can have:
$$
\begin{array}{l} \left| \mathbf {P} _ {1} \left(\mathbf {y} _ {u} = c _ {1} \mid \mathbf {f} _ {u}\right) - \mathbf {P} _ {2} \left(\mathbf {y} _ {v} = c _ {1} \mid \mathbf {f} _ {v}\right) \right| \\ = \frac {\left| \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \exp \left(- \frac {\left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) - \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \exp \left(- \frac {\left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 1} ^ {\prime}\right) ^ {2}}{\sigma_ {2} ^ {2}}\right) \right|}{\exp (- A)} \\ = \left| \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}\right) ^ {2} + \left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}} - A\right) - \exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 2} ^ {\prime}\right) ^ {2} + \left(\mathbf {f} _ {2} - \boldsymbol {\mu} _ {2 1} ^ {\prime}\right) ^ {2}}{\sigma^ {2}} - A\right) \right| \\ \leq \frac {1}{(a)} \frac {1}{\sigma^ {2}} \left| \left[ \left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}\right) ^ {2} - \left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {1 2} ^ {\prime}\right) ^ {2} \right] + \left[ \left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {2 1} ^ {\prime}\right) ^ {2} - \left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2}\right) ^ {2} \right] \right| \\ \frac {1}{(b)} \frac {1}{\sigma^ {2}} \left[ \left(\mathbf {f} _ {u} - \frac {p ^ {(1)} \boldsymbol {\mu} _ {1} + q ^ {(1)} \boldsymbol {\mu} _ {2}}{p ^ {(1)} + q ^ {(1)}}\right) ^ {2} - \left(\mathbf {f} _ {v} - \frac {p ^ {(2)} \boldsymbol {\mu} _ {1} + q ^ {(2)} \boldsymbol {\mu} _ {2}}{p ^ {(2)} + q ^ {(2)}}\right) ^ {2} \right] \\ + \left[ \left(\mathbf {f} _ {u} - \frac {p ^ {(1)} \boldsymbol {\mu} _ {2} + q ^ {(1)} \boldsymbol {\mu} _ {1}}{p ^ {(1)} + q ^ {(1)}}\right) ^ {2} - \left(\mathbf {f} _ {v} - \frac {p ^ {(2)} \boldsymbol {\mu} _ {2} + q ^ {(2)} \boldsymbol {\mu} _ {1}}{p ^ {(2)} + q ^ {(2)}}\right) ^ {2} \right] \\ \leq \frac {\left\| \boldsymbol {\mu} _ {1} - \boldsymbol {\mu} _ {2} \right\|}{\sqrt {2 \pi} \sigma} \left(\left\| \mathbf {f} _ {u} - \mathbf {f} _ {v} \right\| + \left| \frac {p ^ {(1)}}{p ^ {(1)} + q ^ {(1)}} - \frac {p ^ {(2)}}{p ^ {(2)} + q ^ {(2)}} \right| \cdot \left\| \boldsymbol {\mu} _ {1} - \boldsymbol {\mu} _ {2} \right\|\right) \\ \underset {(c)} {=} \frac {1}{\sqrt {2 \pi} \sigma} \left| h _ {1} - h _ {2} \right| \cdot \rho^ {2} \tag {25} \\ \end{array}
$$
$\rho = \|\pmb{\mu}_1 - \pmb{\mu}_2\|$  is the original feature separability, independent with structure.  $|h_1 - h_2|$  is the homophily ratio difference between node 1 and 2. We explain the key steps as follows: (a) is derived from Lagrange's mean value theorem. From the Lagrange mean value theorem we have,
$$
\exp (- x) - \exp (- y) = - \exp (- \xi) (y - x) \tag {26}
$$
where  $\xi$  is between  $x$  and  $y$ . Therefore,
$$
\left| \exp (- x) - \exp (- y) \right| = \exp (- \xi) | y - x | \leq | x - y | \tag {27}
$$
since  $\exp (-\xi)\leq 1$
Knowing that  $|\mathbf{P}_1(\mathbf{y}_u = c_1|\mathbf{f}_u) - \mathbf{P}_2(\mathbf{y}_v = c_1|\mathbf{f}_v)| < 1$ , we can easily get
$$
\frac {\exp \left(- \frac {\left(\mathbf {f} _ {u} - \boldsymbol {\mu} _ {1 1} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) \exp \left(- \frac {\left(\mathbf {f} _ {v} - \boldsymbol {\mu} _ {2 2} ^ {\prime}\right) ^ {2}}{\sigma^ {2}}\right) - \exp (B)}{\exp (- A)} <   1 \tag {28}
$$
where  $\exp(B) > 0$ , we can get  $\frac{(\mathbf{f}_u - \boldsymbol{\mu}_{11}^{\prime})^2 + (\mathbf{f}_u - \boldsymbol{\mu}_{22}^{\prime})^2}{\sigma^2} > A$ . Similarly, with  $|\mathbf{P}_1(\mathbf{y}_u = c_1 | \mathbf{f}_u) - \mathbf{P}_2(\mathbf{y}_v = c_1 | \mathbf{f}_v)| > 0$ , we can get  $\frac{(\mathbf{f}_2 - \boldsymbol{\mu}_{12}^{\prime})^2 + (\mathbf{f}_2 - \boldsymbol{\mu}_{21}^{\prime})^2}{\sigma^2} > A$ .
In conclusion, we have:
$$
A - \frac {\left(\mathbf {f} _ {2} - \boldsymbol {\mu} _ {1 2} ^ {\prime}\right) ^ {2} + \left(\mathbf {f} _ {2} - \boldsymbol {\mu} _ {2 1} ^ {\prime}\right) ^ {2}}{\left(\mathbf {f} _ {2} - \boldsymbol {\mu} _ {1} ^ {\prime}\right) ^ {2} + \left(\mathbf {f} _ {2} - \boldsymbol {\mu} _ {1} ^ {\prime}\right) ^ {2}} <   0 \tag {29}
$$
$$
A - \frac {(\mathbf {f} _ {1} - \boldsymbol {\mu} _ {1 1} ^ {\prime}) ^ {2} + (\mathbf {f} _ {1} - \boldsymbol {\mu} _ {2 2} ^ {\prime}) ^ {2}}{\sigma^ {2}} <   0
$$
Let  $x = A - \frac{(\mathbf{f}_2 - \boldsymbol{\mu}_{12}^{\prime})^2 + (\mathbf{f}_2 - \boldsymbol{\mu}_{21}^{\prime})^2}{\sigma^2}$  and  $y = A - \frac{(\mathbf{f}_1 - \boldsymbol{\mu}_{11}^{\prime})^2 + (\mathbf{f}_1 - \boldsymbol{\mu}_{22}^{\prime})^2}{\sigma^2}$  in equation 27. The proof is complete.
(b) we utilize  $\pmb{\mu}_{i1}^{\prime} = \frac{p^{(i)}\pmb{\mu}_{1} + q^{(i)}\pmb{\mu}_{2}}{p^{(i)} + q^{(i)}}$  and  $\pmb{\mu}_{i2}^{\prime} = \frac{p^{(i)}\pmb{\mu}_{2} + q^{(i)}\pmb{\mu}_{1}}{p^{(i)} + q^{(i)}}$
(c) we utilize  $\mathbf{f}_u = \mathbf{f}_v$  and  $h_i = \frac{p^{(i)}}{p^{(i)} + q^{(i)}}$ . Notice that, (c) step can be easily generally to the case that  $\mathbf{f}_u \neq \mathbf{f}_v$  with  $\| \mathbf{f}_u - \mathbf{f}_v \| \leq \epsilon$ . We can easily proof with the same logis. The lemma is shown as follows:
Lemma 2. With assumptions (1) A balance class distribution with  $\mathbf{P}(\mathbf{Y} = 1) = \mathbf{P}(\mathbf{Y} = 0)$  and (2) aggregated feature distribution shares the same variance  $\sigma I$ . When nodes have the same aggregated features  $\| \mathbf{f}_u - \mathbf{f}_v\| \leq \epsilon$  but different structural patterns,  $(p^{(1)}, q^{(1)})$  and  $(p^{(2)}, q^{(2)})$ , we can have:
$$
\left| \mathbf {P} _ {1} \left(y _ {u} = c _ {1} \mid \mathbf {f} _ {u}\right) - \mathbf {P} _ {2} \left(y _ {v} = c _ {1} \mid \mathbf {f} _ {v}\right) \right| \leq \frac {\rho}{\sqrt {2 \pi} \sigma} \left(\epsilon_ {m} + \left| h _ {1} - h _ {2} \right| \cdot \rho\right) \tag {30}
$$
$\rho = \| \pmb{\mu}_1 - \pmb{\mu}_2\|$  is the original feature separability, independent with structure. Lemma 2 implies that nodes with a small homophily ratio difference  $|h_1 - h_2|$  are likely to share the same class, and vice versa.
F Proof details of PAC-Bayes Bound
In this section, we provide background knowledge, assumptions, and proof details on the PAC-Bayes analysis. Our PAC-Bayes bound is derived based on [46], which is the first PAC-Bayesian analysis for GNN on the semi-supervised node classification task. A details comparison between our bound and [46] can be found in Appendix A.
F.1 Background Knowledge on PAC-Bayes Analysis
PAC-Bayes Analysis The Probably Approximately Correct-Bayesian (PAC-Bayes) analysis [48] is a powerful theoretical framework utilizing Bayesian learning principles for analyzing the generalization ability of machine learning models. Typically, PAC-Bayesian Analysis is to connect and bound the difference between a training error of a machine learning model with its expected generalization error. Various PAC-Bayes bounds [49, 95, 50, 51] are proposed for advanced Deep Learning models in recent years. Such theoretical guidance shows practical success in many real-world applications including pretraining model [96], medical image [97], and robustness [98].
PAC-Bayes analysis on Graph Neural Networks [90] is the first PAC-Bayesian generalization bound for GNNs. Nonetheless, it focuses on the i.i.d. graph classification task, which is different from the non-i.i.d. node classification task. [46] provides the first PAC-Bayesian generalization bound for GNN on semi-supervised node classification task. Our following theorem is developed based on it and generalized into more generalized scenarios. A more detailed discussion on the difference of our work and [46] can be found in the Appendix A.
F.2 PAC-Bayesian Analysis on Subgroup Generalization bound of Deterministic classifier
In this section, we provide a more detailed discussion on the PAC-Bayesian analysis with the semi-supervised subgroup Generalization bound of Deterministic classifiers proposed in [46], which serves as the basis of proof. Notably, in the main content, we denote the training node subgroup as  $V_{\mathrm{tr}}$ . As we focus on the relationship between the train nodes and test subgroups  $V_{m}$  with  $0 < m \leq M$ , we re-denote the train nodes as  $V_{0}$ . The PAC-Bayesian analysis on subgroup Generalization bound of Deterministic classifiers, focusing on the deterministic classifiers  $\tilde{h}$ , a classifier drawn in the predictor family  $\mathcal{H}$ , learned on training nodes. The primary objective of the PAC-Bayesian analysis is to derive bounds on the generalization gap between the empirical margin loss of  $\tilde{h}$  denoting as  $\hat{\mathcal{L}}_0^\gamma (\tilde{h})$  on the train node subgroup  $V_{0}$  and the corresponding expected margin loss  $\mathcal{L}_m^0 (\tilde{h})$  on the test node subgroup  $V_{m}$ . The empirical marginal loss  $\hat{\mathcal{L}}_0^\gamma (\tilde{h})$  on the train node subgroup  $V_{0}$  is defined as:
$$
\widehat {\mathcal {L}} _ {0} ^ {\gamma} (\tilde {h}) := \frac {1}{N _ {0}} \sum_ {i \in V _ {0}} \mathbb {1} \left[ \tilde {h} _ {i} (X, G) [ y _ {i} ] \leq \gamma + \max  _ {k \neq y _ {i}} \tilde {h} _ {i} (X, G) [ k ] \right], \tag {31}
$$
where  $\mathbb{1}[\cdot ]$  is the indicator function and  $\gamma$  is the margin.  $V_{0}$  is the training node set.  $N_0 = |V_0|$  is the number of the training node.  $y_{i}$  is the label corresponding to node  $i\in V_0$ .  $\tilde{h}_i(X,G)\in \mathbb{R}^K$  is the predictor output, where  $\tilde{h}_i(X,G)[k]$  refers to the prediction probability of class  $k$  on sample  $i\in V_0$ .
The expected margin loss is the expectation of  $\mathcal{L}_m^0 (\tilde{h})$  on the test node subgroup  $V_{m}$  of the corresponding empirical loss  $\hat{\mathcal{L}}_m^0 (\tilde{h})$ .
$$
\mathcal {L} _ {m} ^ {0} (\tilde {h}) := \mathbb {E} _ {y _ {i} \sim \Pr \left(\mathrm {y} \mid g _ {i} (X, G)\right), i \in V _ {m}} \widehat {\mathcal {L}} _ {m} ^ {0} (\tilde {h}). \tag {32}
$$
where  $\operatorname{Pr}(\mathbf{y} \mid g_i(X, G))$  is the conditional distribution.  $g(X, G): \mathbb{R}^{N \times D} \times \mathcal{G}_N \to \mathbb{R}^{N \times D'}$  is the aggregation function, typically,  $g_i(X, G) = \frac{1}{|\mathcal{N}(i)|} \sum_{j \in \mathcal{N}(i)} X_j$  as default.  $\mathcal{G}_n$  is the space for all undirected graphs with  $n$  nodes.
To bound the generalization gap between the expected margin loss  $\mathcal{L}_m^0 (\tilde{h})$  on test subgroup  $V_{m}$  and the empirical margin loss  $\widehat{\mathcal{L}}_0^\gamma$  on train subgroup  $V_{0}$ . The theorem is shown as follows:
Theorem 2 (Subgroup Generalization of Deterministic Classifiers [46]). Let  $\tilde{h}$  be any classifier in  $\mathcal{H}$ . For any  $0 < m \leq M$ , for any  $\lambda > 0$  and  $\gamma \geq 0$ , for any "prior" distribution  $P$  on  $\mathcal{H}$  that is independent of the training data on  $V_0$ , with probability at least  $1 - \delta$  over the sample of  $y^0$ , for any  $Q$  on  $\mathcal{H}$  such that  $\mathrm{Pr}_{h \sim Q}\left(\max_{i \in V_0 \cup V_m} \| h_i(X, G) - \tilde{h}_i(X, G) \|_\infty < \frac{\gamma}{8}\right) > \frac{1}{2}$ , we have
$$
\mathcal {L} _ {m} ^ {0} (\tilde {h}) \leq \widehat {\mathcal {L}} _ {0} ^ {\gamma} (\tilde {h}) + \frac {1}{\lambda} \left(\underbrace {2 \left(D _ {\mathrm {K L}} (Q \| P) + 1\right)} _ {(a)} + \ln \frac {1}{\delta} + \frac {\lambda^ {2}}{4 N _ {t r}} + D _ {m, 0} ^ {\gamma / 2} (P; \lambda)\right) \tag {33}
$$
The generalization bound is typically related to the following four terms: (a)  $D_{\mathrm{KL}}(Q \| P) \coloneqq \int \ln \frac{dQ}{dP} dQ$  is the KL-divergence between the learned (posterior) predictor distribution  $Q$  and the predefined (prior) distribution  $P$ , independent of the training data. The generalization gap is bounded by the discrepancy between  $P$  and  $Q$ . It is a general term in PAC-Bayes analysis considering as the model complexity measurement. (2)  $\frac{\lambda^2}{4N_0}$  will vanish with larger number of training samples  $N_0$ . Notably, the above two common terms in PAC-Bayes analysis are not our focus. (3)  $\ln \frac{1}{\delta}$  is the term related with the probability  $1 - \delta$ . (4) The expected loss Discrepancy between the training nodes  $V_0$  and targeted test node subgroup  $V_m$  is essential in our analysis, denoted as:
$$
D _ {m, 0} ^ {\gamma / 2} (P; \lambda) = \ln \mathbb {E} _ {h \sim P} e ^ {\lambda \left(\mathcal {L} _ {m} ^ {\gamma / 4} (h) - \mathcal {L} _ {0} ^ {\gamma / 2} (h)\right)} \tag {34}
$$
where a prior distribution  $P$  over  $\mathcal{H}$ ,  $\gamma$  is the corresponding loss margin,  $\lambda > 0$  is a parameter, reflects the concentration of the learning distribution  $Q$ . Intuitively speaking, the term  $D_{m,0}^{\gamma /2}(P;\lambda)$  signifies the difference in expected loss between  $V_{m}$  and  $V_{0}$ , evaluated in an expectation with respect to the prior distribution  $P$ .
The expected loss Discrepancy is typically for the non-i.i.d. semi-supervised setting, which trivially comes true in i.i.d. setting. In the i.i.d. case, all samples in  $V_{m}$  and  $V_{0}$  are i.i.d., where  $\mathcal{L}_m^{\gamma /4}(h) = \mathcal{L}_0^{\gamma /4}(h) < \mathcal{L}_0^{\gamma /2}(h) \leq 0$  for any classifier  $h$ , leading to a trivial upper bound  $D_{m,0}^{\gamma /2}(P; \lambda) \leq 0$ . To provide a meaningful upper bound, we are required to essentially assume there exists the relationship between train node subgroup  $V_{0}$  and test node subgroup  $V_{m}$ . Typically, we expect the expected margin loss  $\mathcal{L}_m^{\gamma /4}(h)$  on  $V_{m}$  is not much larger than  $\mathcal{L}_0^{\gamma /2}(h)$  on  $V_{0}$  when the number of samples becomes large. Taking a further step, to bound the difference  $\mathcal{L}_m^{\gamma /4}(h) - \mathcal{L}_0^{\gamma /2}(h)$ , we should find suitable assumptions and derive proof to bound on (1) the difference on  $P(g(X, G))$  controlling with the feature distance between  $V_{0}$  and  $V_{m}$ . (2) The difference on  $P(Y|g(X, G))$  controlling with the homophily ratio as shown in Lemma 1.
F.3 Proof details of Expected Loss Discrepancy
To establish the generalization guarantee, it becomes necessary to provide an upper bound for the expected loss discrepancy,  $D_{m,0}^{\gamma}(P;\lambda)$ , which is the main focus in the proof. It emerges that certain assumptions about the data are required to derive a meaningful and useful upper bound. The assumptions are shown as follows. Notably, the assumptions 2 and 3 are adapted from [46]. Remark: Notably, the following proof is derived based on [46]. For completeness, we show the previous proof as follows, the difference is that we consider a more complicated conditional probability  $\mathbf{P}(y_i = k|g_i(X,G))$ , correlated with the homophily ratio difference, rather than consider the conditional probability as  $c$ -Lipschitz continuous functions. In other words, our proof further strengthens the effect of the structure disparity.
Definition 1 (Generalized CSBM-S model). Each node subgroup  $V_{m}$  follows the CSBM distribution  $V_{m} \sim CSBM(\pmb{\mu}_{1}, \pmb{\mu}_{2}, p^{(i)}, q^{(i)})$ , where different subgroups share the same class mean but different intra-class and inter-class probabilities  $p^{(i)}$  and  $q^{(i)}$ . Moreover, node subgroups also share the same degree distribution as  $p^{(i)} + q^{(i)} = p^{(j)} + q^{(j)}$ .
Instead of only considering one homophilic and one heterophilic pattern in CSBM-S model, the generalized CSBM-S model allows more diverse structural patterns with different levels of homophily.
Assumption 1 (Data follows Generalized CSBM-S model assumption). The graph data is generated from the Generalized CSBM-S model.
Assumption 2 (Equal-Sized and Disjoint Near Sets). For any  $0 < m \leq M$ , assume the near sets of each  $i \in V_0$  with respect to  $V_m$  are disjoint and have the same size  $s_m \in \mathbb{N}^+$ .
Assumption 2 assumes that  $V_{m}$  can be divided into equally sized partitions, each can be identified by the corresponding training samples. It assumes that test nodes are closely aligned with the respective training sample, while distant to the other training samples.
Definition 2 (Distance To Training Set and Near Set). For each  $0 < m \leq M$ , define the distance from the subgroup  $V_{m}$  to the training set  $V_{0}$  as
$$
\epsilon_{m}:= \max_{j\in V_{m}}\min_{i\in V_{0}}\| g_{i}(X,G) - g_{j}(X,G)\|_{2}.
$$
Further, for each  $i \in V_0$ , define the near set of  $i$  with respect to  $V_m$  as
$$
V _ {m} ^ {(i)} := \{j \in V _ {m} \mid \| g _ {i} (X, G) - g _ {j} (X, G) \| _ {2} \leq \epsilon_ {m} \}.
$$
$$
V _ {m} = \cup_ {i \in V _ {0}} V _ {m} ^ {(i)}.
$$
Assumption 3 (Concentrated Expected Loss Difference). Let  $P$  be a distribution on  $\mathcal{H}$ , defined by sampling the vectorized MLP parameters from  $\mathcal{N}(0, \sigma^2 I)$  for some  $\sigma^2 \leq \frac{(\gamma / 8\epsilon_m)^{2 / L}}{2b(\lambda N_0^{-\alpha} + \ln 2bL)}$ . For any  $L$ -layer GNN classifier  $h \in \mathcal{H}$  with model parameters  $W_1^h, \ldots, W_L^h$ , define  $T_h := \max_{l=1,\ldots,L} \|W_l^h\|_2$ . Assume that there exists some  $0 < \alpha < \frac{1}{4}$  satisfying
$$
\operatorname * {P r} _ {h \sim P} \left(\mathcal {L} _ {m} ^ {\gamma / 4} (h) - \mathcal {L} _ {0} ^ {\gamma / 2} (h) > N _ {0} ^ {- \alpha} + c K \epsilon_ {m} \mid T _ {h} ^ {L} \epsilon_ {m} > \frac {\gamma}{8}\right) \leq e ^ {- N _ {0} ^ {2 \alpha}}.
$$
Assumption 3 postulates that the expected margin loss on the test node subgroup,  $V_{m}$ , is not significantly larger than on the train node subgroup,  $V_{0}$ , as the number of training samples  $N_{0} = |V_{0}|$  becomes larger. More discussions about this assumption can be found in Appendix A.5 of [46].
Lemma 4 (Bound for  $D_{m,0}^{\gamma}(P; \lambda)$  (Adapton of Lemma 6 in [46])) Under Assumption 1, 2 and 3, for any  $0 < m \leq M$ , any  $0 < \lambda \leq N_0^{2\alpha}$  and  $\gamma \geq 0$ , assume the "prior"  $P$  on  $\mathcal{H}$  is defined by sampling the vectorized MLP parameters from  $\mathcal{N}(0, \sigma^2 I)$  for some  $\sigma^2 \leq \frac{(\gamma / 8\epsilon_m)^{2 / L}}{2b(\lambda N_0^{-\alpha} + \ln 2bL)}$ . We have
$$
D _ {m, 0} ^ {\gamma / 2} (P; \lambda) \leq \ln 3 + \frac {\lambda K \rho}{\sqrt {2 \pi} \sigma} (\epsilon + | h _ {0} - h _ {m} | \cdot \rho). \tag {35}
$$
We first present the following Lemma 5 that bounds the difference between the margin loss on  $V_{m}$  and that on  $V_{0}$ .
Lemma 5 (Adapton of Lemma 5 in [46]). Suppose an  $L$ -layer GNN classifier  $h$  is associated with model parameters  $W_{1}, \ldots, W_{L}$ . Define  $T_{h} \coloneqq \max_{l=1,\ldots,L} \|W_{l}\|_{2}$ . Under Assumption 1 and 2, for any  $0 < m \leq M$  and  $\gamma \geq 0$ , if  $\epsilon_{m} T_{h}^{L} \leq \frac{\gamma}{4}$ , then
$$
\mathcal {L} _ {m} ^ {\gamma / 2} (h) - \mathcal {L} _ {0} ^ {\gamma} (h) \leq \frac {K \rho}{\sqrt {2 \pi} \sigma} (\epsilon + | h _ {0} - h _ {m} | \cdot \rho) \tag {36}
$$
Proof. For simplicity in this proof, for any  $i \in V_0 \cup V_m$  and  $k = 1, \ldots, K$ , we use  $h_i$  to denote  $h_i(X, G)$  and use  $\eta_k(i)$  to denote  $\operatorname{Pr}(y_i = k \mid g_i(X, G))$ . And define  $\mathcal{L}^\gamma(h_i, y_i) := \mathbb{1}[h_i[y_i] \leq \gamma + \max_{k \neq y_i} h_i[k]]$ . Then we can write