Skip to main content
QUICK REVIEW

[Paper Review] GeCo: Quality Counterfactual Explanations in Real Time

Maximilian Schleich, Zixuan Geng|arXiv (Cornell University)|Jan 5, 2021
Explainable Artificial Intelligence (XAI)Computer Science33 references13 citations
TL;DR

GeCo is a real-time system for generating high-quality, feasible, and plausible counterfactual explanations using a customized genetic algorithm with two key optimizations: Δ-representation for compact candidate encoding and partial evaluation of classifiers. It outperforms five existing systems by achieving both low-latency response times and high-quality explanations in interactive settings.

ABSTRACT

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: $Δ$-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.

Motivation & Objective

  • To address the critical challenge of generating high-quality, feasible, and plausible counterfactual explanations in real time for high-stakes machine learning decisions.
  • To overcome the tension between rich semantic constraints (plausibility, feasibility) and the need for interactive performance in production systems.
  • To design a system that supports complex, real-world constraints while maintaining low-latency response for user-facing applications.
  • To enable actionable, user-friendly explanations that reflect domain-specific rules, societal norms, and legal requirements such as GDPR.
  • To provide a scalable, general-purpose solution that works across diverse structured data and model types.

Proposed method

  • GeCo employs a customized genetic algorithm that prioritizes counterfactuals requiring the fewest feature changes, enhancing actionability and plausibility.
  • It introduces Δ-representation, a compact data structure that encodes candidate counterfactuals as differences from the original instance, reducing memory and computation overhead.
  • Partial evaluation of the classifier is applied to avoid redundant re-evaluation of shared model components across candidate instances, accelerating fitness evaluation.
  • The system integrates a general-purpose constraint language (PLAF) to encode domain-specific rules, such as monotonicity (e.g., age only increases) and logical dependencies between features.
  • Feature grouping and constraint implication resolution are used to further reduce the search space and improve convergence speed.
  • The algorithm dynamically checks constraints using action cascading to maintain correctness while minimizing performance impact.

Experimental results

Research questions

  • RQ1Can a system generate high-quality, feasible, and plausible counterfactual explanations in real time, even under complex domain constraints?
  • RQ2How can the search space for counterfactuals be efficiently pruned without sacrificing solution quality?
  • RQ3What optimizations are most effective in accelerating the genetic algorithm for counterfactual search while preserving semantic fidelity?
  • RQ4To what extent can constraint-based filtering improve performance without introducing significant runtime overhead?
  • RQ5Can a system balance rich semantics and interactive performance, outperforming existing approaches that prioritize only one of the two?

Key findings

  • GeCo is the only system among five evaluated that achieves both real-time performance and high-quality counterfactual explanations, outperforming MACE, What-If Tool, DiCE, and CERTIFAI in both speed and solution quality.
  • The system consistently finds valid counterfactual explanations even when all 12 features must be changed, with runtime scaling linearly with the number of changes.
  • Δ-representation reduces the size of the candidate population by up to 60× compared to naive listing, significantly improving memory efficiency and search speed.
  • Partial evaluation and constraint filtering improve performance by up to 32.3% on the Credit dataset, with overall speedups of 18.7% on Adult and 9.8% on Credit when all constraints are applied.
  • The inclusion of constraints with implications adds overhead but still results in faster convergence than no constraints, demonstrating effective trade-offs.
  • By sampling more values during mutation, GeCo reduces the distance gap to the optimal explanation with only minor performance degradation, showing strong scalability and adaptability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.