Abstract
The ability to reason over learned knowledge is an innate ability for humans, who can easily master new reasoning rules with only a few demonstrations. While most existing studies on knowledge graph (KG) reasoning assume sufficient training examples, we study the challenging and practical problem of few-shot knowledge graph reasoning under the paradigm of meta-learning. We propose a new meta-learning framework that effectively utilizes task-specific meta-information, such as local graph neighbors and reasoning paths in KGs. Specifically, we design a meta-encoder that encodes this meta-information into task-specific initialization parameters for different tasks. This allows our reasoning module to have diverse starting points when learning to reason over different relations, which is expected to better fit the target task. On two few-shot knowledge base completion benchmarks, we show that the augmented task-specific meta-encoder yields a much better initial point than MAML and outperforms several few-shot learning baselines.
Introduction
Knowledge Graph (KG) reasoning involves inferring missing facts by identifying multi-hop paths between entities. For instance, answering the query (Barack Obama, Nationality, ?) might involve traversing a path like BornInCity -> CityIn -> ProvinceIn. While deep reinforcement learning models have shown promise in this area, they typically require substantial training data for each relation.
In practice, KGs are often incomplete and characterized by "long-tail" relations with very few known examples. Standard few-shot meta-learning algorithms, such as Model-Agnostic Meta-Learning (MAML), attempt to address this by learning a generic initial model. However, in KG reasoning, each "task" corresponds to a distinct query relation. A single generic starting point is often insufficient because the model needs to grasp the specific context of a new relation to adapt quickly. Furthermore, standard MAML lacks a mechanism to initialize embeddings for entirely new query relations.
Proposed Framework: Meta-Reasoning with Meta-Encoders
To overcome these limitations, we introduce a meta-learning framework that augments a reinforcement learning reasoning agent (based on MINERVA) with a Meta-Encoder. Instead of a generic initialization, the Meta-Encoder leverages the few available support examples of a new relation to generate task-specific initialization parameters.
We propose two strategies for encoding meta-information:
- Neighbor Encoder: This encoder examines the immediate graph neighbors of the start and end entities in the support set. By aggregating these neighbor embeddings and calculating the difference between the neighborhoods of the start and end entities, it creates a representation of the new query relation.
- Path Encoder: In sparse graphs where entities have few neighbors, the Neighbor Encoder may fail. The Path Encoder uses a Long Short-Term Memory (LSTM) network to encode the actual multi-hop reasoning paths connecting start and end entities in the support examples.
These encoded representations provide the reasoning agent with a customized, highly informed starting point, facilitating rapid adaptation to new tasks.
Experimental Setup
We evaluated our framework on two few-shot multi-hop reasoning benchmarks:
- FB15K-237: A relatively dense knowledge graph.
- NELL: A sparse knowledge graph with a median outgoing degree of 1.
Relations were partitioned into meta-training, meta-development, and meta-test sets. Tasks were specifically filtered to include relations that exhibit positive transfer from other tasks.
Results and Discussion
Our models were evaluated in a 5-shot learning setting using Mean Reciprocal Rank (MRR) and Hits@K metrics.
Key Findings
- Contextual Relation Definition: The results demonstrate that a relation's meaning can be effectively inferred from its context—either through the neighbors of its entities or the paths connecting them—without requiring pre-trained embeddings.
- Impact of Graph Density: The choice of encoding strategy is heavily influenced by graph density. The Neighbor Encoder is highly effective on dense graphs like FB15K-237, achieving an MRR of 0.080, significantly outperforming standard MAML (0.035). However, on the sparse NELL dataset, the Path Encoder is superior, reaching an MRR of 0.137 compared to the Neighbor Encoder's 0.064.
- Superior Initialization: Ablation studies reveal that meta-encoders provide an exceptional "step zero" initialization. On FB15K-237, the Neighbor Encoder achieved an initial MRR of 0.056 before any gradient updates, vastly outperforming MAML's 0.010.
Limitations
While effective, the Path Encoder is inherently noisier than the Neighbor Encoder, as not all paths in the support set are logically relevant to the query relation. Additionally, the Neighbor Encoder's performance is strictly tied to node degree, making it vulnerable in sparse environments. We also observed some instability or performance degradation as the few-shot sample size increased to 50, suggesting sensitivity to data noise in larger support sets.
Conclusion
By incorporating task-specific meta-information through neighbor and path encoders, our framework provides a robust solution for few-shot reasoning in knowledge graphs. This approach allows models to quickly grasp the identity of new relations, significantly outperforming generic meta-learning baselines.
Summary updated