Generating Context-Aware Contrastive Explanations in Rule-based Systems
Lars Herbold, Mersedeh Sadeghi, Andreas Vogelsang
TL;DR
The paper tackles the challenge of generating context-aware, contrastive explanations for rule-based smart environments. It introduces a framework that first identifies three basic confusing cases (CC) to model user expectations, then computes likelihood scores for candidate foils using four factors: Precondition Similarity, Ownership, Frequency, and Explanation Occurrence; these scores are ranked with TOPSIS to select the most likely foil. An explanation is then generated using CC-specific templates, optionally refined by an LLM to ensure fluent language. The approach is implemented as a SmartEx plugin for Home Assistant and validated through four test scenarios in an office setting, demonstrating that the system can produce tailored, contrastive explanations that align with user expectations. The work contributes a concrete, end-to-end method for contrastive explanation in rule-based CPS and highlights practical considerations for integration, evaluation, and future extensions such as explanation-demand detection and weighting schemes.
Abstract
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.
