# Towards Counterfactual Explanation and Assertion Inference for CPS Debugging

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

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- Builds on 14 of its 53 references that are in the map.
- First posted on arXiv 9 Apr 2026.

## Builds on (most cited first, 14 of 14)

- [Explaining Machine Learning Classifiers through Diverse Counterfactual Explanations](https://mlsanity.com/paper/1905.07697/) (2019)
- [Interpretable Counterfactual Explanations Guided by Prototypes](https://mlsanity.com/paper/1907.02584/) (2019)
- [A Random Forest Guided Tour](https://mlsanity.com/paper/1511.05741/) (2015)
- [Towards Unifying Feature Attribution and Counterfactual Explanations: Different Means to the Same End](https://mlsanity.com/paper/2011.04917/) (2020)
- [GeCo: Quality Counterfactual Explanations in Real Time](https://mlsanity.com/paper/2101.01292/) (2021)
- [Causal Testing: Finding Defects' Root Causes](https://mlsanity.com/paper/1809.06991/) (2018)
- [Requirements-driven Test Generation for Autonomous Vehicles with Machine Learning Components](https://mlsanity.com/paper/1908.01094/) (2019)
- [When Cyber-Physical Systems Meet AI: A Benchmark, an Evaluation, and a Way Forward](https://mlsanity.com/paper/2111.04324/) (2021)
- [Combining Genetic Programming and Model Checking to Generate Environment Assumptions](https://mlsanity.com/paper/2101.01933/) (2021)
- [Applications of Causality and Causal Inference in Software Engineering](https://mlsanity.com/paper/2303.16989/) (2023)
- [A Roadmap for Simulation-Based Testing of Autonomous Cyber-Physical Systems: Challenges and Future Direction](https://mlsanity.com/paper/2405.01064/) (2024)
- [Root Cause Detection Among Anomalous Time Series Using Temporal State Alignment](https://mlsanity.com/paper/2001.01056/) (2020)
- [Learning Non-robustness using Simulation-based Testing: a Network Traffic-shaping Case Study](https://mlsanity.com/paper/2212.08726/) (2022)
- [Finding Unknown Unknowns using Cyber-Physical System Simulators (Extended Report)](https://mlsanity.com/paper/2503.22646/) (2025)

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

- [An Empirical Study of Architectural Shift from Traditional to AI-Enabled Simulink Controllers](https://mlsanity.com/paper/2609.38504/) (2026)

## Abstract (arXiv)

Verification and validation of cyber-physical systems (CPS) via large-scale simulation often surface failures that are hard to interpret, especially when triggered by interactions between continuous and discrete behaviors at specific events or times. Existing debugging techniques can localize anomalies to specific model components, but they provide little insight into the input-signal values and timing conditions that trigger violations, or the minimal, precisely timed changes that could have prevented the failure. In this article, we introduce DeCaF, a counterfactual-guided explanation and assertion-based characterization framework for CPS debugging. Given a failing test input, DeCaF generates counterfactual changes to the input signals that transform the test from failing to passing. These changes are designed to be minimal, necessary, and sufficient to precisely restore correctness. Then, it infers assertions as logical predicates over inputs that generalize recovery conditions in an interpretable form engineers can reason about, without requiring access to internal model details. Our approach combines three counterfactual generators with two causal models, and infers success assertions. Across three CPS case studies, DeCaF achieves its best success rate with KD-Tree Nearest Neighbors combined with M5 model tree, while Genetic Algorithm combined with Random Forest provides the strongest balance between success and causal precision.
