# GeCo: Quality Counterfactual Explanations in Real Time

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

## Key facts

- Cited by 32 papers in the map (data through 14 Oct 2026).
- Builds on 19 of its 42 references that are in the map.
- First posted on arXiv 5 Jan 2021.

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

- [Towards Deep Learning Models Resistant to Adversarial Attacks](https://mlsanity.com/paper/1706.06083/) (2017)
- [Intriguing properties of neural networks](https://mlsanity.com/paper/1312.6199/) (2013)
- ["Why Should I Trust You?": Explaining the Predictions of Any Classifier](https://mlsanity.com/paper/1602.04938/) (2016)
- [Towards Evaluating the Robustness of Neural Networks](https://mlsanity.com/paper/1608.04644/) (2016)
- [Learning Important Features Through Propagating Activation Differences](https://mlsanity.com/paper/1704.02685/) (2017)
- [Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPR](https://mlsanity.com/paper/1711.00399/) (2017)
- [TabNet: Attentive Interpretable Tabular Learning](https://mlsanity.com/paper/1908.07442/) (2019)
- [Explaining Machine Learning Classifiers through Diverse Counterfactual Explanations](https://mlsanity.com/paper/1905.07697/) (2019)
- [Fooling LIME and SHAP: Adversarial Attacks on Post hoc Explanation Methods](https://mlsanity.com/paper/1911.02508/) (2019)
- [Actionable Recourse in Linear Classification](https://mlsanity.com/paper/1809.06514/) (2018)
- [Simple Black-box Adversarial Attacks](https://mlsanity.com/paper/1905.07121/) (2019)
- [Explainable Machine Learning in Deployment](https://mlsanity.com/paper/1909.06342/) (2019)
- [The What-If Tool: Interactive Probing of Machine Learning Models](https://mlsanity.com/paper/1907.04135/) (2019)
- [Model-Agnostic Counterfactual Explanations for Consequential Decisions](https://mlsanity.com/paper/1905.11190/) (2019)
- [Preserving Causal Constraints in Counterfactual Explanations for Machine Learning Classifiers](https://mlsanity.com/paper/1912.03277/) (2019)
- [Declarative Recursive Computation on an RDBMS, or, Why You Should Use a Database For Distributed Machine Learning](https://mlsanity.com/paper/1904.11121/) (2019)
- [A Layered Aggregate Engine for Analytics Workloads](https://mlsanity.com/paper/1906.08687/) (2019)
- [MLJ: A Julia package for composable machine learning](https://mlsanity.com/paper/2007.12285/) (2020)
- [Building Efficient Query Engines in a High-Level Language](https://mlsanity.com/paper/1612.05566/) (2016)

## Built on by (most cited first, 30 of 32)

- [If Only We Had Better Counterfactual Explanations: Five Key Deficits to Rectify in the Evaluation of Counterfactual XAI Techniques](https://mlsanity.com/paper/2103.01035/) (2021)
- [NICE: An Algorithm for Nearest Instance Counterfactual Explanations](https://mlsanity.com/paper/2104.07411/) (2021)
- [Even if Explanations: Prior Work, Desiderata & Benchmarks for Semi-Factual XAI](https://mlsanity.com/paper/2301.11970/) (2023)
- [Motif-guided Time Series Counterfactual Explanations](https://mlsanity.com/paper/2211.04411/) (2022)
- [Keep Your Friends Close and Your Counterfactuals Closer: Improved Learning From Closest Rather Than Plausible Counterfactual Explanations in an Abstract Setting](https://mlsanity.com/paper/2205.05515/) (2022)
- [Achieving Diversity in Counterfactual Explanations: a Review and Discussion](https://mlsanity.com/paper/2305.05840/) (2023)
- [GAM Coach: Towards Interactive and User-centered Algorithmic Recourse](https://mlsanity.com/paper/2302.14165/) (2023)
- [Solving the Class Imbalance Problem Using a Counterfactual Method for Data Augmentation](https://mlsanity.com/paper/2111.03516/) (2021)
- [FASTER-CE: Fast, Sparse, Transparent, and Robust Counterfactual Explanations](https://mlsanity.com/paper/2210.06578/) (2022)
- [Even-Ifs From If-Onlys: Are the Best Semi-Factual Explanations Found Using Counterfactuals As Guides?](https://mlsanity.com/paper/2403.00980/) (2024)
- [Computing Rule-Based Explanations by Leveraging Counterfactuals](https://mlsanity.com/paper/2210.17071/) (2022)
- [Disagreement amongst counterfactual explanations: How transparency can be deceptive](https://mlsanity.com/paper/2304.12667/) (2023)
- [Guiding the generation of counterfactual explanations through temporal background knowledge for Predictive Process Monitoring](https://mlsanity.com/paper/2403.11642/) (2024)
- [Generating Counterfactual Explanations Under Temporal Constraints](https://mlsanity.com/paper/2503.01792/) (2025)
- [Handling Climate Change Using Counterfactuals: Using Counterfactuals in Data Augmentation to Predict Crop Growth in an Uncertain Climate Future](https://mlsanity.com/paper/2104.04008/) (2021)
- [counterfactuals: An R Package for Counterfactual Explanation Methods](https://mlsanity.com/paper/2304.06569/) (2023)
- [Evolutionary approaches to explainable machine learning](https://mlsanity.com/paper/2306.14786/) (2023)
- [Longitudinal Counterfactuals: Constraints and Opportunities](https://mlsanity.com/paper/2403.00105/) (2024)
- [Evolutionary Computation and Explainable AI: A Roadmap to Understandable Intelligent Systems](https://mlsanity.com/paper/2406.07811/) (2024)
- [DiCoFlex: Model-agnostic diverse counterfactuals with flexible control](https://mlsanity.com/paper/2505.23700/) (2025)
- [TrustyAI Explainability Toolkit](https://mlsanity.com/paper/2104.12717/) (2021)
- [Iterative Partial Fulfillment of Counterfactual Explanations: Benefits and Risks](https://mlsanity.com/paper/2303.11111/) (2023)
- [Model-Based Counterfactual Explanations Incorporating Feature Space Attributes for Tabular Data](https://mlsanity.com/paper/2404.13224/) (2024)
- [Case-based Explainability for Random Forest: Prototypes, Critics, Counter-factuals and Semi-factuals](https://mlsanity.com/paper/2408.06679/) (2024)
- [Why Are You Wrong? Counterfactual Explanations for Language Grounding with 3D Objects](https://mlsanity.com/paper/2505.06030/) (2025)
- [Augmenting The Weather: A Hybrid Counterfactual-SMOTE Algorithm for Improving Crop Growth Prediction When Climate Changes](https://mlsanity.com/paper/2511.11945/) (2025)
- [Navigating Time's Possibilities: Plausible Counterfactual Explanations for Multivariate Time-Series Forecast through Genetic Algorithms](https://mlsanity.com/paper/2603.00855/) (2026)
- [Towards Counterfactual Explanation and Assertion Inference for CPS Debugging](https://mlsanity.com/paper/2604.07679/) (2026)
- [Model-Free Counterfactual Subset Selection at Scale](https://mlsanity.com/paper/2502.08326/) (2025)
- [A Novel Multi-Objective Evolutionary Algorithm for Counterfactual Generation](https://mlsanity.com/paper/2502.10418/) (2025)

## Abstract (arXiv)

Machine learning is increasingly applied in high-stakes decision making that directly affect people's lives, and this leads to an increased demand for systems to explain their decisions. Explanations often take the form of counterfactuals, which consists of conveying to the end user what she/he needs to change in order to improve the outcome. Computing counterfactual explanations is challenging, because of the inherent tension between a rich semantics of the domain, and the need for real time response. In this paper we present GeCo, the first system that can compute plausible and feasible counterfactual explanations in real time. At its core, GeCo relies on a genetic algorithm, which is customized to favor searching counterfactual explanations with the smallest number of changes. To achieve real-time performance, we introduce two novel optimizations: Delta-representation of candidate counterfactuals, and partial evaluation of the classifier. We compare empirically GeCo against five other systems described in the literature, and show that it is the only system that can achieve both high quality explanations and real time answers.
