Abstract
We present efficient differentiable implementations of second-order multi-hop reasoning using a large symbolic knowledge base (KB). We introduce a new operation which can be used to compositionally construct second-order multi-hop templates in a neural model, and evaluate a number of alternative implementations, with different time and memory trade offs. These techniques scale to KBs with millions of entities and tens of millions of triples, and lead to simple models with competitive performance on several learning tasks requiring multi-hop reasoning.
Introduction
Neural networks excel at pattern recognition but often struggle with structured, multi-step reasoning. Traditionally, answering complex questions like "Who directed the movies written by Christopher Nolan?" requires semantic parsing—converting text into a logical query to run against a Knowledge Base (KB). However, this approach often lacks end-to-end differentiability, making it difficult to train models using only question-answer pairs. Furthermore, existing differentiable logic systems frequently fail to scale when KBs grow to millions of entities and triples, either due to memory constraints or computational bottlenecks.
Methods: Relation-Set Following
The core contribution of this work is the relation-set following operation. Given a set of starting entities ($X$) and a set of relations ($R$), the operation identifies all entities reachable from $X$ via any relation in $R$. To make this operation efficient and scalable, the authors compared three implementation strategies:
- Naive Mixing: Combines all relation matrices into one weighted matrix before multiplication. This is memory-intensive and difficult to batch.
- Late Mixing: Computes results for each relation separately and sums them. While faster for small schemas, it slows down as the number of relations increases.
- Reified KB: The most efficient approach. Instead of separate matrices, the KB is represented as a set of triples $(subject, relation, object)$. Using sparse matrix operations and Hadamard products, it filters triples matching input entities and relations simultaneously.
By nesting these operations, a neural model can learn to follow "chains" of reasoning (e.g., $Entity \xrightarrow{R1} Entity \xrightarrow{R2} Entity$) where the choice of relations $R1$ and $R2$ is learned end-to-end.
Experimental Evaluation
The approach was evaluated across several benchmarks designed to test scale and reasoning depth:
- Synthetic Grid KB: A grid where entities are cells and relations are directions, used to test long reasoning chains (up to 10 hops).
- WebQuestionsSP: A real-world dataset based on a Freebase subset containing 43 million triples and 12 million entities.
- MetaQA: A movie-domain dataset requiring 1, 2, or 3 hops of reasoning.
- NELL-995: A standard benchmark for Knowledge Base Completion.
Key Results and Scalability
The Reified KB approach demonstrated significant advantages in both speed and robustness. On the synthetic grid task, it was approximately 12,000x faster than the naive implementation. Crucially, the model maintained high accuracy (~90%) even on 10-hop reasoning chains, showing minimal signal decay compared to traditional neural methods.
On the massive Freebase subset, the system processed 10,000 examples in roughly 30 minutes on a single GPU. In terms of accuracy, the Relation-Set Following (RSF) model outperformed Key-Value Memory Networks on MetaQA and achieved competitive results on WebQuestionsSP (Hits@1 of 52.7), despite being significantly simpler and faster than specialized graph-CNN architectures.
Conclusion
By treating the Knowledge Base as a flat list of facts rather than a collection of sparse matrices, the Reified KB approach allows differentiable reasoning to scale linearly with the number of facts. This bridges the gap between the pattern-matching strengths of neural networks and the structured reasoning capabilities of symbolic logic. Future work may explore "soft" KBs with continuous weights and automated discovery of reasoning templates.
Summary updated