Exploiting Answer Set Programming with External Sources for Meta-Interpretive Learning

Tobias Kaminski, Thomas Eiter, Katsumi Inoue

Abstract

Meta-Interpretive Learning (MIL) learns logic programs from examples by instantiating meta-rules, which is implemented by the Metagol system based on Prolog. Viewing MIL-problems as combinatorial search problems, they can alternatively be solved by employing Answer Set Programming (ASP), which may result in performance gains as a result of efficient conflict propagation. However, a straightforward ASP-encoding of MIL results in a huge search space due to a lack of procedural bias and the need for grounding. To address these challenging issues, we encode MIL in the HEX-formalism, which is an extension of ASP that allows us to outsource the background knowledge, and we restrict the search space to compensate for a procedural bias in ASP. This way, the import of constants from the background knowledge can for a given type of meta-rules be limited to relevant ones. Moreover, by abstracting from term manipulations in the encoding and by exploiting the HEX interface mechanism, the import of such constants can be entirely avoided in order to mitigate the grounding bottleneck. An experimental evaluation shows promising results.

Introduction

Meta-Interpretive Learning (MIL) represents a significant advancement in Inductive Logic Programming (ILP), allowing systems to induce logic programs from examples by instantiating high-level templates known as meta-rules. While traditionally implemented in Prolog via systems like Metagol, MIL can be reframed as a combinatorial search problem suitable for Answer Set Programming (ASP). ASP solvers offer powerful global search capabilities and conflict propagation, which can prune search spaces more effectively than Prolog's depth-first approach.

However, migrating MIL to ASP introduces the "grounding bottleneck." ASP solvers typically require all possible rule instances to be generated before solving begins. When background knowledge (BK) includes complex data structures like long strings or lists, the resulting grounding size can become computationally prohibitive. This paper presents a novel approach using the HEX-formalism—an extension of ASP—to overcome these limitations through external background knowledge and state abstraction.

Methodology

The researchers developed three distinct encodings using HEX-programs, which allow ASP to interact with external "oracles" (implemented in languages like Python or C++).

1. Basic HEX-Encoding ($\Pi(\mathcal{M})$)

This initial encoding interleaves the hypothesis search with fact derivation. By outsourcing background knowledge to external atoms, the system can handle complex objects (e.g., lists) that are not natively supported by standard ASP. While functional, this approach still faces challenges regarding the volume of imported constants.

2. Forward-Chained Encoding ($\Pi_f(\mathcal{M})$)

To mitigate search space explosion, the authors introduced a "forward-chained" restriction. This method ensures that variables in a rule head are connected via a path in the body, allowing the system to "guard" the import of constants. Only terms that are actually reachable within the logic are brought into the solver, significantly reducing the grounding load.

3. State Abstraction ($\Pi_{sa}(\mathcal{M})$)

The most significant contribution is the state abstraction encoding, which treats MIL as a planning problem. It decouples planning (finding a sequence of actions to satisfy an example) from generalization (inducing the logic program). External atoms compute valid action sequences, while the ASP solver only processes abstract "states" represented as integers. By hiding complex object-level terms from the solver, this method effectively bypasses the grounding bottleneck.

Experimental Evaluation

The approach was tested against three benchmarks designed to highlight different aspects of ILP:

  • String Transformation (B1): Inducing grammars to manipulate strings (e.g., character deletion or transposition).
  • East-West Trains (B2): A classic ILP task requiring the system to distinguish train directions based on car properties.
  • Robot Waiter Strategies (B3): A complex planning task where a robot must manage state changes (e.g., filling cups) and movement to serve customers.

Key Insights and Results

Efficiency through Conflict Propagation

One of the primary advantages of the ASP-based approach is its ability to propagate constraints from negative examples. This allows the solver to prune the search space much earlier than Metagol. In several instances, the HEX-ASP system found solutions almost instantly, whereas Prolog-based systems required extensive search time.

Overcoming the Grounding Bottleneck

In the Robot Waiter (B3) task, standard guarded ASP encodings failed due to memory exhaustion during grounding. However, the State Abstraction encoding solved the problem efficiently. As the number of customers increased, the state abstraction model maintained negligible grounding times, demonstrating its scalability for complex planning tasks.

Division of Labor

The research demonstrates a powerful division of labor: external scripts handle the "how" of data manipulation (e.g., list processing), while the ASP solver focuses on the "how" of logical structure. This modularity allows the system to leverage the strengths of both procedural code and declarative logic.

Limitations and Future Work

While promising, the current optimized encodings (Forward-Chaining and State Abstraction) are restricted to specific meta-rule shapes. They currently struggle with learning programs that require "inverting" binary predicates unless those inverses are explicitly provided in the BK. Additionally, the system assumes extensional background knowledge (sets of facts), which may limit its application in scenarios requiring deeply nested background rules.

Future research will focus on integrating more sophisticated planning algorithms into external atoms and exploring non-deterministic environments. The authors also intend to evaluate how these architectural changes impact the predictive accuracy of learned programs on unseen data.

Summary updated

Abstract

Meta-Interpretive Learning (MIL) learns logic programs from examples by instantiating meta-rules, which is implemented by the Metagol system based on Prolog. Viewing MIL-problems as combinatorial search problems, they can alternatively be solved by employing Answer Set Programming (ASP), which may result in performance gains as a result of efficient conflict propagation. However, a straightforward ASP-encoding of MIL results in a huge search space due to a lack of procedural bias and the need for grounding. To address these challenging issues, we encode MIL in the HEX-formalism, which is an extension of ASP that allows us to outsource the background knowledge, and we restrict the search space to compensate for a procedural bias in ASP. This way, the import of constants from the background knowledge can for a given type of meta-rules be limited to relevant ones. Moreover, by abstracting from term manipulations in the encoding and by exploiting the HEX interface mechanism, the import of such constants can be entirely avoided in order to mitigate the grounding bottleneck. An experimental evaluation shows promising results.
BibTeX
@inproceedings{kaminski2018exploiting,
  author = {Tobias Kaminski and Thomas Eiter and Katsumi Inoue},
  title = {{Exploiting Answer Set Programming with External Sources for Meta-Interpretive Learning}},
  booktitle = {Theory Pract. Log. Program},
  year = {2018},
  url = {https://openreview.net/forum?id=fTfR8FaPWj},
}
Figure