Manuscript Offprint
arXiv:2610.07628Complementary Supervised and Self-Supervised Representations for Out-of-Distribution Graph Learning
Qingying Hao
ShanghaiTech University
Shanghai, China
Zikang Chen
ShanghaiTech University
Shanghai, China
chenzk2025@shanghaitech.edu.cn
Jinyuan Jia
The Pennsylvania State University
University Park, Pennsylvania, USA
Bo Li
University of Illinois
Urbana-Champaign
Urbana, Illinois, USA
Chuxuan Hu
University of Illinois
Urbana-Champaign
Urbana, Illinois, USA
Carl Gunter
University of Illinois
Urbana-Champaign
Urbana, Illinois, USA
Gang Wang
University of Illinois
Urbana-Champaign
Urbana, Illinois, USA
Abstract
Out-of-distribution (OOD) generalization remains challenging for graph neural networks (GNNs), as graph distributions can vary substantially across time and domains. Supervised and self-supervised graph representation learning are guided by distinct objectives and offer different perspectives on graph representations. In this work, we study whether self-supervised representations (SSL) can provide complementary signals to improve supervised OOD node classification. We develop two backbone-agnostic frameworks that exploit such information at different stages of learning and prediction. Co-Train jointly learns supervised and SSL representations and adaptively integrates them during training, while Dual-Space Retrieval performs non-parametric prediction in the two representation spaces and combines their predictions through confidence-aware fusion at inference time. The supervised and SSL encoders are separately parameterized and need not share the same GNN architecture.
We evaluate multiple GNN backbones and two distinct SSL objectives, DGI and GRACE, on four graph benchmarks spanning temporal and cross-domain distribution shifts. Extensive experiments show that Co-Train consistently outperforms strong supervised OOD baselines, while Dual-Space Retrieval achieves competitive performance as a flexible non-parametric alternative. Results across different backbones and SSL objectives, together with representation analyses and ablations, demonstrate that SSL representations provide complementary information to supervised representations and can improve OOD node classification across diverse settings.
CCS Concepts
• Computing methodologies → Neural networks.
Keywords
Graph neural networks, Out-of-distribution generalization, Supervised learning, Self-supervised learning
Most GNNs, however, assume that training and test data follow the same distribution, an assumption that rarely holds in practice [41, 42]. Graph distributions may evolve over time or vary substantially across domains. For example, transaction patterns in financial networks can change over time, while social networks from different communities may exhibit distinct structural and feature distributions. Such shifts can substantially degrade GNN performance [19, 39], motivating graph out-of-distribution (OOD) generalization.
Existing graph OOD methods have largely focused on supervised learning. A common strategy constructs multiple training environments through graph augmentations and encourages models to learn representations that remain predictive across these environments [32, 33, 36]. Other approaches use causal analysis to separate label-relevant factors from spurious correlations [4, 31]. While effective, supervised representations are optimized directly toward training labels and may capture label-correlated patterns that do not remain stable under distribution shifts [7, 13, 41].
Self-supervised learning (SSL) offers a complementary source of representation information. Methods such as DGI [28] and GRACE [43] learn graph representations without label supervision by exploiting
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
structural context or consistency across augmented graph views. However, SSL representations are not explicitly optimized for the downstream classification task. Graph augmentations may discard task-relevant information [25], while SSL representations may retain factors unrelated to the target labels [13, 20]. These different learning objectives motivate us to investigate whether SSL representations can provide useful complementary information to supervised representations for graph OOD generalization.
Our empirical analyses support this complementarity: supervised and SSL representations provide distinct signals, and integrating them improves OOD generalization across multiple datasets and settings. Based on this observation, we develop two mechanisms that incorporate SSL information at different stages of prediction: training-time adaptive representation integration and inference-time confidence-aware dual-space retrieval.
Our first framework, Co-Train, exploits this complementarity during training. It uses separately parameterized supervised and SSL encoders and jointly optimizes their representations for downstream classification. A gated fusion mechanism adaptively incorporates the SSL representation into the supervised representation, while an alignment objective encourages correspondence between the two representation spaces. Our second framework, Dual-Space Retrieval, operates at inference time without joint optimization of the two branches. It performs non-parametric prediction independently in the supervised and SSL spaces and combines their similarity-weighted prediction scores through confidence-aware fusion. Depending on the prediction setting, we use neighbor-based or class-centroid retrieval to obtain label signals from each representation space.
Both frameworks are backbone-agnostic: the supervised and SSL encoders do not share parameters and are not required to use the same GNN architecture. We instantiate the SSL branch with DGI and GRACE to evaluate whether the benefits generalize across different SSL objectives, and further evaluate the frameworks with multiple GNN backbones. This modular design allows SSL representations to complement supervised OOD learning without constraining either branch to a particular backbone or SSL objective.
We evaluate our frameworks on four graph OOD benchmarks, OGB-Arxiv, Elliptic, Twitch-Explicit, and Facebook-100, covering both temporal and cross-domain distribution shifts. Co-Train consistently improves over strong supervised OOD baselines across datasets, backbone architectures, and SSL objectives. Dual-Space Retrieval also achieves competitive performance across diverse settings, often providing the second-best results while offering a non-parametric alternative to joint training. Representation analyses and extensive ablations further demonstrate the benefit of combining supervised and SSL representations and characterize when each design is most effective. Co-Train is computationally efficient, while the retrieval cost of Dual-Space Retrieval depends on the retrieval set and can be substantially reduced through class-centroid retrieval.
Contributions. Our main contributions are:
• We empirically establish the complementarity of supervised and self-supervised representations for graph OOD generalization, showing that SSL representations can provide useful information beyond label-guided supervised representations.
• Based on this observation, we develop two backbone-agnostic frameworks that exploit this complementarity at different stages: Co-Train, which adaptively integrates supervised and SSL representations during training, and Dual-Space Retrieval, which performs confidence-aware non-parametric prediction over the two representation spaces at inference time.
• Extensive experiments across temporal and cross-domain shifts, multiple GNN backbones, and two SSL objectives demonstrate consistent improvements over strong supervised OOD baselines. Representation analyses, ablations, and sensitivity studies further validate the benefits of combining the two representation spaces and the generalizability of our designs across different model configurations.
• Co-Train provides an efficient training-time integration mechanism, while Dual-Space Retrieval offers a flexible non-parametric alternative whose retrieval cost can be substantially reduced through class-centroid representations.
2 Related Work
2.1 Graph Neural Networks
Graph neural networks (GNNs) have been widely used for graph-structured data. One class of methods builds on spectral graph theory, where graph convolution is defined in the frequency domain [6, 11]. For example, GCN [11] performs convolutional operation using a first-order Chebyshev polynomial approximation. Another class of methods is spatial-based GNNs, which define graph convolution over node neighborhoods. GraphSAGE [9] learns representation by sampling and aggregating information from local neighborhoods, while GAT [27] incorporates attention mechanisms to learn weights for neighbors. There are other works that solve vanishing gradients and gradient smoothing in deep GNNs, GCNII [2] introduces residual connections and identity mapping, while GPR-GNN [5] earns a flexible propagation scheme by weighting multi-hop neighborhood information, generalizing Personalized PageRank with learnable coefficients. Additional efforts have focused on other aspects, such as enhancing scalability [37] and improving the trustworthiness of GNNs.
2.2 Distribution Shift Detection in Graph Neural Networks
Supervised Learning Approaches. A range of supervised methods have been proposed for graph out-of-distribution (OOD) generalization, often by learning invariant representations across distribution shifts. ERM [26] minimizes classification loss over the training data without explicitly accounting for distribution shifts. DIR [33] constructs synthetic environments by sampling diverse subgraphs and applies causal analysis to learn invariant predictors, while EERM [32] dynamically generates environments through reinforcement learning and minimizes prediction risks across them. LiSA [36] generates label-invariant subgraphs and learns a shift-invariant encoder through an energy-based objective. GRM [29] further models invariant information by generating continuous invariant subgraphs. Other supervised approaches introduce additional mechanisms: GNNSafe [30] calibrates prediction confidence using energy functions, while KnowGraph [40] incorporates symbolic reasoning and domain knowledge for graph anomaly detection.
Despite their effectiveness, several supervised OOD methods rely on graph augmentations or synthetic environments, introducing additional training complexity and computational overhead. Moreover, representations learned solely through supervision may become specialized to label-correlated patterns in the training distribution that do not remain stable under OOD shifts.
Self-Supervised Learning Approaches. Self-supervised learning (SSL), particularly graph contrastive learning (GCL), provides an alternative way to learn graph representations without label supervision. DGI [28] learns node representations through local-global mutual information maximization, while GRACE [43] contrasts node representations across augmented graph views. InfoGraph [21] extends local-global contrastive learning to graph-level representations. More recent methods explore GCL in OOD settings. GOOD-D [12] targets graph-level OOD detection through local-global contrastive learning with OOD-aware scoring, while DeGEM [3] studies node-level OOD detection on heterophilic graphs using an energy-based model. AD-GCL [23] learns adversarial graph augmentations to improve representation invariance and incorporates an information bottleneck to suppress irrelevant information. MARIO [42] studies invariant graph contrastive learning for node-level OOD generalization under covariate and concept shifts. Beyond OOD generalization, GCAL [17] addresses unsupervised continual adaptation to out-of-distribution graph sequences.
Unlike supervised learning, SSL can capture structural information without being directly driven by task labels, but its representations are not explicitly optimized for the downstream prediction task and may retain task-irrelevant information. This motivates leveraging the strengths of both paradigms, using SSL representations to complement label-guided supervised representations. InfoGraph [21] also combines supervised and unsupervised objectives for graph representation learning. In contrast, we study their representational complementarity under OOD and exploit it through training-time representation fusion and inference-time prediction fusion.
2.3 Distance-Based Retrieval Methods for Robust Classification
Distance-based methods improve OOD robustness by comparing test representations with training examples and have been widely studied in vision [14, 16, 22, 38]. DkNN [14] estimates prediction confidence from the consistency of neighboring training representations, while other non-parametric KNN methods incorporate adaptive neighbor selection or test-time calibration [22, 38]. Nearest-neighbor similarity has also been used for post-hoc, training-free prediction adjustment [16]. Related ideas have been explored in NLP, where D2U compares model predictions with a uniform distribution to improve OOD robustness [34].
In graph learning, distance-based retrieval remains less explored for OOD generalization. Our Dual-Space Retrieval framework uses a non-parametric predictor over supervised and SSL representation spaces, producing similarity-weighted class scores in each space and combining them through confidence-aware fusion. This allows complementary representation spaces to contribute directly at inference time without training an additional classifier.
3 Preliminaries
3.1 OOD in Graph Structured Data
Distribution shift occurs when the underlying data distribution differs between training and testing, i.e., . For graph-structured data, such shifts may arise from changes in node features, graph structure, label distributions, or their relationships. In this work, we consider graph OOD generalization under naturally occurring distribution shifts across different domains or time periods.
3.2 Supervised Graph Representation Learning
Given a graph , where is the node feature matrix, is the adjacency matrix, and denotes the node labels, supervised graph representation learning uses label supervision to learn task-discriminative node representations. A GNN encoder maps to node representations through iterative message passing over local neighborhoods.
Let denote the representation of node at the -th GNN layer, with . A general message-passing layer can be expressed as
where denotes the neighbors of node , denotes optional edge features, computes messages from neighboring nodes, and and denote the aggregation and update functions, respectively.
For node classification, a classification head maps the learned representations to node predictions, . The encoder and classification head are jointly optimized as
where denotes the cross-entropy loss for supervised node classification.
3.3 Self-Supervised Graph Representation Learning
Unlike supervised representation learning, self-supervised graph representation learning learns node representations without relying on node labels. We consider two representative approaches, Deep Graph Infomax (DGI) [28] and GRACE [43], representing distinct contrastive learning paradigms: local–global contrast in DGI and node-level cross-view contrast in GRACE.
Deep Graph Infomax (DGI). DGI learns node representations by maximizing the mutual information between local node representations and a global summary of the graph. Given node representations , the global summary is obtained through a readout function . A corruption function generates a corrupted graph view , from which corrupted node representations are obtained. A discriminator
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
D scores the agreement between the node representations and the global summary. The DGI objective is defined as
Maximizing this objective encourages high agreement between the original node representations and the global summary while distinguishing representations from the corrupted graph view, thereby promoting local–global mutual information.
GRACE. Unlike DGI, which contrasts local node representations with a global graph summary, GRACE performs node-level contrastive learning across two independently augmented graph views. Specifically, two stochastic graph augmentations produce and , which are encoded by a shared GNN encoder:
For each node, its representations across the two views form a positive pair, while representations of other nodes serve as negatives. GRACE maximizes the following symmetric node-level InfoNCE objective:
where denotes the InfoNCE score that encourages agreement between positive pairs relative to negative pairs.
Downstream Node Classification. After self-supervised training with either DGI or GRACE, the learned GNN encoder is frozen and used to extract node representations for downstream classification. A trainable linear classifier is then learned on the labeled training nodes:
where denotes the frozen encoder parameters learned by the self-supervised objective.
4 Methodology
Our framework uses supervised representations as the primary prediction space and SSL representations as complementary signals for OOD generalization. We develop two mechanisms, illustrated in Figures 1 and 2. Co-Train jointly optimizes and integrates two separately parameterized encoders during training, whereas Dual-Space Retrieval uses a non-parametric predictor over independently learned representations and combines their prediction scores at inference time through confidence-aware fusion. Both frameworks are backbone-agnostic and allow the supervised and SSL branches to use different GNN architectures.
4.1 Co-Train
Our Co-Train framework jointly learns task-supervised and self-supervised representations using two GNN encoders. Given an input graph (X, A), the supervised encoder learns representations guided by node labels, while the self-supervised encoder captures complementary structural information through a self-supervised objective. Importantly, the two encoders do not share parameters and are not required to use the same backbone architecture, allowing the two branches to learn representations under their respective objectives.
We instantiate the self-supervised branch with either DGI or GRACE, representing local–global and node-level cross-view contrastive learning, respectively. This allows us to examine whether the benefits of Co-Train generalize across distinct self-supervised objectives.
For node , let and sl denote the representations produced by the supervised and self-supervised encoders, respectively. We first map them into a common -dimensional space using two learnable projection functions:
To combine the supervised and self-supervised representations, we use a gated fusion mechanism. Rather than directly adding the two representations, we compute an embedding-dependent gate from both representations to adaptively weight the SSL embedding before fusion. Let and denote the -normalized projected representations. The gate is computed as
where denotes concatenation, is a learnable gating network, and is the sigmoid function. The final representation is
where denotes element-wise multiplication. This keeps the supervised representation as the base while adaptively controlling the contribution of the SSL representation. We compare gated fusion with direct addition and concatenation in Section 5.4.
The fused representation is fed into the supervised classification head , and the resulting predictions are optimized using the supervised loss defined in Eq. 2. In addition, we encourage the supervised and self-supervised representations to remain compatible through an alignment objective over their normalized projected embeddings:
The self-supervised branch is jointly optimized using , which denotes the minimization form of the corresponding DGI or GRACE objective defined in Section 3.3; that is, for DGI and for GRACE. The overall Co-Train objective is then
where and control the contributions of the self-supervised and alignment objectives, respectively.
4.2 Dual-Space Retrieval
Dual-Space Memory Construction. Given a set of labeled training nodes , we obtain the supervised and self-supervised representations following the learning objectives defined in Equations 2 and 6, respectively. Let and denote the representations of node obtained from the supervised and self-supervised encoders, respectively. We construct two memory banks, one for each representation space:

Figure 1: Overview of Co-Train. The supervised and SSL branches use separate encoders without parameter sharing and are jointly optimized. A learned gate adaptively incorporates the complementary SSL representation into the supervised representation for prediction.
The two memory banks preserve the supervised and self-supervised representation spaces independently, with each training representation paired with its corresponding class label. Importantly, the two encoders are independently parameterized and need not share the same backbone architecture.
Neighbor-Based Retrieval Given a test node x, we perform retrieval independently in the supervised and self-supervised representation spaces. For each branch , we retrieve the k nearest training nodes from its corresponding memory bank according to cosine similarity. Specifically, the similarity between x and a retrieved node j is computed as
Within each representation space, we use the similarity-weighted non-parametric voting scheme of AdaNPC [38] to obtain prediction scores from the retrieved neighbors. Their cosine similarities are normalized into voting weights:
where is the retrieval temperature controlling the sharpness of the neighbor weights. We then aggregate the one-hot labels of the retrieved neighbors using their similarity weights:
where denotes the one-hot class label of neighbor . Applying this procedure independently to the two memory banks yields the class-wise prediction score vectors and from the supervised and self-supervised representation spaces, respectively.
Class-Centroid Retrieval. For multiclass prediction, instance-level KNN can be dominated by a small set of locally retrieved classes. We therefore consider class-centroid retrieval, which represents each class explicitly in the retrieval space.
For each branch and class , we compute the class centroid as
where denotes the set of training nodes belonging to class c. The C centroids form a class-level memory bank for each representation space. For a test node x, we perform retrieval over the class centroids using the same similarity-weighted scoring in Equations 13–15.
Additionally, we apply graph-aware feature smoothing before centroid construction, where each node representation is averaged with those of its graph neighbors. This reduces local representation variation and encourages neighboring nodes to form more coherent representations, yielding more representative class centroids for retrieval.
Confidence-Aware Dual-Space Fusion. The two representation spaces may provide prediction signals of different strengths for the same test node. We therefore adaptively determine their relative contributions based on retrieval confidence, assigning a larger weight to the branch with a more confident prediction. For each branch, we define its confidence as
The contribution of the supervised branch is then
with .
We further account for the agreement between the two prediction signals. Specifically, we measure their hard-label disagreement on the unlabeled target nodes as
When the two branches exhibit large disagreement ( ), we place greater emphasis on the supervised prediction by setting and using a small fixed (e.g., 0.01), instead of the confidence-based weights. Otherwise, we use the confidence-based weights defined above.
Finally, we combine the two prediction scores as
and predict .
5 Experiments
5.1 Experiment Setups
Datasets. We evaluate OOD node classification under two natural distribution shifts: temporal shifts in dynamic graphs and domain shifts across multiple graphs. Full dataset details are provided in Table 6 in Sec. A.
• Temporal transfer. We use Elliptic [15] for illicit transaction classification across time, and OGB-Arxiv [10] for paper subject classification across publication years.
• Cross-domain transfer. We use Twitch-Explicit (Twitch) [18] for explicit-language classification across regional user interaction graphs, and Facebook-100 (FB-100) [24] for gender classification across university social networks.
Baselines. We compare our method against representative supervised and self-supervised baselines:
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
Table 1: F1-score (%) on Elliptic across nine temporal test splits and different GNN backbones.
| Method (Backbone) | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 |
|---|---|---|---|---|---|---|---|---|---|
| ERM (SAGE) | 91.74 ± 1.85 | 85.27 ± 1.39 | 77.42 ± 1.41 | 73.64 ± 1.45 | 75.24 ± 2.88 | 76.92 ± 4.81 | 80.68 ± 1.74 | 65.96 ± 3.97 | 49.03 ± 0.85 |
| EERM (SAGE) | 86.59 ± 2.71 | 81.03 ± 2.55 | 76.68 ± 1.39 | 72.24 ± 1.99 | 75.20 ± 2.20 | 78.28 ± 3.33 | 72.77 ± 4.73 | 63.83 ± 3.98 | 49.14 ± 1.01 |
| LiSA (SAGE) | 92.58 ± 7.91 | 85.23 ± 8.41 | 79.00 ± 4.70 | 74.45 ± 5.10 | 74.95 ± 1.75 | 68.46 ± 4.90 | 70.42 ± 2.74 | 55.12 ± 2.09 | 47.19 ± 0.92 |
| MARIO (SAGE) | 90.51 ± 4.12 | 84.73 ± 2.02 | 77.62 ± 2.45 | 72.05 ± 3.42 | 73.18 ± 4.65 | 77.35 ± 6.43 | 63.71 ± 8.36 | 65.02 ± 7.16 | 48.79 ± 0.03 |
| DGI (SAGE) | 56.39 ± 6.63 | 53.46 ± 5.17 | 55.13 ± 5.19 | 52.81 ± 6.09 | 59.09 ± 5.01 | 56.12 ± 4.01 | 57.98 ± 4.77 | 50.36 ± 1.54 | 49.88 ± 1.25 |
| GRACE (SAGE) | 90.07 ± 3.14 | 83.72 ± 1.35 | 78.11 ± 1.72 | 72.22 ± 2.13 | 75.15 ± 3.25 | 80.58 ± 2.98 | 77.34 ± 5.95 | 71.03 ± 4.09 | 48.70 ± 0.08 |
| CoTrain-DGI (SAGE) | 93.78 ± 1.61 | 86.60 ± 1.07 | 79.49 ± 1.32 | 74.98 ± 0.76 | 77.86 ± 1.57 | 85.07 ± 1.27 | 85.22 ± 0.75 | 70.37 ± 1.56 | 49.91 ± 0.24 |
| CoTrain-GRACE (SAGE) | 93.98 ± 1.39 | 85.40 ± 0.96 | 77.57 ± 1.34 | 71.98 ± 1.58 | 75.91 ± 1.85 | 84.50 ± 1.67 | 85.72 ± 1.14 | 70.33 ± 1.34 | 49.95 ± 0.48 |
| Retrieval-DGI (SAGE) | 89.83 ± 1.25 | 82.82 ± 2.04 | 77.31 ± 2.33 | 71.69 ± 6.01 | 69.40 ± 4.60 | 77.68 ± 2.69 | 71.73 ± 3.23 | 66.09 ± 3.11 | 50.22 ± 0.80 |
| Retrieval-GRACE (SAGE) | 92.03 ± 1.42 | 84.62 ± 0.74 | 78.35 ± 0.71 | 74.45 ± 0.65 | 72.94 ± 0.93 | 80.64 ± 0.88 | 77.13 ± 0.87 | 66.70 ± 1.20 | 50.26 ± 0.85 |
| ERM (GCNII) | 78.89 ± 3.51 | 71.00 ± 4.61 | 64.37 ± 5.72 | 63.65 ± 7.81 | 66.48 ± 5.92 | 67.72 ± 5.72 | 72.11 ± 5.03 | 59.43 ± 3.36 | 49.04 ± 1.01 |
| EERM (GCNII) | 61.27 ± 2.81 | 66.99 ± 2.49 | 63.66 ± 2.20 | 61.59 ± 2.60 | 60.49 ± 4.61 | 57.37 ± 4.96 | 56.58 ± 3.92 | 48.17 ± 5.77 | 50.98 ± 4.88 |
| LiSA (GCNII) | 77.26 ± 5.87 | 73.81 ± 4.35 | 68.75 ± 4.56 | 67.18 ± 3.64 | 66.99 ± 4.18 | 67.95 ± 7.00 | 66.46 ± 5.59 | 55.99 ± 6.82 | 50.27 ± 3.17 |
| MARIO (GCNII) | 93.72 ± 2.12 | 86.92 ± 0.91 | 79.80 ± 1.25 | 75.82 ± 2.49 | 77.88 ± 3.50 | 80.52 ± 4.85 | 71.41 ± 10.13 | 65.17 ± 5.30 | 48.88 ± 0.46 |
| DGI (GCNII) | 55.90 ± 2.79 | 55.50 ± 5.44 | 50.82 ± 3.70 | 50.96 ± 7.11 | 49.18 ± 3.69 | 52.20 ± 3.11 | 50.98 ± 3.97 | 49.13 ± 1.26 | 49.01 ± 2.00 |
| GRACE (GCNII) | 72.42 ± 4.88 | 72.83 ± 4.22 | 66.81 ± 5.82 | 65.64 ± 5.01 | 66.41 ± 6.87 | 64.78 ± 6.11 | 62.62 ± 4.63 | 57.75 ± 5.35 | 48.76 ± 0.41 |
| CoTrain-DGI (GCNII) | 95.31 ± 0.62 | 87.96 ± 0.80 | 79.81 ± 0.93 | 74.74 ± 0.56 | 77.90 ± 2.07 | 86.37 ± 1.08 | 87.47 ± 1.34 | 72.72 ± 2.97 | 49.77 ± 0.40 |
| CoTrain-GRACE (GCNII) | 95.39 ± 0.43 | 87.87 ± 0.52 | 80.17 ± 0.77 | 74.93 ± 0.58 | 79.07 ± 1.34 | 87.61 ± 0.75 | 87.63 ± 0.79 | 75.61 ± 1.05 | 49.83 ± 0.31 |
| Retrieval-DGI (GCNII) | 82.29 ± 3.31 | 70.40 ± 3.50 | 65.54 ± 3.93 | 67.39 ± 5.56 | 70.85 ± 2.87 | 75.25 ± 3.37 | 77.84 ± 2.18 | 62.84 ± 2.00 | 49.32 ± 0.92 |
| Retrieval-GRACE (GCNII) | 83.91 ± 4.96 | 74.57 ± 5.12 | 70.19 ± 5.28 | 70.62 ± 4.45 | 73.11 ± 2.12 | 75.57 ± 2.82 | 79.21 ± 1.71 | 63.67 ± 2.10 | 49.30 ± 0.88 |

Figure 2: Overview of the Dual-Space Retrieval framework. Supervised and self-supervised GNNs construct separate embedding memory banks. At test time, neighbor- or centroid-based retrieval produces similarity-weighted prediction scores in each space, which are combined through confidence-aware dual-space score fusion.
• ERM [26]: A standard supervised learning baseline based on empirical risk minimization.
• EERM [32]: A supervised OOD method that constructs augmented environments via reinforcement learning for invariant learning.
• DGI [28]: A self-supervised graph representation learning method based on local–global mutual information maximization.
• GRACE [43]: A self-supervised graph contrastive learning method based on augmented graph views.
• LiSA [36]: A supervised OOD method that learns invariant representations using label-invariant subgraphs and energy-based regularization.
• MARIO [42]: A self-supervised graph OOD method combining adversarial graph augmentation and information bottleneck regularization.
For fair comparison, we follow the same OOD data splits used in EERM and LiSA for final evaluation.
Implementation Details. For each dataset, we evaluate our methods with different supervised GNN backbones to examine generalizability across model architectures. Under each setting, all baselines use the same backbone as the supervised branch of our methods for a fair comparison. For the SSL branch, we use either GCN or GraphSAGE based on validation performance. DGI and GRACE use the same SSL encoder architecture within each setting but are trained separately. Once the supervised and SSL architectures are selected, we use the same backbone configuration for Co-Train and Dual-Space Retrieval, enabling a controlled evaluation across different backbone architectures. Results with alternative SSL encoder architectures are provided in Sec. C.3.
For Dual-Space Retrieval, we use , and 300 for OGB-Arxiv, Elliptic, Twitch, and FB100, respectively, selected based on validation performance. The same is used for the supervised and SSL retrieval spaces. Sensitivity to is reported in Sec. C.2. We fix the retrieval similarity temperature to 0.01 and the confidence-fusion temperature to 0.5 across all datasets. When the two branches exhibit large disagreement (), we reduce the SSL contribution using a small fixed weight . This occurs on OGB-Arxiv, where we set . Sensitivity to is reported in Table 11 in Sec. C.1.
For Co-Train, we set and warm up from 0.1 to 0.7 during training. All reported performance is evaluated on the test sets and averaged over 10 runs, with mean and standard deviation reported.
5.2 Temporal Generalization Performance
We evaluate temporal generalization under two settings: a dynamic graph (Elliptic) that evolves across time snapshots and a static graph (OGB-Arxiv) whose nodes are partitioned by publication time. These settings capture distinct forms of temporal distribution shift. In both cases, incorporating SSL representations benefits supervised OOD generalization, with particularly consistent gains from Co-Train.
Temporal Generalization on Dynamic Graphs. We evaluate temporal distribution shifts on the Elliptic transaction network. We use graph snapshots 7–11 for training and snapshots 17–49 for testing, chronologically grouped into nine evaluation periods. Table 1 reports F1 scores for illicit transaction classification. We consider GraphSAGE and GCNII as the supervised backbones, paired with GCN and GraphSAGE encoders, respectively, for the SSL branch.
Co-Train achieves strong and consistent performance across both backbone settings. With GraphSAGE, CoTrain-DGI and CoTrain-GRACE achieve average F1 scores of 78.14% and 77.26%, outperforming the strongest baseline on average (GRACE, 75.21%) by 2.93 and 2.05 percentage points, respectively. With GCNII, the gains are even more pronounced: CoTrain-DGI and CoTrain-GRACE achieve average F1 scores of 79.12% and 79.79%, exceeding the strongest baseline (MARIO, 75.57%) by 3.55 and 4.22 points. The improvements are sustained across the temporal sequence; for example, at T7, CoTrain-GRACE reaches 85.72% and 87.63% with GraphSAGE and GCNII, compared with the strongest baselines of 80.68% and 71.41%, respectively.
Dual-Space Retrieval is also competitive, particularly in later periods. With GraphSAGE, Retrieval-GRACE achieves an average F1 of 75.24%, comparable to the strongest baseline (75.21%). With GCNII, although retrieval is less competitive on average, Retrieval-GRACE reaches 79.21% at T7, outperforming the strongest baseline at that period by 7.80 points. These results demonstrate that incorporating the SSL representation provides substantial benefits for temporal generalization, with particularly consistent gains from Co-Train.
Temporal Generalization on Static Graphs. We next evaluate temporal generalization on OGB-Arxiv, using papers published before 2011 for training and three future periods, 2014–2016, 2016–2018, and 2018–2020, for evaluation. Table 2 reports node classification accuracy with GraphSAGE and GAT as the supervised backbones, while the SSL branches use GraphSAGE encoders. For Dual-Space Retrieval, we use class-centroid retrieval to better represent individual classes in this multiclass setting; this choice over neighbor-based KNN is further discussed in Table 8 in Sec. B.2.
Co-Train shows strong and consistent temporal generalization with both DGI and GRACE. With GraphSAGE, CoTrain-DGI improves over LiSA, the strongest existing baseline, by 4.09, 4.56, and 4.14 percentage points across the three temporal splits, while CoTrain-GRACE achieves similar gains of 4.03, 4.58, and 4.18 points. With GAT, both variants also outperform the strongest baselines across all three splits.
Dual-Space Retrieval remains competitive on OGB-Arxiv, although it is less effective with GraphSAGE than with GAT. Feature smoothing consistently improves centroid-based retrieval across both backbones and SSL objectives. With GraphSAGE, Retrieval achieves up to 52.01%, 54.15%, and 56.66% across the three splits, exceeding the strongest existing baseline by 6.33, 10.51, and 15.62 percentage points, respectively. With GAT, it reaches up to 54.21%, 52.09%, and 54.03%. Further analysis shows that feature smoothing increases neighborhood label purity in both representation spaces (Table 9 Sec. B.3).
5.3 Cross-domain Generalization Performance
We evaluate cross-domain generalization on two social network benchmarks, Twitch and FB-100, where models are trained on selected domains and evaluated on unseen ones. These benchmarks capture domain shifts across online communities and university networks. The results further support the use of SSL representations as complementary signals for supervised OOD generalization, with Co-Train showing consistently strong performance across unseen domains.
Training on a Single Graph. On Twitch, we train on the single-domain graph DE and evaluate generalization to five unseen domains: ES, FR, PTBR, RU, and TW. We report ROC-AUC in Table 3, using GCN and GCNII as the supervised backbones and GCN for the SSL encoders.
Co-Train consistently achieves the strongest performance across the unseen domains. With GCN, CoTrain-DGI and CoTrain-GRACE obtain average ROC-AUC scores of 60.72% and 60.71%, respectively, improving over the strongest baseline on average (MARIO, 58.05%) by 2.66 and 2.65 percentage points. The gains remain consistent with GCNII: CoTrain-DGI and CoTrain-GRACE achieve 62.26% and 61.58% on average, outperforming the strongest baseline (EERM, 59.58%) by 2.68 and 2.01 points, respectively. For example, on FR, CoTrain-DGI reaches 65.07% with GCNII, compared with 60.37% for the strongest baseline.
Dual-Space Retrieval also remains competitive across unseen domains. With GCN, Retrieval-DGI achieves an average ROC-AUC of 59.01%, exceeding the strongest baseline average by 0.95 points. With GCNII, it achieves 59.60%, closely matching the strongest baseline average of 59.58%. We additionally report results with GAT as the supervised backbone in Table 7, Sec. D. Co-Train remains consistently strong, while the performance of Dual-Space Retrieval varies more across backbone architectures.
Training on Multiple Graphs. On FB-100, we train on graphs from three universities and evaluate on unseen university networks. We use GCN as the supervised backbone and GCN encoders for DGI and GRACE, and report test accuracy in Table 4.
Both Co-Train and Dual-Space Retrieval achieve strong performance on Penn and Brown. On Penn, Retrieval-DGI reaches 54.69% under the WUSTL+BRD+CMU source combination, outperforming the strongest baseline (52.99%) by 1.70 percentage points. Co-Train also consistently improves or matches the strongest baselines across the source combinations. Similar gains are observed on Brown: Retrieval-DGI achieves 57.50% and 57.19% under BIN+DUK+PRI and WUSTL+BRD+CMU, exceeding the strongest baselines by 1.57
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
Table 2: Node classification accuracy (%) on OGB-Arxiv across temporal splits and GNN backbones.
| Method (SAGE) | 2014–2016 | 2016–2018 | 2018–2020 | Method (GAT) | 2014–2016 | 2016–2018 | 2018–2020 |
|---|---|---|---|---|---|---|---|
| ERM | ERM | ||||||
| EERM | EERM | ||||||
| LiSA | LiSA | ||||||
| MARIO | MARIO | ||||||
| DGI | DGI | ||||||
| GRACE | GRACE | ||||||
| CoTrain-DGI | CoTrain-DGI | ||||||
| CoTrain-GRACE | CoTrain-GRACE | ||||||
| Retrieval-DGI | Retrieval-DGI | ||||||
| Retrieval-GRACE | Retrieval-GRACE | ||||||
| Retrieval*-DGI | Retrieval*-DGI | ||||||
| Retrieval*-GRACE | Retrieval*-GRACE |
Table 3: ROC-AUC scores (%) on Twitch across domain splits with different GNN backbones.
| Method | GCN | GCNII | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ES | FR | PTBR | RU | TW | ES | FR | PTBR | RU | TW | |
| ERM | ||||||||||
| EERM | ||||||||||
| LiSA | ||||||||||
| MARIO | ||||||||||
| DGI | ||||||||||
| GRACE | ||||||||||
| CoTrain-DGI | ||||||||||
| CoTrain-GRACE | ||||||||||
| Retrieval-DGI | ||||||||||
| Retrieval-GRACE | ||||||||||
and 2.41 points, respectively, while Co-Train remains consistently competitive.
Additional results on Texas are reported in Table 16, Sec. D. While the improvements are more modest, Co-Train and Retrieval remain competitive, with Co-Train-DGI achieving the best performance under WUSTL+BRD+CMU (56.89%).
5.4 Ablation Study
We examine whether self-supervised representations provide complementary information to supervised representations. For both Co-Train and Dual-Space Retrieval, we compare the full method with its supervised-only and SSL-only variants, using DGI and GRACE as the SSL objectives.
For Co-Train, Figure 3 reports the results on OGB-Arxiv with GraphSAGE as the supervised backbone. Combining supervised and SSL learning consistently outperforms either individual objective across all three temporal splits. With DGI, Co-Train improves over the stronger individual branch by 2.58, 3.16, and 3.27 percentage points on the three periods (2014–2016, 2016–2018, and 2018–2020), respectively. With GRACE, Co-Train similarly outperforms the stronger individual branch by 2.40, 2.50, and 2.96 points, respectively. These results demonstrate the benefit of incorporating complementary SSL signals during representation learning.
For Dual-Space Retrieval, Figure 4 reports the results on Twitch with GCNII as the supervised backbone. With DGI, combining the two retrieval spaces outperforms either individual space across all five domains, with gains of up to 2.89 percentage points. With GRACE, the combined prediction improves over both individual spaces on ES, FR, and PTBR, while remaining comparable on RU and TW. These results show that supervised and SSL representations can provide complementary retrieval signals at inference time.
We then compare gated fusion in Co-Train with additive and concatenation-based fusion. Using Twitch with GCNII as the supervised backbone, gated fusion achieves a slightly higher average ROC-AUC of 62.16%, compared with 62.04% for addition and 61.95% for concatenation as shown in Table 5. Overall, the three fusion strategies perform comparably. We use gated fusion because it allows adaptive weighting of the supervised and SSL representations.
5.5 Additional Analysis
Representation Separation. We further examine how Co-Train affects the learned representation space on OGB-Arxiv. Figure 6 visualizes test-node representations from 15 randomly selected classes in the final temporal split (2018–2020) using t-SNE, with GraphSAGE as both the supervised backbone and SSL encoder and
Table 4: Node classification accuracy (%) on FB-100 across different training-graph combinations.
| Method | JHU+CIT+AMH | BIN+DUK+PRI | WUSTL+BRD+CMU |
|---|---|---|---|
| Penn | |||
| ERM | |||
| EERM | |||
| LiSA | |||
| MARIO | |||
| DGI | |||
| GRACE | |||
| CoTrain-DGI | |||
| CoTrain-GRACE | |||
| Retrieval-DGI | |||
| Retrieval-GRACE | |||
| Brown | |||
| ERM | |||
| EERM | |||
| LiSA | |||
| MARIO | |||
| DGI | |||
| GRACE | |||
| CoTrain-DGI | |||
| CoTrain-GRACE | |||
| Retrieval-DGI | |||
| Retrieval-GRACE | |||

(a) DGI
(b) GRACE
Figure 3: Accuracy comparison of supervised (Sup.), self-supervised (SSL), and Co-Train models on OGB-Arxiv across three temporal test periods.
Table 5: ROC-AUC (%) of different Co-Train fusion operators across Twitch domains with GCNII.
| Domain | Gate | Add. | Concat. |
|---|---|---|---|
| ES | |||
| FR | |||
| PTBR | |||
| RU | |||
| TW | |||
| Avg. |
GRACE as the SSL objective. Compared with either representation alone, Co-Train produces more compact class structures with

(a) DGI

(b) GRACE
Figure 4: ROC-AUC comparison of supervised (Sup.), self-supervised (SSL), and Retrieval models on five Twitch domains.

(a) DGI

(b) GRACE
Figure 5: Comparison of representation-separation scores for supervised, self-supervised (SSL), and Co-Train models with on OGB-Arxiv.

(a) Supervised

(b) Self-Supervised

(c) Co-Train (GRACE)
Figure 6: t-SNE visualization of supervised, self-supervised (SSL), and Co-Train test-node representations on the 2018–2020 temporal split of OGB-Arxiv with GRACE.
clearer inter-class boundaries, indicating a more discriminative representation space. A corresponding visualization with DGI exhibits a similar pattern (Fig. 7, Sec. B). We further quantify this effect using the separation score in Figure 5, defined as the ratio of inter-class to intra-class distance. We first L2-normalize the embeddings and then compute the inter- and intra-class Euclidean distances. A larger score indicates better class separation. Co-Train achieves the highest separation score with both DGI and GRACE, further showing that combining supervised and SSL learning leads to better separated representations.
Efficiency. We compare the runtime and memory usage of different methods on OGB-Arxiv using a 64GB GPU. For a fair comparison, GraphSAGE is used as the supervised backbone for our methods and as the backbone for all compared methods; our SSL branch also uses a GraphSAGE encoder. Each method is evaluated
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
under the configuration used to obtain its best reported performance. Co-Train is the fastest method in our comparison while maintaining strong OOD performance, and centroid-based Dual-Space Retrieval achieves runtime comparable to ERM. All methods fit within GPU memory. Detailed results are reported in Table 10, Sec. B.4.
6 Conclusion
In this work, we study how self-supervised representations can complement supervised learning for graph OOD generalization. We propose Co-Train, which jointly learns supervised and self-supervised representations, and Dual-Space Retrieval, which combines predictions from the two representation spaces at inference time. Across multiple graph datasets and distribution shifts, both methods achieve strong performance, with Co-Train consistently outperforming strong OOD generalization baselines.
Our ablation and representation analyses show that SSL provides complementary information to supervised learning and improves representation separation. Overall, our results show that incorporating SSL as a complementary signal can improve supervised graph OOD generalization.
References
[1] David Buterez, Jon Paul Janet, Steven J. Kiddle, Dino Oglic, and Pietro Liò. 2024. Transfer Learning with Graph Neural Networks for Improved Molecular Property Prediction in the Multi-Fidelity Setting. Nature Communications (2024).
[2] Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. 2020. Simple and Deep Graph Convolutional Networks. In Proc. of ICML.
[3] Yuhan Chen, Yihong Luo, Yifan Song, Pengwen Dai, Jing Tang, and Xiaochun Cao. 2025. Decoupled Graph Energy-based Model for Node Out-of-Distribution Detection on Heterophilic Graphs. In Proc. of ICLR.
[4] Yongqiang Chen, Yonggang Zhang, Yatao Bian, Han Yang, Kaili Ma, Binghui Xie, Tongliang Liu, Bo Han, and James Cheng. 2022. Learning Causally Invariant Representations for Out-of-Distribution Generalization on Graphs. In Proc. of NeurIPS.
[5] Eli Chien, Jianhao Peng, Pan Li, and Olgaica Milenkovic. 2021. Adaptive Universal Generalized PageRank Graph Neural Network. In Proc. of ICLR.
[6] Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. 2016. Convolutional neural networks on graphs with fast localized spectral filtering. In Proc. of NeurIPS.
[7] Shaohua Fan, Xiao Wang, Chuan Shi, Peng Cui, and Bai Wang. 2024. Generalizing Graph Neural Networks on Out-of-Distribution Graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence (2024).
[8] Arushi Goel, Keng Teck Ma, and Cheston Tan. 2019. An End-to-End Network for Generating Social Relationship Graphs. In Proc. of CVPR.
[9] William L. Hamilton, Rex Ying, and Jure Leskovec. 2017. Inductive Representation Learning on Large Graphs. In Proc. of NeurIPS.
[10] Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. 2020. Open Graph Benchmark: Datasets for Machine Learning on Graphs. In Proc. of NeurIPS.
[11] Thomas N Kipf and Max Welling. 2017. Semi-Supervised Classification with Graph Convolutional Networks. In Proc. of ICLR.
[12] Yixin Liu, Kaize Ding, Huan Liu, and Shirui Pan. 2023. GOOD-D: On Unsupervised Graph Out-Of-Distribution Detection. In Proc. of WSDM.
[13] Yixin Liu, Yu Zheng, Daokun Zhang, Hongxu Chen, Hao Peng, and Shirui Pan. 2022. Towards Unsupervised Deep Graph Structure Learning. In Proc. of WWW.
[14] Nicolas Papernot and Patrick McDaniel. 2018. Deep k-Nearest Neighbors: Towards Confident, Interpretable and Robust Deep Learning. arXiv preprint arXiv:1803.04765 (2018).
[15] Aldo Pareja, Giacomo Domeniconi, Jie Chen, Tengfei Ma, Toyotaro Suzumura, Hiroki Kanezashi, Tim Kaler, Tao B. Schardl, and Charles E. Leiserson. 2020. EvolveGCN: Evolving Graph Convolutional Networks for Dynamic Graphs. In Proc. of AAAI.
[16] Jaewoo Park, Yoon Gyo Jung, and Andrew Beng Jin Teoh. 2023. Nearest Neighbor Guidance for Out-of-Distribution Detection. In Proc. of ICCV.
[17] Ziyue Qiao, Qianyi Cai, Hao Dong, Jiawei Gu, Pengyang Wang, Meng Xiao, Xiao Luo, and Hui Xiong. 2025. GCAL: Adapting Graph Models to Evolving Domain Shifts. In Proc. of ICML.
[18] Benedek Rozemberczki, Carl Allen, and Rik Sarkar. 2021. Multi-Scale attributed node embedding. Journal of Complex Networks (2021).
[19] Zheyan Shen, Jiashuo Liu, Yue He, Xingxuan Zhang, Renzhe Xu, Han Yu, and Peng Cui. 2021. Towards Out-Of-Distribution Generalization: A Survey. arXiv preprint arXiv:2108.13624 (2021).
[20] Zhixiang Shen, Shuo Wang, and Zhao Kang. 2024. Beyond Redundancy: Information-aware Unsupervised Multiplex Graph Structure Learning. In Proc. of NeurIPS.
[21] Fan-Yun Sun, Jordan Hoffmann, Vikas Verma, and Jian Tang. 2019. InfoGraph: Unsupervised and Semi-supervised Graph-Level Representation Learning via Mutual Information Maximization. In Proc. of ICLR.
[22] Yiyou Sun, Yifei Ming, Xiaojin Zhu, and Yixuan Li. 2022. Out-of-distribution Detection with Deep Nearest Neighbors. In Proc. of ICML.
[23] Susheel Suresh, Pan Li, Cong Hao, and Jennifer Neville. 2021. Adversarial Graph Augmentation to Improve Graph Contrastive Learning. In Proc. of NeurIPS.
[24] Amanda L. Traud, Peter J. Mucha, and Mason A. Porter. 2012. Social Structure of Facebook Networks. Physica A: Statistical Mechanics and its Applications (2012).
[25] Puja Trivedi, Ekdeep Singh Lubana, Yujun Yan, Yaoqing Yang, and Danai Koutra. 2021. Augmentations in Graph Contrastive Learning: Current Methodological Flaws & Towards Better Practices. arXiv preprint arXiv:2111.03220 (2021).
[26] V. Vapnik. 1991. Principles of Risk Minimization for Learning Theory. In Proc. of NeurIPS.
[27] Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. 2018. Graph Attention Networks. In Proc. of ICLR.
[28] Petar Veličković, William Fedus, William L. Hamilton, Pietro Liò, Yoshua Bengio, and R Devon Hjelm. 2019. Deep Graph Infomax. In Proc. of ICLR.
[29] Song Wang, Zhen Tan, Yaochen Zhu, Chuxu Zhang, and Jundong Li. 2025. Generative Risk Minimization for Out-of-Distribution Generalization on Graphs. TMLR (2025).
[30] Qitian Wu, Yiting Chen, Chenxiao Yang, and Junchi Yan. 2023. Energy-based Out-of-Distribution Detection for Graph Neural Networks. In Proc. of ICLR.
[31] Qitian Wu, Nie Fan, Chenxiao Yang, Tianyi Bao, and Junchi Yan. 2024. Graph Out-of-Distribution Generalization via Causal Intervention. In Proc. of WWW.
[32] Qitian Wu, Hengrui Zhang, Junchi Yan, and David Wipf. 2022. Handling Distribution Shifts on Graphs: An Invariance Perspective. In Proc. of ICLR.
[33] Ying-Xin Wu, Xiang Wang, An Zhang, Xiangnan He, and Tat seng Chua. 2022. Discovering Invariant Rationales for Graph Neural Networks. In Proc. of ICLR.
[34] Eyup Yilmaz and Cagri Toraman. 2022. D2U: Distance-to-Uniform Learning for Out-of-Scope Detection. In Proc. of NAACL.
[35] Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L. Hamilton, and Jure Leskovec. 2018. Graph Convolutional Neural Networks for Web-Scale Recommender Systems. In Proc. of KDD.
[36] Junchi Yu, Jian Liang, and Ran He. 2023. Mind the Label Shift of Augmentation-based Graph OOD Generalization. In Proc. of CVPR.
[37] Hanqing Zeng, Hongkuan Zhou, Ajitesh Srivastava, Rajgopal Kannan, and Viktor Prasanna. 2020. GraphSAINT: Graph Sampling Based Inductive Learning Method. In Proc. of ICLR.
[38] Yi-Fan Zhang, Xue Wang, Kexin Jin, Kun Yuan, Zhang Zhang, Liang Wang, Rong Jin, and Tieniu Tan. 2023. AdaNPC: exploring non-parametric classifier for test-time adaptation. In Proc. of ICML.
[39] Zeyang Zhang, Xin Wang, Ziwei Zhang, Haoyang Li, Zhou Qin, and Wenwu Zhu. 2022. Dynamic Graph Neural Networks Under Spatio-Temporal Distribution Shift. In Proc. of NeurIPS.
[40] Andy Zhou, Xiaojun Xu, Ramesh Raghunathan, Alok Lal, Xinze Guan, Bin Yu, and Bo Li. 2024. KnowGraph: Knowledge-Enabled Anomaly Detection via Logical Reasoning on Graph Data. In Proc. of CCS.
[41] Qi Zhu, Natalia Ponomareva, Jiawei Han, and Bryan Perozzi. 2021. Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data. In Proc. of NeurIPS.
[42] Yun Zhu, Haizhou Shi, Zhenshuo Zhang, and Siliang Tang. 2024. MARIO: Model Agnostic Recipe for Improving OOD Generalization of Graph Contrastive Learning. In Proc. of WWW.
[43] Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. 2020. Deep Graph Contrastive Representation Learning. In Proc. of ICML Workshop on Graph Representation Learning and Beyond.
A Datasets
Table 6 summarizes the statistics, distribution shifts, and evaluation metrics of the datasets used in our experiments.
Elliptic. The Elliptic dataset records Bitcoin transactions across 49 time steps. Each node represents a transaction, and each edge indicates a payment flow. Around 20% of transactions are labeled as licit or illicit, and the task is to identify illicit transactions in future time steps. We use time steps 7–11 for training, 12–16 for validation,

(a) Supervised

(b) Self-Supervised

(c) Co-Train (DGI)
Figure 7: t-SNE visualization of supervised, self-supervised (SSL), and Co-Train test-node representations on the 2018–2020 temporal split of OGB-Arxiv with DGI.
and 17–49 for testing. The 33 test snapshots are grouped into nine chronological test sets to evaluate temporal generalization.
OGB-Arxiv. OGB-Arxiv contains 169,343 Arxiv CS papers from 40 subject areas, along with their citation links. Both research topics and citation patterns change over time, resulting in temporal distribution shifts. The task is to predict a paper's subject area. We use papers published up to 2011 for training, papers published after 2011 and up to 2014 for validation, and three subsequent periods, 2014–2016, 2016–2018, and 2018–2020, for testing.
Twitch-Explicit (Twitch). The Twitch-Explicit dataset contains seven networks, where each node represents a Twitch user and edges denote mutual friendships. Each network corresponds to a geographic region, resulting in cross-domain distribution shifts. The task is to predict whether a Twitch streamer uses explicit language. We use DE for training, ENGB for validation, and ES, FR, PTBR, RU, and TW for testing.
Facebook-100 (FB100). The Facebook-100 dataset comprises 100 Facebook friendship networks collected in 2005, each corresponding to a different American university. Nodes represent users, and edges indicate Facebook friendships. The task is to predict the gender of each user. We use the selected training universities for training, Cornell and Yale for validation, and disjoint universities for testing.
B Additional Analysis
B.1 Visualization of Learned Representations
Figure 7 visualizes the supervised, self-supervised, and Co-Train representations on OGB-Arxiv using t-SNE, with DGI as the SSL objective. The corresponding quantitative analysis in the main paper shows that CoTrain-DGI achieves the highest representation separation score, indicating more compact intra-class representations and greater inter-class separation. Consistent with this observation, the t-SNE visualization shows clearer class structure after integrating the supervised and SSL representations. Together with the quantitative results in the main paper, this provides additional evidence that the two representation spaces contain complementary information and that Co-Train can integrate them into a more discriminative representation.
B.2 Neighbor-Based Retrieval Results on OGB-Arxiv
We analyze neighbor-based retrieval on OGB-Arxiv to explain our use of class-centroid retrieval in this multiclass setting. We use GAT as the supervised backbone and GraphSAGE as the SSL encoder. Table 8 reports validation results for the supervised, DGI, and GRACE representation spaces with K = 30 and K = 100.
For each query node x, let denote its K retrieved training neighbors, where j indexes a retrieved neighbor and and denote the labels of the query node and neighbor j, respectively. We characterize the retrieved neighborhood using class diversity and label purity:
Here, is the number of unique classes among the retrieved neighbors, while is the fraction of neighbors sharing the ground-truth label of the query node. We report both quantities averaged over all validation nodes.
We further evaluate the class-level prediction induced by the retrieved neighbors using the same similarity-weighted aggregation as in Dual-Space Retrieval. For representation space , the class-score vector is
where is the normalized similarity weight and is the one-hot label of neighbor j. Let denote the m classes with the highest scores in . Top-1 and Top-3 report the percentage of validation nodes satisfying
respectively.
The results show that neighbor-based retrieval can be highly local in this 40-class setting, particularly in the SSL representation spaces. With K = 30, the DGI and GRACE neighborhoods contain approximately 11 unique classes on average, with label purity of only 23.31% and 21.52%, respectively. The ground-truth class appears in Top-1 for 35.14% and 28.97% of validation nodes, and in Top-3 for 56.22% and 49.59%. Increasing K to 100 expands the neighborhoods to approximately 19 classes, but purity remains low and Top-1 performance changes little.
These results suggest that neighbor-based retrieval can be overly local in this multiclass setting, where the retrieved neighborhood covers only a limited subset of classes and may not provide sufficiently representative class-level signals. This issue is particularly evident in the SSL spaces, where low neighborhood label purity is accompanied by low Top-1 accuracy, indicating that the ground-truth class is often not well represented among the retrieved neighbors. As a result, similarity-weighted voting is restricted to the classes present in the local neighborhood and cannot effectively compare against classes outside it. We therefore use class-centroid retrieval on OGB-Arxiv, which explicitly represents every class and enables prediction over the full class space.
B.3 Feature Smoothing for Centroid-Based Retrieval on OGB-Arxiv
After adopting class-centroid retrieval to provide explicit representatives for all classes, we examine the quality of the underlying representation space. In centroid-based retrieval, prediction depends on how distinctly a node can be associated with different
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
Table 6: Dataset statistics, distribution shifts, and evaluation metrics.
| Dataset | Distribution Shift | Nodes | Edges | Classes | Metric |
|---|---|---|---|---|---|
| Elliptic [15] | Temporal Evolution | 203,769 | 234,355 | 2 | F1-Score |
| OGB-Arxiv [?] | Temporal Evolution | 169,343 | 1,166,243 | 40 | Accuracy |
| Twitch-explicit [18] | Cross-Domain Transfers | 1,912 - 9,498 | 31,299 - 153,138 | 2 | ROC-AUC |
| Facebook-100 [24] | Cross-Domain Transfers | 769 - 41,536 | 16,656 - 1,590,655 | 2 | Accuracy |
Table 7: ROC-AUC scores (%) on Twitch-Explicit across domain splits with the GAT backbone.
| Method | ES | FR | PTBR | RU | TW |
|---|---|---|---|---|---|
| ERM | |||||
| EERM | |||||
| LiSA | |||||
| MARIO | |||||
| DGI | |||||
| GRACE | |||||
| CoTrain-DGI | |||||
| CoTrain-GRACE | |||||
| Retrieval-DGI | |||||
| Retrieval-GRACE |
Table 8: Neighbor-based retrieval results across supervised and SSL representation spaces on the validation set of OGB-Arxiv.
| Space | ||||||||
|---|---|---|---|---|---|---|---|---|
| Top-1 | Top-3 | Top-1 | Top-3 | |||||
| Supervised | 5.42 | 43.06% | 47.16% | 72.83% | 9.34 | 40.58% | 47.19% | 73.19% |
| DGI-SSL | 10.89 | 23.31% | 35.14% | 56.22% | 19.22 | 21.24% | 34.88% | 57.04% |
| GRACE-SSL | 10.91 | 21.52% | 28.97% | 49.59% | 18.64 | 20.52% | 29.43% | 50.60% |
Table 9: Training-node label purity before and after feature smoothing on OGB-Arxiv with a GAT backbone.
| Branch | Before | After | |
|---|---|---|---|
| GRACE SSL | 26.78% | 33.48% | +6.70 pp |
| Supervised | 55.46% | 60.15% | +4.69 pp |
class representatives. On OGB-Arxiv, we observe relatively low retrieval confidence, measured by , suggesting that the class-level retrieval signal can remain ambiguous in this multiclass setting. Thus, to improve the local consistency of the representation space, we consider feature smoothing before constructing the class centroids.
Table 9 analyzes this effect on the training nodes, using GAT as the supervised backbone and GraphSAGE as the SSL encoder. We compare neighborhood label purity before and after feature smoothing in both representation spaces. Feature smoothing increases label purity, indicating that neighboring nodes become more locally consistent after smoothing. This provides a more coherent representation space for constructing class centroids and helps produce more distinct class-level retrieval signals. Consistent with this analysis, the main results show substantial improvements from the feature-smoothed variant, Retrieval*, over the corresponding centroid-based Retrieval results.
B.4 Efficiency and Memory Usage Comparison.
Table 10 compares the computational efficiency of all methods on OGB-Arxiv. We use GraphSAGE as both the supervised backbone and the SSL encoder for our methods, and GraphSAGE as the backbone for all compared methods to ensure a consistent comparison. All experiments are conducted on the same machine, and we report the total training and inference runtime of each method under the hyperparameter configuration that achieves its reported performance.
Co-Train is the most efficient method in our comparison, requiring only 43.75 seconds, compared with 70.83 seconds for ERM, 50.29 seconds for LiSA, 206.19 seconds for MARIO, and more than two hours for EERM. This efficiency is particularly notable given its strong OOD performance, showing that incorporating complementary SSL representations through Co-Train does not introduce substantial computational overhead. Dual-Space Retrieval is also lightweight, requiring 69.16 seconds, while its feature-smoothed variant requires 96.52 seconds. Both remain substantially faster than more computationally intensive OOD methods such as MARIO and EERM.
The retrieval runtime on OGB-Arxiv is relatively low because we use class-centroid retrieval, where only a small number of class representatives are involved in retrieval. For datasets using neighbor-based retrieval, the retrieval cost increases with the number of candidate neighbors and retrieved neighbors . This additional cost is confined to the retrieval stage and does not increase model training time. All evaluated methods fit within GPU memory, indicating that our proposed frameworks introduce no prohibitive memory overhead.
Table 10: Runtime and memory usage across methods on the OGB-Arxiv dataset using a backbone.
| Method | Total Runtime (s) | Fits in GPU Memory |
|---|---|---|
| ERM | 70.83 | Yes |
| EERM | 2 hours | Yes |
| LiSA | 50.29 | Yes |
| MARIO | 206.19 | Yes |
| Co-Train | 43.75 | Yes |
| Dual-Space Retrieval | 69.16 | Yes |
| Dual-Space Retrieval | 96.52 | Yes |
Table 11: Test accuracy (%) under different SSL fusion coefficients on OGB-Arxiv using Retrieval-GRACE with a GAT backbone.
| 2014–2016 | 2016–2018 | 2018–2020 | |
|---|---|---|---|
Table 12: Test accuracy (%) with different numbers of retrieved centroids on OGB-Arxiv using Retrieval-GRACE with a GAT backbone.
| 2014–2016 | 2016–2018 | 2018–2020 | |
|---|---|---|---|
C Sensitivity and Robustness Analysis
C.1 Sensitivity to the SSL Fusion Weight for Dual-Space Retrieval.
Table 11 evaluates the sensitivity to the SSL fusion weight in Dual-Space Retrieval on OGB-Arxiv, using GAT as the supervised backbone and GRACE as the SSL encoder. As described in the main paper, the two retrieval branches exhibit large prediction disagreement () on this dataset. We therefore use a small fixed and vary its value over . Performance remains similar across all three temporal splits; for example, accuracy on 2018–2020 ranges from to . This shows that the results are not sensitive to the exact choice of a small SSL fusion weight. We therefore set globally for the OGB-Arxiv experiments.
C.2 Sensitivity to the Retrieval Size .
We further examine the sensitivity of Dual-Space Retrieval to the retrieval size under both centroid-based and neighbor-based retrieval.
Table 13: Test-wise sensitivity of Elliptic-SAGE-GRACE to the number of retrieved neighbors . Each entry reports the mean F1 score (%) and standard deviation over 10 runs.
| Split | |||||
|---|---|---|---|---|---|
| Test1 | |||||
| Test2 | |||||
| Test3 | |||||
| Test4 | |||||
| Test5 | |||||
| Test6 | |||||
| Test7 | |||||
| Test8 | |||||
| Test9 |
Table 12 reports results on OGB-Arxiv using GAT as the supervised backbone and GRACE as the SSL encoder. We vary for class-centroid retrieval and observe comparable performance across all three temporal splits. The value used in the main experiments is selected on the validation set. Since OGB-Arxiv contains 40 classes, corresponds to retrieving all class centroids.
Table 13 further evaluates for neighbor-based retrieval on Elliptic, using GraphSAGE as the supervised backbone and GRACE as the SSL encoder. We use based on validation performance and compare across the nine test splits. Performance remains stable over a wide range of , with only small variations across the test splits. Together, these results show that Dual-Space Retrieval is not sensitive to the exact choice of under either centroid- or neighbor-based retrieval.
C.3 Sensitivity to the SSL Encoder Architecture.
We further examine the sensitivity of Co-Train-DGI to the SSL encoder architecture. Since the supervised and SSL encoders are separately parameterized without parameter sharing, their backbone architectures can be selected independently. Tables 14 and 15 compare GCN and GraphSAGE as the DGI encoder on Elliptic and OGB-Arxiv, respectively. Based on validation performance, we use GCN for Elliptic and GraphSAGE for OGB-Arxiv in the main experiments. Dual-Space Retrieval uses the same selected supervised and SSL backbone configurations.
On Elliptic, the two SSL encoders achieve comparable performance across the nine test splits, with each performing slightly better on different periods. On OGB-Arxiv, GCN performs slightly better on the three test periods, by only 0.41, 0.37, and 0.58 percentage points, respectively, despite GraphSAGE being selected based on validation performance. Overall, the small differences across both datasets suggest that Co-Train is not highly sensitive to the choice of SSL encoder architecture.
D Additional Experimental Results
Table 16 reports results on FB-100 with three training-domain combinations and Texas as the test domain, using GCN as both the supervised backbone and SSL encoder. Table 7 reports results on
Qingying Hao, Zikang Chen, Chuxuan Hu, Jinyuan Jia, Bo Li, Gang Wang, and Carl Gunter
Table 14: Test accuracy (%) on OGB-Arxiv with different SSL encoder architectures for Co-Train-DGI.
| Test split | SSL-GCN | SSL-SAGE |
|---|---|---|
| 2014-2016 | ||
| 2016-2018 | ||
| 2018-2020 |
Table 15: F1-score (%) of Co-Train-DGI to the SSL encoder architecture on Elliptic.
| Test split | SSL-GCN | SSL-SAGE |
|---|---|---|
| Test1 | ||
| Test2 | ||
| Test3 | ||
| Test4 | ||
| Test5 | ||
| Test6 | ||
| Test7 | ||
| Test8 | ||
| Test9 |
Table 16: Accuracy (%) on the Texas of FB-100 under Different Training Graph Combinations.
| Method | Texas | ||
|---|---|---|---|
| JHU+CIT+AMH | BIN+DUK+PRI | WUSTL+BRD+CMU | |
| ERM | |||
| EERM | |||
| LiSA | |||
| MARIO | |||
| DGI | |||
| GRACE | |||
| CoTrain-DGI | |||
| CoTrain-GRACE | |||
| Retrieval-DGI | |||
| Retrieval-GRACE | |||
Twitch with GAT as the supervised backbone and GCN as the SSL encoder.
On Twitch, Co-Train achieves the best performance on four of the five target domains, with gains of 1.51, 0.06, 2.55, and 0.72 percentage points over the strongest existing baseline on ES, FR, PTBR, and RU, respectively. Dual-Space Retrieval is less competitive under the GAT backbone, suggesting that retrieval-based prediction can be more sensitive to the learned representation space.
On FB-100, performance varies more noticeably across the three training-domain combinations. GRACE achieves the best results under JHU+CIT+AMH and BIN+DUK+PRI, with accuracies of 56.11% and 56.08%, respectively. Under WUSTL+BRD+CMU, CoTrain-DGI achieves the best overall accuracy of 56.89%, outperforming the strongest baseline by 0.26 percentage points.