Abstract
Knowledge Graph Completion (KGC) is a critical task for maintaining the integrity of large-scale knowledge bases. However, traditional methods struggle with "long-tail" relations that possess limited training data. This paper presents the Relation-Aware Network with Attention-Based Loss (RANA), a framework designed for Few-Shot Knowledge Graph Completion (FKGC). RANA addresses two primary limitations in existing models: the "zero-loss" pitfall caused by easy negative samples and the lack of context-dependent entity representations. By employing a dynamic relation-aware encoder and an attention-based loss function that prioritizes hard negatives, RANA achieves state-of-the-art performance on benchmark datasets.
1. Introduction
Knowledge Graphs (KGs) such as Wikidata and NELL represent factual information as triples $(head \ entity, relation, tail \ entity)$. Despite their scale, KGs are inherently incomplete. While supervised KGC methods perform well on frequent relations, they falter in few-shot scenarios where only a handful of reference triples are available. Few-Shot Knowledge Graph Completion (FKGC) seeks to generalize from these sparse examples to predict missing links for unseen relations.
2. Problem Statement
Existing FKGC approaches encounter two significant hurdles:
- The "Easy" Negative Trap: Most models utilize a margin-based ranking loss with random negative sampling. If a negative triple is too obviously incorrect compared to the positive one, the model easily satisfies the margin, resulting in "zero loss." This prevents the model from learning the fine-grained nuances of the relation.
- Static Entity Representations: Entities are typically mapped to fixed embeddings. However, an entity's relevance changes depending on the relation. For instance, the representation of an entity should emphasize different neighbor attributes when the relation is "WorkIn" versus "Nationality."
3. The RANA Framework
RANA introduces three core components to overcome these challenges:
3.1 Dynamic Relation-Aware Entity Encoder
Instead of static embeddings, RANA generates entity representations by aggregating information from an entity's neighbors. It utilizes an attention mechanism to weight these neighbors based on the target relation. This ensures that the resulting embedding is contextually relevant to the specific query, effectively "viewing" the graph through the lens of the specific relation.
3.2 Strategic Negative Sampling and Candidate Pruning
To mitigate the "easy" negative trap, RANA implements a candidate pruning strategy. It filters out potential tail entities that are too dissimilar to the ground truth, forcing the model to distinguish between the true tail and "hard" negatives that reside near the decision boundary.
3.3 Attention-Based Loss Function
RANA moves beyond simple ranking loss by applying an attention-based weight to multiple negative samples. "Harder" negatives—those that the model currently finds difficult to distinguish from the truth—are assigned higher weights in the loss function. This prevents the optimization process from stagnating on easy examples.
3.4 Meta-Learning Integration
The framework is optimized using Model-Agnostic Meta-Learning (MAML). This allows the model to learn a parameter initialization that can be rapidly adapted to new, unseen relations with just a few gradient steps.
4. Experimental Evaluation
The authors evaluated RANA on two standard benchmarks:
- NELL-One: Derived from the Never-Ending Language Learning project, containing 68,545 entities and 358 relations.
- Wiki-One: Derived from Wikidata, containing over 4.8 million entities and 822 relations.
In both cases, relations were partitioned into training, validation, and testing sets to evaluate the model's ability to generalize to entirely "unseen" relations.
5. Results and Discussion
RANA consistently outperformed existing state-of-the-art models, including GANA and HiRe.
- Performance: On NELL-One, RANA achieved a Mean Reciprocal Rank (MRR) of 0.361, representing a 4.9% improvement over the previous best runner-up. It also demonstrated a 10.2% increase in Hits@10. On Wiki-One, RANA achieved an MRR of 0.379, outperforming the runner-up by 2.2%.
- Ablation Study: The importance of the attention-based loss was highlighted when its removal led to a significant MRR drop (from 0.372 to 0.293 on NELL-One). This confirms that strategic negative sampling and weighting are essential for effective training.
- Insights: The results suggest that "harder" training tasks lead to more robust models. By forcing the model to navigate complex decision boundaries, RANA develops a more precise understanding of relational contexts.
6. Conclusion and Future Work
The RANA framework effectively addresses the zero-loss problem and the limitations of static embeddings in FKGC. While the model shows diminishing returns as the number of shots increases beyond five, it sets a new standard for low-resource knowledge graph completion. Future research may focus on improving representations for "neighbor-starved" entities—those with fewer than ten neighbors—where current attention mechanisms struggle to generate meaningful context-aware representations.
Summary updated