arXiv:2611.05039cs.AINov 2026

Manuscript Offprint

arXiv:2611.05039

ALBI: LLM-Guided Inductive Logic Programming via Iterative Generate-Test-Constrain Refineme

Aboubaker Seddiq Benterki, Jüri Vain, Gert Kanter, Leelo Aino Jürgenstein

Aboubaker Seddiq Benterki¹, Jüri Vain¹, Gert Kanter¹, and Leelo Aino Jürgenstein¹

Tallinn University of Technology (TalTech), Ehitajate tee 5, 19086 Tallinn, Estonia {aboubaker.benterki, leelo.jurgenstein, gert.kanter, juri.vain}@taltech.ee

Abstract. We introduce ALBI (Agent for Learning By Induction), a neuro-symbolic ILP framework that replaces the ASP-based hypothesis generator in the Learning from Failures (LFF) paradigm with a Large Language Model (LLM), while retaining SWI-Prolog as a formal verifier. ALBI implements an iterative generate-test-constrain loop: the LLM proposes candidate hypotheses from structured prompts; Prolog tests each candidate; and diagnostic feedback drives refinement. We further introduce semantic anonymization, a metamorphic testing methodology, to distinguish structural symbolic induction from surface-level pattern matching on predicate names. Experiments on 30 standard ILP benchmarks show that ALBI achieves 100% success across three frontier LLMs (Gemini 3.1 Pro, GPT 5.4 Pro, Claude Opus 4.6), matching Popper while requiring only 1.4–1.7 iterations on average. Under anonymization, all models maintain 100% success with a moderate iteration increase (1.36–1.67 times), providing evidence of robust symbolic reasoning.

Keywords: Inductive Logic Programming · Large Language Models · Neuro-Symbolic AI · Learning from Failures · Metamorphic Testing

1 Introduction

Inductive Logic Programming (ILP) addresses the fundamental challenge of inducing first-order logic theories from examples and background knowledge [20]. Unlike statistical learning methods that produce opaque models, ILP yields human-readable, verifiable logic programs making it particularly suited for domains requiring explainability and formal guarantees. The Learning from Failures (LFF) paradigm [7], implemented in the Popper system, decomposes ILP into three stages: generate a candidate hypothesis, test it against examples, and constrain the search space based on failures. This approach has achieved strong results across diverse domains, but its reliance on ASP solvers for hypothesis generation introduces a fundamental bottleneck: the combinatorial explosion of the search space as background knowledge complexity grows [4].

A. S. Benterki et al.

Recent advances in Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation and logical reasoning [26]. Gandarela et al. [23] provide the first systematic analysis of LLM capabilities in logic theory induction, revealing that while LLMs show competitive performance on simpler theories, they struggle with long predicate chains and formal consistency. These are precisely the weaknesses that a symbolic verifier can detect and correct, suggesting a natural division of labor: leveraging the LLM for hypothesis generation and the formal logic engine for verification and constraint enforcement.

We introduce ALBI (Agent for Learning By Induction), a framework that operationalizes this insight within the LFF paradigm. 1^{1} ALBI replaces the ASP generator with an LLM, augmented by: (i) a structured prompt architecture incorporating background knowledge, examples, bias constraints, and accumulated failure feedback; (ii) beam search over multiple candidate hypotheses with MDL-based selection [24], mitigating mode collapse in LLM generation [29]; (iii) an incremental locked clause mechanism for learning multi-clause theories; and (iv) a divide-and-conquer optimization phase guided by the Minimum Description Length principle.

A critical concern with LLM-based ILP is whether the model performs structural symbolic induction or merely exploits semantic cues in predicate names. We address this through semantic anonymization [1,2], a metamorphic testing methodology that replaces all meaningful predicate names with abstract identifiers, enabling rigorous evaluation of the system's symbolic reasoning capability.

Our contributions are:

  1. A neuro-symbolic ILP framework (ALBI) that integrates LLMs into the LFF paradigm as heuristic hypothesis generators with formal SWI-Prolog verification.

  2. A beam search strategy with structured diagnostic feedback that iteratively constrains the LLM's generation.

  3. A semantic anonymization methodology for metamorphic testing of LLM-based ILP systems.

  4. Empirical evaluation on 30 benchmark tasks with semantic and anonymized variants, comparing three frontier LLMs against the ASP-based Popper system.