NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Constraints From Examples

Luc De Raedt, Andrea Passerini, Stefano Teso

Introduction

In the standard machine learning paradigm, the objective is typically to learn a function $f$ that maps an input $x$ to an output $y$. However, many complex domains—ranging from industrial scheduling and circuit design to spreadsheet modeling—are governed not by simple mappings, but by a set of underlying rules or constraints. While Constraint Programming (CP) has long focused on solving these problems once the rules are known, the field of Constraint Learning seeks to induce these rules directly from examples.

This paper surveys the evolving landscape of learning constraint theories, highlighting how this paradigm differs from traditional classification and offers unique capabilities in reasoning, data completion, and interpretability.

The Constraint Learning Paradigm

The fundamental difference between a standard classifier and a learned constraint theory lies in the utility of the output. A binary classifier provides a "yes" or "no" label for a given instance. In contrast, a constraint theory defines a feasible space. This allows for:

  1. Data Completion: Given a partial assignment of variables, a constraint theory can infer the missing values.
  2. Optimization: Finding the "best" valid configuration according to some criteria.
  3. Explanation: Providing logical justifications for why a specific instance violates the system's rules.

Methodological Approaches

The survey categorizes the field into several distinct algorithmic strategies:

Symbolic and Relational Learning

Early foundations were laid by Valiant’s Algorithm, a "generate-and-test" method for learning $k$-CNF formulas. By starting with all possible clauses of a specific length and pruning those contradicted by positive examples, the system converges on a valid theory. Inductive Logic Programming (ILP) extends this to first-order logic, enabling the discovery of relational constraints—such as ensuring no two students in the same project group share the same ID.

In Constraint Programming, researchers have adapted Version Spaces to track the boundaries between the most specific and most general hypotheses. This allows the learner to narrow down the possible constraints governing a system as more data becomes available.

Soft Constraints and Probabilistic Models

Real-world data is often noisy, and rules are not always absolute. Soft constraints allow for violations by assigning penalties. Techniques like Weighted Model Counting (WMC) and Markov Logic Networks (MLNs) bridge the gap between hard logic and probabilistic graphical models, allowing the system to learn "preferences" rather than just "requirements."

Interactive and Active Learning

To accelerate discovery, systems often employ Interactive Learning. By querying a user—for example, asking if a specific partial assignment is valid—the algorithm can significantly reduce the number of examples needed to identify the correct theory.

Applications and Real-World Systems

Several specialized systems demonstrate the practical utility of these methods:

  • Tacle: Automatically learns formulas and functional dependencies within complex spreadsheets.
  • ModelSeeker: Capable of inducing global constraints (like alldiff) for complex scheduling tasks, such as the German Football League (Bundesliga), often from a single example schedule.
  • Bach: Induces relational specifications by observing the input-output behavior of software.
  • Configuration Tasks: Learning user preferences for custom products on e-commerce sites.

Key Insights

A critical distinction made by the authors is that "constraint learning" in this context is an inductive process (learning rules from data), whereas in solver literature, it often refers to a deductive process (deriving new constraints to speed up search).

Furthermore, the authors identify the "Power of Completion" as a defining feature. Because constraint theories define a space of valid points, they are inherently more versatile than discriminative models. However, this power comes with a trade-off: the "Dumbing Down" Paradox. To make interactive learning feasible for humans, queries must be simplified (partial queries), which reduces the information gain per interaction and slows the learning process.

Future Directions and Limitations

Despite its promise, the field faces several hurdles:

  • Computational Complexity: Inference for soft constraints is NP-hard, which creates a bottleneck during the learning phase.
  • Scalability: Symbolic methods often struggle with the scale and noise of modern "Big Data." The authors point toward Neuro-Symbolic AI—integrating logical reasoning with deep learning—as a vital frontier.
  • Human Interaction: Moving beyond simple binary queries toward "fat" queries that include explanations or arguments will be necessary to make these interactions more natural.

Conclusion

Constraint learning represents a powerful intersection of PAC-learning, ILP, and graphical models. By focusing on the underlying rules of a domain rather than just predictive mappings, it provides a path toward more interpretable, versatile, and reasoning-capable AI systems.

Summary updated

BibTeX
@inproceedings{raedt2018learning,
  author = {Luc De Raedt and Andrea Passerini and Stefano Teso},
  title = {{Learning Constraints From Examples}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.1609/aaai.v32i1.12217},
}
Figure