PRIMA: Planner-Reasoner Inside a Multi-task Reasoning Agent

Daoming Lyu, Bo Liu, Jianshu Chen

TL;DR

PRIMA introduces a Planner-Reasoner architecture for multi-task first-order logic reasoning that balances expressive reasoning power with inference efficiency. By using deep reinforcement learning (MuZero with Monte-Carlo Tree Search) to learn an explicit "Planner" that dynamically activates and chains only the necessary neural logic operators in a "Reasoner," PRIMA achieves 100% test accuracy across diverse relational reasoning tasks while dramatically cutting computational FLOPs compared to dense baselines.

What Problem Does This Paper Address?

In multi-task learning (MTL), an agent must acquire a diverse repertoire of reasoning skills to solve varied problems. However, existing neural-symbolic approaches—such as Neural Logic Machines (NLM)—suffer from an intrinsic trade-off between capability and efficiency:

  • To generalize across multiple tasks, a model must instantiate a vast space of predicate combinations and logic operators.
  • At inference time, any single task only requires a tiny subset of these deduction rules. Fully connecting and evaluating every operator across every layer leads to prohibitive computational explosion (especially as domain sizes grow).

The authors tackle how to train a single multi-task logic reasoning agent that maintains broad expressive power without paying the full inference cost for every task and instance.

Methods

PRIMA decouples first-order logic (FOL) deduction into two collaborative components trained end-to-end via reinforcement learning:

  1. The Reasoner (Execution): Implements elementary logic meta-rules as "learnable Horn clauses" using neural operators:
  2. BooleanLogic: Permutes predicate arguments and processes them through Multi-Layer Perceptrons (MLPs) with sigmoid activations to model conjunctions, disjunctions, and negations.
  3. Expansion & Reduction: Uses dimension repeating (expansion) and min/max pooling (reduction) to introduce or eliminate variables governed by universal ($\forall$) and existential ($\exists$) quantifiers.
  4. Unlike standard NLMs that concatenate all operators into a dense representation, PRIMA combines operator outputs additively, enabling operators to be switched on or off independently.
  5. The Planner (Dynamic Routing): A policy network that inspects current predicates and emits a binary "footprint" vector indicating which operators to execute at each reasoning layer, effectively executing pruned forward-chaining.
  6. In multi-task settings, a nullary task indicator predicate informs the Planner of the target task.
  7. RL Formulation & Training: Formulated as a Markov Decision Process (MDP) where states are predicate tensors, actions are operator activation vectors, and rewards penalize activated operators at intermediate steps while rewarding final task accuracy. The model is trained using MuZero with an enhanced Monte-Carlo Tree Search (MCTS/PUCT). At test time, the expensive MCTS is discarded, and the learned Base Planner executes in a single feed-forward pass.
       [Task Indicator & Base Predicates]
                       │
                       ▼
 ┌───────────────────────────────────────────┐
 │                  PLANNER                  │
 │  (Selects binary operator footprint mask) │
 └─────────────────────┬─────────────────────┘
                       │ (Dynamic Activation)
                       ▼
 ┌───────────────────────────────────────────┐
 │                 REASONER                  │
 │  • BooleanLogic (MLP + Permutation)       │
 │  • Expansion (Quantifier Introduction)    │
 │  • Reduction (Quantifier Elimination)     │
 └─────────────────────┬─────────────────────┘
                       ▼
            [Target Predicate Output]

Datasets

The framework is evaluated on eight relational reasoning benchmarks from family trees and graph tasks:

  • Graph Tasks: 1-Outdegree, AdjacentToRed, and 4-Connectivity.
  • Family Tree Tasks: HasFather, HasSister, IsGrandparent, IsUncle, and IsMGUncle.

To evaluate strong out-of-distribution generalization, models are trained on small sizes (graph size $m=10$, family tree size $m=20$) and evaluated on significantly larger, unseen domain sizes ($m=50$ for graphs, $m=100$ for family trees).

Key Insights and Ideas

  • Pruned Forward-Chaining vs. Exhaustive Search: Standard neural logic models evaluate all predicate interactions layer by layer. PRIMA shows that learning to prune deduction paths avoids task interference and avoids combinatorial compute explosions.
  • Instance-Dependent Dynamic Paths: Beyond selecting task-specific modules, the Planner dynamically adjusts sub-paths based on instance-level features (e.g., graph topology differences within AdjacentToRed), distinct from static Neural Architecture Search (NAS).
  • Cross-Task Operator Sharing: Visualizing operator reuse demonstrates that tasks heavily share core logical skills (such as certain unary/binary reduction operators) while reserving specific branches for idiosyncratic reasoning steps.

Key Results

  • Accuracy and Scalability: PRIMA (and its single-task variant PRISA-MuZero) achieves 100% test accuracy across all eight graph and family tree tasks at both small ($m=10/20$) and large ($m=50/100$) problem sizes, with a 90–100% Percentage of Successful Seeds (PSS). In contrast, Memory Networks (MemNN) degrade sharply on larger instances (e.g., dropping to 59.8% on HasFather at $m=100$), and DLM-MTR degrades on AdjacentToRed (97.2% accuracy, 0% PSS).
  • Computational Efficiency: PRIMA significantly reduces inference FLOPs relative to NLM and multi-task NLM (NLM-MTR), pruning out redundant operations while maintaining full accuracy.

Limitations and Future Work

  • Logic Scope: The current framework supports a restricted variant of first-order logic limited to relations (predicates up to fixed arity) without function symbols mapping terms.
  • Hierarchical Meta-Rules: The authors note that meta-rules currently operate at a flat, fixed-depth level; extending the system to higher-order logics or hierarchical skill abstractions remains an open direction.
  • Evaluation Domains: The empirical evaluation focuses on algorithmic, synthetic ILP graph/family-tree datasets rather than noisy, web-scale relational knowledge graphs.

Summary updated

BibTeX
@inproceedings{lyu2022prima,
  author = {Daoming Lyu and Bo Liu and Jianshu Chen},
  title = {{PRIMA: Planner-Reasoner Inside a Multi-task Reasoning Agent}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=B6YDcqpMk30},
}
Figure