TL;DR
This paper introduces MAXREFACTOR, a new approach to compressing logic programs by inventing new rules. By shifting from rule-based to literal-based decision variables and focusing on "linear" rules, the authors achieve up to 60% better compression and significantly better scalability than previous state-of-the-art methods.
What Problem Does This Paper Address?
In the world of Inductive Logic Programming (ILP) and program synthesis, "knowledge refactoring" is the process of making a logic program smaller and more efficient by identifying repeating patterns and replacing them with new, "invented" rules. Think of it like refactoring code to move repeated logic into a shared helper function.
The core challenge is scalability. The previous state-of-the-art tool, KNORF, works by enumerating every possible subset of literals within every rule to find candidates for new helper rules. This leads to a combinatorial explosion: for a program with $n$ rules of size $k$, KNORF requires $O(n2^k)$ decision variables. As rules get longer or more numerous, KNORF quickly becomes unusable.
Methods
The authors propose MAXREFACTOR, which treats refactoring as a Constrained Optimisation Problem (COP) but with a much smarter encoding.
- Literal-Based Encoding: Instead of picking from a pre-enumerated list of all possible sub-rules, MAXREFACTOR uses decision variables to decide, for each literal in the original program, whether it should be "covered" by a specific invented rule. This reduces the number of decision variables to $O(nk)$, a massive improvement over the exponential $O(n2^k)$.
- Linear Invented Rules: The authors introduce the concept of "linear" invented rules—rules where variables appear only once in the body. Crucially, they provide a theoretical proof (Theorem 2) showing that restricting the search to linear rules does not sacrifice the ability to find the most compressed refactoring.
- COP and MaxSAT Formulations: They encode the problem such that a solver (like Google's CP-SAT or UWrMaxSat) can minimize an objective function representing the total size of the refactored program (number of literals).
Datasets
The authors evaluated their approach on several benchmarks:
- Lego and Strings: Two datasets from the original KNORF paper. Lego contains 200 programs; Strings contains 196 programs (some with over 12,000 literals).
- Real-World Knowledge Bases: To test scalability, they sampled rules from three massive datasets: DrugDrug (drug interactions), Alzheimer (biological pathways), and WordNet (lexical database).
Key Insights and Ideas
- The "Aha!" Moment on Encoding: The realization that you don't need to pre-calculate every possible sub-rule. By letting the solver "build" the invented rules literal-by-literal, you bypass the combinatorial explosion that crippled previous methods.
- Linearity is Enough: Proving that linear rules are sufficient for optimal compression is a major theoretical win. It simplifies the search space without losing the "best" possible answer.
- NP-Hardness: The paper provides a formal proof that the Optimal Knowledge Refactoring (OKR) problem is NP-hard, justifying the use of powerful combinatorial solvers like MaxSAT and CP-SAT.
- Beyond Subsets: Unlike KNORF, which can only invent rules that are strict subsets of existing rules, MAXREFACTOR can invent rules that combine literals in ways never seen in a single original rule (as shown in the $P_3$ example in the paper).
Key Results
- Superior Compression: On the Lego dataset, MAXREFACTOR improved compression rates by at least 27% across all programs compared to KNORF. On the Strings dataset, it found better refactorings in 172 out of 196 cases, with an average compression improvement of 30% (and up to 60% in some instances).
- Massive Scalability: While KNORF struggled with even moderately sized programs, MAXREFACTOR successfully refactored programs with up to 1,000 rules.
- Anytime Performance: The system finds "near-optimal" solutions very quickly. For example, in the DrugDrug task, it found a refactoring within 20% of the optimal size in just 300 seconds, even though proving that the solution was truly optimal took over 2,400 minutes.
Limitations and Future Work
The authors identify two main areas for improvement:
- No Recursion: The current system does not support the invention of recursive rules.
- No Nesting: It does not currently support "nested" predicate invention (where one invented rule calls another invented rule).
Addressing these could lead to even higher compression rates, as many logical patterns are inherently hierarchical or recursive.
Summary updated