Skip to main content
QUICK REVIEW

[Paper Review] Counterfactual Explanations via Latent Space Projection and Interpolation

Brian Barr, Matthew R. Harrington|arXiv (Cornell University)|Dec 1, 2021
Explainable Artificial Intelligence (XAI)Computer Science4 citations
TL;DR

SharpShooter is a model-agnostic method for generating counterfactual explanations via latent space projection and interpolation, using two variational autoencoders to project inputs toward the target class and generate realistic, sparse counterfactuals through linear interpolation in latent space. It achieves up to 1,000x faster inference than gradient-based baselines while maintaining high realism and feasibility on tabular and image datasets.

ABSTRACT

Counterfactual explanations represent the minimal change to a data sample that alters its predicted classification, typically from an unfavorable initial class to a desired target class. Counterfactuals help answer questions such as "what needs to change for this application to get accepted for a loan?". A number of recently proposed approaches to counterfactual generation give varying definitions of "plausible" counterfactuals and methods to generate them. However, many of these methods are computationally intensive and provide unconvincing explanations. Here we introduce SharpShooter, a method for binary classification that starts by creating a projected version of the input that classifies as the target class. Counterfactual candidates are then generated in latent space on the interpolation line between the input and its projection. We then demonstrate that our framework translates core characteristics of a sample to its counterfactual through the use of learned representations. Furthermore, we show that SharpShooter is competitive across common quality metrics on tabular and image datasets while being orders of magnitude faster than two comparable methods and excels at measures of realism, making it well-suited for high velocity machine learning applications which require timely explanations.

Motivation & Objective

  • To address the lack of efficient, realistic, and feasible counterfactual explanations for intermediaries in machine learning deployment pipelines.
  • To overcome computational inefficiency and infeasibility of existing counterfactual generation methods, especially in high-dimensional or categorical data.
  • To improve counterfactual realism and sparsity by leveraging learned latent representations from variational autoencoders.
  • To provide a scalable, model-agnostic framework suitable for high-velocity machine learning applications requiring timely explanations.
  • To introduce a novel visualization of decision boundaries and counterfactual trajectories for interpretability.

Proposed method

  • SharpShooter uses a target variational autoencoder (VAE) to project the input sample into the latent space such that its reconstructed output classifies as the desired target class.
  • It generates counterfactual candidates by interpolating linearly between the original input’s latent code and the projected target latent code.
  • The method leverages two VAEs: one for the original data distribution and one fine-tuned to represent the target class distribution in latent space.
  • Counterfactuals are decoded from the interpolated latent vectors and evaluated for validity, proximity, sparsity, and reconstruction quality.
  • The framework is model-agnostic and operates entirely in latent space, enabling efficient search and improved generalization.
  • A novel visualization technique maps decision boundaries and counterfactual trajectories across the joint latent representation space.

Experimental results

Research questions

  • RQ1Can latent space interpolation produce counterfactuals that are both realistic and computationally efficient compared to gradient-based methods?
  • RQ2How do counterfactuals generated via latent space projection compare in sparsity and proximity to the original input across tabular and image datasets?
  • RQ3To what extent does the method preserve categorical variable feasibility, especially in high-dimensional categorical data?
  • RQ4Can the method generate counterfactuals that are both in-sample and semantically plausible, avoiding adversarial-like perturbations?
  • RQ5How does the structure of the latent space influence the quality and interpretability of the resulting counterfactual explanations?

Key findings

  • SharpShooter achieved up to 1,000x faster inference than GDL and GDI on all datasets, with inference times of 1.6×10⁻³ seconds on Lending Club and 1×10⁻³ seconds on UCI credit.
  • On the UCI credit dataset, SharpShooter achieved a validity score of 0.505, a proximity of 3.99, and a sparsity of 0.309, outperforming GDL and GDI in realism and feasibility.
  • On the Lending Club dataset, SharpShooter achieved a validity of 0.98 and a sparsity of 0.49, with significantly lower reconstruction loss (0.019) than GDI (0.037) and GDL (0.015).
  • Figure 4 and Figure 5 show that SharpShooter produces more realistic changes in continuous and categorical variables—such as reducing bill amounts and increasing on-time payments—compared to gradient-based methods that make extreme or implausible changes.
  • In low-dimensional latent space (2D), SharpShooter maintained high validity (0.98) and generated counterfactuals with minimal changes to loan size, unlike GDL which altered debt-to-income ratio and income drastically.
  • The method demonstrated superior realism, as measured by novel metrics, and produced counterfactuals that were more semantically plausible and actionable, particularly in categorical feature space.

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.