Abstract
We study the problem of learning to reason in large scale knowledge graphs (KGs). More specifically, we describe a novel reinforcement learning framework for learning multi-hop relational paths: we use a policy-based agent with continuous states based on knowledge graph embeddings, which reasons in a KG vector space by sampling the most promising relation to extend its path. In contrast to prior work, our approach includes a reward function that takes the accuracy, diversity, and efficiency into consideration. Experimentally, we show that our proposed method outperforms a path-ranking based algorithm and knowledge graph embedding methods on Freebase and Never-Ending Language Learning datasets.
Introduction
Knowledge Graphs (KGs) such as Freebase and NELL serve as critical backbones for many AI applications. However, these graphs are inherently incomplete. Reasoning—the ability to infer new facts from existing ones—is essential for KG completion. Traditional methods like the Path-Ranking Algorithm (PRA) often struggle with the exponential growth of search spaces and the discrete nature of graph nodes, which fails to capture semantic similarities. DeepPath addresses these challenges by framing path-finding as a reinforcement learning (RL) task within a continuous vector space.
Methodology: The RL Framework
DeepPath treats reasoning as a Markov Decision Process (MDP). A policy-based agent navigates the KG to find multi-hop paths between a source and target entity.
Agent Architecture
The agent's state is represented by a continuous vector combining the current entity's embedding and the vector difference to the target entity. This allows the agent to generalize across semantically similar entities. At each step, the agent selects a relation to follow based on a policy $\pi(a|s)$ parameterized by a deep neural network.
Reward Function
The core innovation of DeepPath is its multi-objective reward function:
- Global Accuracy: A binary reward (+1 or -1) based on whether the agent reaches the correct target.
- Path Efficiency: A reward proportional to $1/length$ to encourage shorter, more reliable paths.
- Path Diversity: A penalty based on cosine similarity to existing paths, forcing the agent to find diverse logical chains.
Training
To overcome the "cold start" problem in sparse graphs, the model undergoes supervised pre-training using paths found via randomized Breadth-First Search (BFS). This is followed by RL retraining using the REINFORCE policy gradient algorithm.
Experimental Evaluation
The model was tested on two benchmarks: FB15K-237 (a challenging version of Freebase) and NELL-995.
Fact Prediction Performance
DeepPath significantly outperforms traditional embedding-based methods (TransE, TransH, TransR, TransD) in fact prediction tasks. By leveraging multi-hop paths, the agent provides explicit evidence for its conclusions, unlike black-box embedding models.
Reasoning Efficiency and Interpretability
Beyond accuracy, DeepPath is remarkably efficient. On FB15K-237, it achieved a Mean Average Precision (MAP) of 0.572, surpassing PRA's 0.541. Crucially, DeepPath required an average of only 20.3 reasoning paths to reach a conclusion, compared to 137.2 for PRA. This reduction in path count improves both computational speed and the interpretability of the reasoning process.
Conclusion
DeepPath demonstrates that reinforcement learning in a continuous embedding space is a powerful paradigm for KG reasoning. By rewarding accuracy, efficiency, and diversity, the agent learns to find high-quality reasoning paths that outperform both discrete path-ranking and continuous embedding-only methods. Future work may involve integrating natural language context to further improve reasoning in sparse graph regions.
Summary updated