Abstract
Knowledge graphs (KGs), as a structured form of knowledge representation, have been widely applied in the real world. Recently, few-shot knowledge graph completion (FKGC), which aims to predict missing facts for unseen relations with few-shot associated facts, has attracted increasing attention from practitioners and researchers. However, existing FKGC methods are based on metric learning or meta-learning, which often suffer from the out-of-distribution and overfitting problems. Meanwhile, they are incompetent at estimating uncertainties in predictions, which is critically important as model predictions could be very unreliable in few-shot settings. Furthermore, most of them cannot handle complex relations and ignore path information in KGs, which largely limits their performance. In this paper, we propose a normalizing flow-based neural process for few-shot knowledge graph completion (NP-FKGC). Specifically, we unify normalizing flows and neural processes to model a complex distribution of KG completion functions. This offers a novel way to predict facts for few-shot relations while estimating the uncertainty. Then, we propose a stochastic ManifoldE decoder to incorporate the neural process and handle complex relations in few-shot settings. To further improve performance, we introduce an attentive relation path-based graph neural network to capture path information in KGs. Extensive experiments on three public datasets demonstrate that our method significantly outperforms the existing FKGC methods and achieves state-of-the-art performance.
Introduction
Knowledge Graphs (KGs) such as Wikidata, NELL, and Freebase serve as the backbone for modern intelligent systems, including search engines and recommendation frameworks. Despite their utility, KGs are notoriously incomplete. While traditional KG completion methods require thousands of examples to learn a specific relation, real-world data is often "long-tailed," where many relations only have a handful of associated facts.
Few-shot knowledge graph completion (FKGC) addresses this by attempting to predict missing facts for unseen relations using only a few examples (the support set). However, existing approaches—primarily based on metric learning or meta-learning—face significant hurdles. They are prone to overfitting, struggle with out-of-distribution (OOD) data, and lack the ability to quantify uncertainty. Furthermore, they often fail to model complex "one-to-many" relations or leverage the rich path-based information inherent in graph structures.
The NP-FKGC Framework
To overcome these limitations, we propose NP-FKGC, a framework that integrates Neural Processes (NP) and Normalizing Flows (NF) to model the complex distribution of KG completion functions. The architecture consists of three core components:
1. Attentive Relation Path-based GNN (ARP-GNN)
Traditional Graph Neural Networks (GNNs) typically focus on an entity's immediate neighborhood. However, in few-shot reasoning, the sequence of relations—the path—between entities is often more informative than local connectivity alone. The ARP-GNN captures these multi-hop paths, providing a richer contextual embedding for entities involved in few-shot relations.
2. Normalizing Flow-based NP Encoder
Neural Processes represent the KG completion task as a distribution over functions rather than a single point estimate. While standard NPs assume a simple Gaussian (bell curve) distribution, real-world KG relations are often multi-modal (e.g., a "field of study" relation where one person has multiple distinct fields). By incorporating Normalizing Flows—a series of invertible transformations—we can warp a simple distribution into a complex, multi-modal one. This allows the model to better fit the true distribution of KG data and provides a mechanism to estimate prediction uncertainty via latent variable entropy.
3. Stochastic ManifoldE Decoder
Traditional decoders often treat entities as points in a vector space, which struggles with complex relation types. Our stochastic ManifoldE decoder treats relations as manifolds (spheres). By integrating the stochasticity from the NP encoder, the decoder can flexibly intersect head and tail entity representations, leading to more robust predictions in data-scarce environments.
Experimental Evaluation
We evaluated NP-FKGC on three benchmark datasets: NELL, WIKI, and FB15K-237. To simulate the long-tail challenge, we selected relations with only 50 to 500 triples.
Performance Gains
NP-FKGC achieved state-of-the-art (SOTA) performance, significantly outperforming previous models like GANA and FAAN. Key improvements in Mean Reciprocal Rank (MRR) include:
- 33.7% improvement on NELL
- 43.3% improvement on WIKI
- 17.5% improvement on FB15K-237
Notably, the Hits@1 metric (the accuracy of the top-ranked prediction) saw a 77.6% increase over GANA on the NELL dataset, demonstrating the model's precision in identifying correct facts.
Key Insights
- Uncertainty as a Signal: The model uses the entropy of latent variables to measure confidence. As the support set size increases or the quality of examples improves, entropy decreases. This allows the system to flag potentially unreliable predictions when data is noisy.
- Beyond Gaussian Assumptions: The use of Normalizing Flows proved essential for handling "one-to-many" relations. By moving beyond simple Gaussian distributions, the model maintains high performance in complex relational scenarios where traditional models fail.
- Path-Based Reasoning: The success of the ARP-GNN highlights that multi-hop path information is a critical feature for few-shot reasoning, offering more discriminative power than simple neighborhood aggregation.
Conclusion
NP-FKGC represents a significant step forward in few-shot knowledge graph completion. By combining the probabilistic flexibility of Neural Processes with the expressive power of Normalizing Flows and path-based GNNs, the framework effectively addresses the challenges of uncertainty, complex relations, and data scarcity. Future work will focus on improving the model's robustness to noise in the support set and scaling the architecture for web-scale knowledge graphs.
Summary updated