TL;DR
REASONX is a novel explainable AI (XAI) tool that combines Python with Constraint Logic Programming (CLP) to deliver interactive, declarative explanations for machine learning models. By representing decision rules and user-defined background knowledge as linear constraints, it allows users to seamlessly query explanations, optimize for contrastive instances, and reason over partially specified data points.
What Problem Does This Paper Address?
Most current eXplainable AI (XAI) methods provide static, descriptive explanations—telling you what features were important for a specific prediction, but rarely letting you interactively reason over the decision logic. Furthermore, existing tools typically require a fully specified data point to generate an explanation and struggle to integrate symbolic background knowledge or common-sense constraints (e.g., "age cannot decrease").
To bridge this gap, the authors address the lack of abstraction, limited user interactivity, and poor integration of domain knowledge in current XAI methods. They aim to turn the explanation process into an interactive dialogue where users can query models, inject constraints, and analyze sub-populations or multiple models simultaneously.
Methods
The core innovation of REASONX is a closed algebra of operators over theories of linear constraints, implemented in a distinct two-layer architecture:
- Python Layer: The user-facing interface where data analysts define instances, models, and background knowledge. It handles data storage (via
pandasandscikit-learn) and translates user inputs into formal queries. - Constraint Logic Programming (CLP) Layer: The reasoning engine, written in CLP over the reals ($\text{CLP}(\mathbb{R})$) using SWI-Prolog. It implements a meta-interpreter that evaluates the algebraic queries and handles the underlying linear constraint solving.
REASONX operates on decision trees, which can either be the target model itself or serve as global/local surrogate models for black-box predictors (like neural networks or XGBoost). A path through the decision tree naturally maps to a conjunction of linear inequalities.
For contrastive explanations (finding the closest alternative scenario), REASONX leverages Mixed-Integer Linear Programming (MILP) to optimize distance metrics (such as $L_1$ or $L_\infty$ norms) while respecting user-defined feasibility constraints (e.g., immutability of certain features).
Datasets
The authors evaluated REASONX using five popular tabular datasets from the credit and income domains:
- Adult Income (ADULT): Predicting whether income exceeds \$50k/year.
- South German Credit (SGC): Assessing credit risk.
- Give Me Some Credit (GMSC): Predicting the probability of financial distress.
- Default of Credit Card Clients (DCCC): Predicting credit card default.
- Australian Credit Approval (ACA): Credit card application approval.
Key Insights and Ideas
- Intensional vs. Extensional Reasoning: Traditional XAI treats instances as fixed points in space (extensional). REASONX treats them as polyhedra defined by linear constraints (intensional). This allows it to handle under-specified instances (e.g., querying an explanation for a cohort where $20 \le \text{age} \le 30$ without fixing a single age).
- The "Explanation Dialogue": Because the query language is closed (the output constraints can be fed directly back into the next query), users can iteratively refine explanations by asserting or retracting constraints, mimicking a natural conversation with the AI system.
- Multi-Model and Temporal Analysis: REASONX can natively reason across different models or the same model retrained over time. By intersecting constraint theories, it can find contrastive explanations that remain valid even after a model is updated.
Key Results
- Factual and Contrastive Quality: Quantitative evaluation showed that the contrastive examples generated by REASONX are generally closer to the original instance (smaller distance metrics) than those produced by popular frameworks like DiCE.
- Interactivity Trade-off: While standard tools like ANCHORS or DiCE are faster for single, static explanations, REASONX executes complex, constraint-bound queries within a highly acceptable 0.5 to 1.5 seconds range. This slight overhead is a direct trade-off for its significantly higher expressivity and reasoning capabilities.
Limitations and Future Work
- Tabular and Binary Focus: The current implementation is demonstrated primarily on tabular data and binary classification problems. Extending this to unstructured data (like text or images) requires integrating concept-extraction layers.
- Surrogate Fidelity: When explaining black-box models, REASONX relies heavily on the fidelity of its local or global decision tree surrogates. If the surrogate fails to mimic the black-box accurately, the explanations lose validity.
- User Studies: While theoretically sound, the practical usability of the tool—specifically how easily lay users or domain experts can formulate linear constraints—remains to be validated through comprehensive user studies.
Summary updated