Introduction
A fundamental challenge in artificial intelligence is systematicity: the ability of a model to learn fundamental rules from simple examples and recombine them to solve novel, complex problems. While deep learning has achieved remarkable success in pattern recognition, it often struggles with this form of compositional generalization. In relational reasoning, for instance, a model that understands the rule "the mother of a parent is a grandmother" should theoretically be able to deduce a 10-hop kinship relation by chain-linking these rules, even if it was only trained on 2-hop or 3-hop examples.
Existing approaches generally fall into two categories, both with significant drawbacks. Neural and embedding-based models, such as Graph Neural Networks (GNNs), capture patterns effectively but encapsulate rules implicitly within "black-box" vectors. This makes them difficult to interpret and prone to failure when generalizing to paths longer than those seen during training. Conversely, Inductive Logic Programming (ILP) learns explicit symbolic rules but faces an exponential explosion in search space as the number of relations and path lengths increase. To bridge this gap, we present R5, a novel framework that treats relational reasoning as a scalable, interpretable sequential decision-making problem.
The R5 Framework
R5 (Reinforced and Recurrent Relational Reasoning) moves away from one-shot relation prediction. Instead, it employs an agent that iteratively simplifies the path between two entities through a series of "merge" operations.
Recurrent Reasoning with MCTS
The core of R5 is a policy-value network guided by Monte Carlo Tree Search (MCTS). The agent evaluates a path and decides which pair of adjacent relations to merge into a single compound relation. For example, given the sequence (Person A, Mother, Person B, Sister, Person C), the agent might merge (Mother, Sister) into a single logical unit. This recurrent process continues until the path is reduced to the target relation.
Dynamic Rule Memory and Predicate Invention
To manage the discovered logic, R5 maintains a dynamic hash table of candidate rules ($r_k \leftarrow r_i, r_j$). During training, the agent queries this memory to reuse established rules. If a merge action does not match an existing entry, R5 utilizes Predicate Invention. This allows the model to create placeholder relations to bridge gaps in its current knowledge base. This "buffer" effect is crucial; it allows the agent to learn that two relations should be combined before it has identified exactly what the resulting ground-truth relation is.
Backtrack Rewriting
To maintain a clean and efficient rule set—adhering to the principle of Occam’s Razor—R5 employs a backtracking mechanism. If the model later discovers that an "invented" placeholder is equivalent to a known relation (e.g., "Grandma"), it rewrites the rule memory to replace the placeholder with the correct ground-truth relation. This ensures the rule set remains interpretable and compact.
Experimental Evaluation
The authors evaluated R5 on several benchmarks designed to test logical generalization and robustness:
- CLUTRR: A kinship reasoning dataset where models are trained on short stories (2-4 hops) and tested on significantly longer sequences (up to 10 hops).
- GraphLog: A benchmark consisting of various "logical worlds" with distinct rule sets, including inconsistent data to test robustness.
- Re 0, Re 1, Re 2: Custom benchmarks generated to push the limits of rule induction by providing very few training samples and requiring long resolution lengths.
Key Results and Insights
Compositional Generalization
R5 demonstrates exceptional systematicity. On the CLUTRR dataset, R5 maintained near-perfect accuracy (~98%) even as story length increased to 10 hops. In contrast, state-of-the-art baselines like Conditional Theorem Provers (CTP) experienced significant performance degradation as path lengths increased. Because R5 learns the fundamental "building blocks" of logic, it can apply them recurrently regardless of the total path length.
Rule Discovery and Data Efficiency
In GraphLog experiments, R5 achieved a 1.0 Rules Recall across multiple logical worlds, meaning it successfully identified every underlying ground-truth rule used to generate the data. Furthermore, R5 proved highly efficient with limited data. In the "Re 1" dataset, which features long paths and few samples, R5 achieved 57.5% accuracy, vastly outperforming the 19.0% achieved by the best baseline.
Robustness to Noise
Because R5 uses a scoring mechanism within its rule memory, it is naturally robust to noise. Rules that are rarely successful or are derived from logically inconsistent data points see their scores decay over time, leading to their eventual removal from the memory. This allows the model to "out-vote" noise and focus on statistically significant logical principles.
Limitations and Future Work
While R5 represents a significant step forward in symbolic-neural integration, some limitations remain. Currently, R5 is optimized for predicting the relation between two known entities rather than performing standard Knowledge Base Completion (KBC) tasks like entity ranking (e.g., predicting who a specific relative is). Additionally, the model's reliance on pre-sampled paths may present scalability challenges in extremely dense knowledge graphs. Finally, R5 currently outputs symbolic "best guesses" rather than calibrated probability distributions. Future work will focus on extending R5 to handle these transductive aspects and improving path sampling efficiency in large-scale environments.
Conclusion
R5 demonstrates that by combining the strengths of reinforcement learning, MCTS, and symbolic memory, it is possible to create a relational reasoning system that is both highly interpretable and capable of profound systematic generalization. By "thinking" in steps and inventing predicates to bridge knowledge gaps, R5 moves closer to the human-like ability to derive universal rules from limited observations.
Summary updated