Inductive logic programming (ILP) is a branch of machine learning that learns logic programs from examples, combining positive examples, negative examples and background knowledge into a set of clauses that explains the data. Within Symbolic AI & reasoning, it sits at the meeting point of inductive reasoning and logic programming: instead of a programmer writing rules, the system induces the rules and returns them as readable first-order clauses.
The output of ILP is a human-readable hypothesis, usually a set of Horn clauses that a Prolog or Datalog engine can execute directly. This makes ILP valuable in artificial intelligence settings where interpretability, small data and relational structure matter more than raw predictive accuracy.
How inductive logic programming learns rules
An ILP system solves a precise problem: given background knowledge B, positive examples E+ and negative examples E-, find a hypothesis H such that B together with H entails every positive example and no negative example. The two requirements are called completeness and consistency, and together they define what a correct hypothesis means.
To find H, the learner searches a hypothesis space of candidate clauses. That space is ordered by generality, usually through theta-subsumption: one clause is more general than another when a substitution maps it onto a subset of the other. The search can move top-down from very general clauses that are then specialized, or bottom-up from very specific clauses that are then generalized.
The following table names the core inputs and outputs of a typical ILP task and what each one contributes.
| Component | Form | Role in learning |
|---|---|---|
| Background knowledge | Facts and rules in logic | Supplies known relations the hypothesis may reuse |
| Positive examples | Ground facts to be covered | Define what the hypothesis must entail |
| Negative examples | Ground facts to be excluded | Prevent overly general rules |
| Language bias | Mode declarations, templates | Restricts which clauses may be built |
| Hypothesis | Set of definite clauses | The learned, executable program |
The language bias is decisive in practice. Mode declarations state which predicates may appear in the head and body of a clause and which arguments are inputs or outputs, and they shrink an otherwise infinite search space to a size a computer can explore.
Main approaches and systems
ILP research has produced several families of algorithms that differ in search direction and guarantees. Early systems relied on greedy covering, while modern ones increasingly use constraint solvers to find optimal programs.
The table below compares the best-known systems and the strategy each one represents.
| System | Search strategy | Typical strength |
|---|---|---|
| FOIL | Top-down, information gain | Fast greedy learning of single predicates |
| Progol | Inverse entailment, bottom clause | Strong use of background knowledge |
| Aleph | Bottom clause with configurable search | Flexible research and teaching tool |
| Metagol | Meta-interpretive learning | Predicate invention and recursion |
| Popper | Learning from failures with a solver | Optimal, textually minimal programs |
| ILASP | Answer set programming | Non-monotonic rules and preferences |
A notable capability of systems such as Metagol and Popper is predicate invention, the creation of new auxiliary predicates that were not in the background knowledge. Invented predicates let the learner decompose a hard concept into reusable parts, much as a programmer writes helper functions.
Another important property is the ability to learn recursive definitions, such as an ancestor relation built from a parent relation. Recursion lets a short program generalize to inputs of any size, which most statistical models cannot do from a handful of examples.
How ILP compares with related methods
ILP is best understood against its neighbors in machine learning and logic. It shares the inductive direction of statistical learning but keeps the declarative semantics of logic programming, and it differs sharply from deductive engines that only apply rules that already exist.
| Approach | What it produces | Data needs | Interpretability |
|---|---|---|---|
| Inductive logic programming | First-order logic rules | Few examples | High |
| Decision tree learning | Propositional tree | Moderate | Medium to high |
| Deep neural network | Numeric weights | Large datasets | Low |
| Logic programming | Hand-written rules | No training data | High |
| Abductive reasoning | Explaining facts for one case | Single observation | High |
The key distinction is relational expressiveness. A decision tree reads a fixed vector of attributes, whereas ILP can describe relations between variable numbers of objects, such as atoms bonded in a molecule or tasks linked in a plan. This is why ILP is often grouped with statistical relational learning and neuro-symbolic methods.
Where inductive logic programming is used
ILP is chosen when the learned model must be explained, audited or reused by people and machines, and when examples are scarce but structured. Its historical successes come from scientific domains with rich background theories.
- Bioinformatics and chemistry: learning structure-activity rules for drug candidates and protein features.
- Program synthesis: inducing small programs from input-output examples, including string transformations.
- Knowledge base completion: proposing new rules that link entities in a knowledge graph.
- Robotics and planning: learning action models and strategies from demonstrations.
- Explainable decision support: producing rules that domain experts can verify line by line.
The decision table below summarizes when ILP is a sensible choice and when another technique fits better.
| Situation | Recommended choice | Reason |
|---|---|---|
| Few examples, rich domain theory | ILP | Background knowledge compensates for small data |
| Rules must be audited | ILP | Output is a readable logic program |
| Millions of noisy images | Deep learning | ILP handles raw perception poorly |
| Tabular data, simple features | Decision trees or boosting | No relational structure to exploit |
Limitations and common pitfalls
The central difficulty of ILP is search complexity. Hypothesis spaces grow combinatorially with clause length and the number of predicates, so a poorly chosen language bias can make learning intractably slow or can exclude the correct answer entirely.
Classical systems are also sensitive to noise, because a strict consistency requirement treats a single mislabeled negative example as a contradiction. Modern systems relax this with scoring functions that tolerate some errors, but the trade-off between accuracy and rule simplicity still requires expert tuning.
- Weak background knowledge leads to long, overfitted clauses that memorize examples.
- Overly broad mode declarations cause search explosion and long run times.
- Missing negative examples produce rules that are far too general.
- Raw sensory input must first be converted into symbols, often by a neural component.
In everyday language
Inductive logic programming is a way for a computer to discover rules from examples. You show it some cases that fit a pattern and some that do not. You also give it facts it may use. It then writes short, clear rules that explain the difference.
Think of a detective who studies family photos and records. After a few cases, the detective writes a rule such as “a grandparent is a parent of a parent.” The rule is easy to read and check. That is the main benefit: people can see exactly why the computer decides as it does.
Seen in the real world
A pharmaceutical research team has about 200 tested compounds, some active against a target enzyme and some inactive. A neural network would need far more data, so the team turns to an ILP system. The background knowledge describes each molecule as atoms, bonds and functional groups, plus known chemical concepts such as ring structures.
After a run of several hours, the learner returns three short clauses. One states that a compound is active when it contains a six-membered aromatic ring bonded to a nitrogen atom at a specific distance from a hydrogen bond acceptor. The chemists can read and test each rule directly, and they use it to prioritize new candidate molecules for synthesis, which shortens the next screening round.