Abstract
Standard Graph Neural Networks (GNNs) typically operate under a closed-set assumption, expecting all nodes to belong to classes seen during training. In real-world applications, graphs often contain Out-of-Distribution (OOD) nodes that can corrupt the classification of known categories through message passing. This paper introduces Learning to Mix Neighbors (LMN), the first end-to-end framework designed to simultaneously classify nodes and detect OOD samples. By utilizing variational inference and bi-level optimization, LMN learns to dampen the influence of OOD nodes during feature aggregation, effectively mitigating the "across-distribution mixture" problem.
The Across-Distribution Mixture Problem
In graph-structured data, OOD detection is uniquely challenging due to the message-passing mechanism. GNNs learn by aggregating information from a node's neighborhood. This leads to two primary issues:
- ID Corruption: If an In-Distribution (ID) node has OOD neighbors, their "alien" features bleed into the ID node's representation, causing misclassification.
- OOD Camouflage: If an OOD node aggregates information from ID neighbors, it begins to resemble a known class, making it significantly harder to detect as an outlier.
Proposed Method: Learning to Mix Neighbors (LMN)
The LMN framework treats OOD detection as a prerequisite for high-quality classification. Its architecture consists of three main components working within a variational inference framework:
- Latent Variable Modeling: LMN introduces a latent variable to indicate whether a node is ID or OOD. Since OOD labels are unavailable during training, the model uses a variational objective (maximizing the Evidence Lower Bound, or ELBO) to infer this status.
- Weight Predictor ($f_\phi$): Instead of binary edge dropping, LMN uses an MLP-based predictor to generate soft weights (between 0 and 1) for every edge. These weights represent the probability that a neighbor is "helpful" (ID) versus "harmful" (OOD).
- Adaptive Message Passing: The GNN backbone (specifically GCNII) uses these learned weights to adjust how much information is pulled from each neighbor, effectively "muting" OOD nodes during aggregation.
Bi-level Optimization
To prevent the model from overfitting to the limited labeled data, the authors employ a bi-level optimization strategy. An "inner" loop trains the GNN parameters, while an "outer" loop updates the weight predictor based on validation performance. This ensures the weight predictor learns to generalize to unseen nodes rather than just memorizing the training set.
Experimental Results
LMN was evaluated on four benchmark datasets (Cora, Citeseer, Pubmed, and ogbn-arXiv) modified for open-set classification. It consistently outperformed ten representative GNN baselines, including GAT and GCNII, across two key metrics:
- Node Classification Accuracy: LMN achieved the highest accuracy on all datasets. Notably, on the large-scale ogbn-arXiv dataset, it reached 54.1% accuracy, surpassing the backbone GCNII (51.6%) and GAT (49.8%).
- OOD Detection (AUROC): LMN proved to be a superior outlier detector. On Citeseer, it achieved an AUROC of 78.5%, outperforming standard GCN by over 5%.
Conclusion
LMN demonstrates that explicitly modeling the ID/OOD status of neighbors is crucial for robust graph learning. By replacing random edge dropping with learned, soft weighting, LMN preserves essential graph structure while shielding the model from the corruptive effects of out-of-distribution noise.
Summary updated