# Generating Context-Aware Contrastive Explanations in Rule-based Systems

arXiv: https://arxiv.org/abs/2402.13000 · HTML: https://mlsanity.com/paper/2402.13000/

## Key facts

- Cited by 3 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 20 Feb 2024.

## Built on by (most cited first, 3 of 3)

- [xpSHACL: Explainable SHACL Validation using Retrieval-Augmented Generation and Large Language Models](https://mlsanity.com/paper/2507.08432/) (2025)
- [From Facts to Foils: Designing and Evaluating Counterfactual Explanations for Smart Environments](https://mlsanity.com/paper/2510.03078/) (2025)
- [Contrastive explanations of BDI agents](https://mlsanity.com/paper/2602.13323/) (2026)

## Abstract (arXiv)

Human explanations are often contrastive, meaning that they do not answer the indeterminate "Why?" question, but instead "Why P, rather than Q?". Automatically generating contrastive explanations is challenging because the contrastive event (Q) represents the expectation of a user in contrast to what happened. We present an approach that predicts a potential contrastive event in situations where a user asks for an explanation in the context of rule-based systems. Our approach analyzes a situation that needs to be explained and then selects the most likely rule a user may have expected instead of what the user has observed. This contrastive event is then used to create a contrastive explanation that is presented to the user. We have implemented the approach as a plugin for a home automation system and demonstrate its feasibility in four test scenarios.
