TL;DR
REASONX is a novel explainable AI (XAI) tool that leverages Constraint Logic Programming (CLP) to generate interactive, contrastive explanations. Unlike traditional "one-shot" methods, it allows users to iteratively refine explanations by incorporating background knowledge and handling under-specified data profiles, making machine learning decisions more transparent and actionable.
What Problem Does This Paper Address?
As machine learning (ML) models increasingly govern high-stakes decisions—like credit approvals or medical diagnoses—the need for interpretability becomes critical. Contrastive Explanations (CEs), which tell a user why a decision was made by showing what would need to change to get a different outcome (e.g., "If your income were €5,000 higher, your loan would be approved"), are a popular solution.
However, existing CE methods often suffer from three major flaws:
- Lack of Interactivity: They typically provide a static answer rather than a dialogue.
- Ignoring Background Knowledge: They may suggest unrealistic changes (like "decrease your age") because they don't account for real-world constraints or specific user needs.
- Rigidity: Most tools require a fully specified data point to generate an explanation, whereas real-world users might only have partial information or "profiles."
Methods
The authors introduce REASONX (REASON to eXplain), which bridges these gaps using Constraint Logic Programming (CLP).
- The Core Engine: REASONX translates a decision tree (which can be the actual model or a surrogate of a "black box" model) into a set of Prolog facts. Each path in the tree becomes a conjunction of linear constraints.
- CLP(R) Integration: By using CLP over reals, the tool can perform complex reasoning: checking if a set of constraints is satisfiable, projecting constraints onto specific features, and solving Mixed-Integer Linear Programming (MILP) problems to find the "closest" contrastive example.
- Python Layer: While the heavy lifting happens in Prolog, the authors provide a Python wrapper. This allows data scientists to use standard tools while benefiting from the symbolic reasoning of CLP.
- Flexibility: Users can add their own constraints (e.g., "feature X must remain constant") or provide under-specified inputs (e.g., "age is between 20 and 30") to see how the model behaves across a region of the data space.
Datasets
The paper evaluates REASONX using two primary datasets:
- Synthetic Dataset: A simple 2D dataset with two classes used to visually demonstrate how REASONX identifies factual and contrastive regions.
- Adult Income Dataset: A well-known benchmark used here as a proxy for credit application scenarios. It includes 12 features ranging from categorical (workclass, sex) to continuous (age, capital gain).
Key Insights and Ideas
- Explanations as Dialogue: The authors argue that explainability is an interaction. REASONX supports this by allowing users to "tweak, tune, and personalize" explanations through iterative queries.
- Handling Uncertainty: One of the most powerful features is the ability to work with under-specified information. If a user doesn't know their exact "capital gain," they can provide a range, and REASONX will return a region of possible explanations rather than a single point.
- Beyond Global Optima: Most CE tools search for the single "best" (closest) explanation. REASONX can identify multiple local optima across different decision regions, giving the user more diverse options for recourse.
 Figure 1 shows how REASONX identifies the "factual region" where the current decision holds and the "contrastive regions" where the outcome would change.
Key Results
The paper demonstrates REASONX's utility through a fictional but grounded dialogue between a user and the system (see Figure 4).
Through this interaction, the user discovers that their credit was rejected due to income and car lease status. By adding a constraint that they need a minimum credit amount, they find that the model suggests an unrealistic age increase. This leads to a deeper query where the user uncovers a potential age bias in the underlying model—a discovery made possible only through interactive refinement.
Quantitatively, the authors show that adding background knowledge effectively narrows the search space. For instance, enforcing an "immutability" constraint on age reduces the number of valid contrastive rules, helping the user focus on actionable changes.

Limitations and Future Work
- Evaluation Gap: The authors acknowledge that a thorough quantitative evaluation and user studies are currently missing. Developing metrics for CLP-based XAI is a priority.
- Unstructured Data: While REASONX excels at tabular data, extending it to text or images requires a way to strictly formalize those inputs into linear constraints.
- Model Stability: The tool assumes the underlying ML model is stable over time, which may not hold in dynamic real-world environments.
- Future Directions: The team aims to implement more expressive tree types (like oblique trees) and add constraints for the diversity and sparsity of explanations.
Summary updated