Abstract
Due to inappropriate sample selection and limited training data, a distribution shift often exists between the training and test sets. This shift can adversely affect the test performance of Graph Neural Networks (GNNs). Existing approaches mitigate this issue by either enhancing the robustness of GNNs to distribution shift or reducing the shift itself. However, both approaches necessitate retraining the model, which becomes unfeasible when the model structure and parameters are inaccessible. To address this challenge, we propose FR-GNN, a general framework for GNNs to conduct feature reconstruction. FRGNN constructs a mapping relationship between the output and input of a well-trained GNN to obtain class representative embeddings and then uses these embeddings to reconstruct the features of labeled nodes. These reconstructed features are then incorporated into the message passing mechanism of GNNs to influence the predictions of unlabeled nodes at test time. Notably, the reconstructed node features can be directly utilized for testing the well-trained model, effectively reducing the distribution shift and leading to improved test performance. This remarkable achievement is attained without any modifications to the model structure or parameters. We provide theoretical guarantees for the effectiveness of our framework. Furthermore, we conduct comprehensive experiments on various public datasets. The experimental results demonstrate the superior performance of FRGNN in comparison to multiple categories of baseline methods.
Introduction
Graph Neural Networks (GNNs) typically operate under the "i.i.d. assumption"—the idea that training and test data come from the same distribution. In real-world applications, this rarely holds. Due to limited data or biased sampling, a distribution shift often occurs, where the features or structures in the test set differ significantly from the training set.
Existing solutions usually fall into two camps: enhancing model robustness or data augmentation. Both require retraining the model, which is often unfeasible if the model is a massive "black box," if parameters are inaccessible due to privacy, or if computational costs are prohibitive. FR-GNN addresses this by mitigating the shift at test time while keeping the base model's parameters and structure untouched.
The FR-GNN Framework
The core idea of FR-GNN is Feature Reconstruction. Instead of modifying the model, it "fixes" the input data during the inference phase using a three-stage process.
- Inverse Mapping with MLP: A separate, lightweight Multi-Layer Perceptron (MLP) is trained to learn the mapping from the GNN’s output (predictions) back to its input (features). This identifies the "ideal" feature for any given label.
- Class Representative Embeddings: By feeding a one-hot vector of a specific class into this trained MLP, the system generates a "representative embedding" for that class.
- Feature Substitution and Message Passing: During the test phase, the original features of labeled nodes are replaced with these representative embeddings. Because GNNs rely on message passing, these idealized features propagate to unlabeled neighbors. This mathematically "pulls" the embeddings of test nodes closer to the regions of the latent space that the GNN was originally trained to recognize.
Experimental Results
FR-GNN was evaluated on four benchmark datasets: Cora, Citeseer, Pubmed, and ogb-arxiv. To simulate distribution shift, a Scalable Biased Sampler was used to select training nodes that are structurally clustered, creating a natural discrepancy between the training environment and the rest of the graph.
Performance and Visualization
FR-GNN consistently outperformed base models (GCN, GAT, GraphSAGE, APPNP) across all datasets. For example, on the Cora dataset under biased sampling, a standard GCN achieved 69.24% accuracy, while FR-GCN boosted this to 74.12%. It also frequently outperformed specialized robust GNNs like SR-GNN despite those methods requiring expensive retraining.
Visual validation using t-SNE (shown above) demonstrates that after feature reconstruction, test node embeddings become significantly more compact and align more closely with training clusters, reducing the "Graph Embedding Bias" (GEB) for test nodes.
Conclusion
FR-GNN provides a novel, "plug-and-play" framework to mitigate distribution shift without requiring model retraining. While its effectiveness is tied to label density—as seen in datasets like Pubmed with very low label rates—it offers a powerful tool for improving GNN performance on biased real-world data. Future work may explore feature reconstruction based solely on node features for unsupervised scenarios.
Summary updated