Introduction
Knowledge Graphs (KGs) are essential for various AI applications, yet they are notoriously incomplete. Knowledge Graph Completion (KGC) aims to predict missing links between entities. However, standard methods struggle with Few-shot Knowledge Graph Completion (FKGC), where a new relation may only have a handful of example triples (typically 1 to 5). This paper introduces RSCL (Relation-Specific Context Learning), a framework designed to overcome the limitations of existing FKGC models by capturing multi-hop graph contexts and utilizing a hierarchical attention mechanism.
The Sparsity Challenge
Existing FKGC models primarily rely on an entity's "one-hop" or direct neighbors to generate representations. This approach faces two critical hurdles: the sparsity problem and low discrimination. In large-scale KGs like Wikidata, a vast majority of entities are "long-tailed," meaning they possess very few direct connections.
As shown in the figure above, approximately 82.6% of entities in the Wiki-One dataset are long-tailed. For these entities, one-hop information is insufficient to build a meaningful representation. Furthermore, different entities often share the same direct neighbors, making them indistinguishable to models that do not look further into the graph structure.
The RSCL Framework
To address these issues, RSCL moves beyond immediate neighborhoods to extract "graph contexts"—sequences of entities and relations that include both direct and distant (second-order) neighbors. The framework is composed of three primary modules.
1. Subgraph Extractor
Instead of simple neighbor aggregation, this module extracts paths that represent the structural role of an entity within the broader graph. By including distant neighbors, the model can differentiate between entities that might appear identical at a one-hop level.
2. Hierarchical Attention Network
This component processes the extracted subgraphs through two specialized encoders:
- Global Context Encoder: Utilizing a Transformer, this encoder models long-term dependencies within the extracted paths. To preserve graph topology within a sequence, the authors introduced a custom position encoding based on hop-distance.
- Local Neighbor Encoder: A Graph Attention Network (GAT) is used to specifically highlight and aggregate the most relevant immediate neighborhood information, ensuring that local details are not lost in the global context.
3. Hybrid Attentive Aggregator
Finally, this module evaluates the likelihood of a query triple by comparing it to reference triples at both global and local levels. An attention mechanism assigns higher weights to reference triples that are most structurally similar to the query, allowing for more precise relation-specific representations.
Key Results and Insights
RSCL was evaluated on two major benchmarks: NELL-One and the significantly larger and sparser Wiki-One. The model consistently outperformed previous state-of-the-art (SOTA) methods such as FAAN and GANA.
On the NELL-One 5-shot task, RSCL achieved a Mean Reciprocal Rank (MRR) of 0.317, a notable improvement over FAAN's 0.279. On Wiki-One, it reached an MRR of 0.348. Most importantly, RSCL showed dramatic performance gains on specialized "long-tail" subsets, proving that capturing distant context is essential for handling sparse data. Ablation studies confirmed that removing either the distant neighbors or the global encoder led to a significant drop in performance, validating the "multi-hop context" approach.
Conclusion and Future Work
RSCL demonstrates that for sparse entities, the path to other entities is often more informative than the immediate neighbors themselves. By treating graph paths as sequences for a Transformer, the model successfully captures global structural roles. While the computational cost of Transformers remains a challenge, future work will focus on developing lightweight versions of these networks and incorporating external knowledge, such as text descriptions, to further enrich entity representations.
Summary updated