Skip to main content
QUICK REVIEW

[Paper Review] ECINN: Efficient Counterfactuals from Invertible Neural Networks

Frederik Hvilshøj, Alexandros Iosifidis|arXiv (Cornell University)|Mar 25, 2021
Explainable Artificial Intelligence (XAI)Computer Science40 references10 citations
TL;DR

ECINN is a novel method that generates counterfactual images with a single forward and inverse pass through an invertible neural network (INN), enabling efficient, realistic, and minimal perturbations by correcting latent representations in closed form. It outperforms existing methods in generating coherent, high-quality heatmaps for model explanation, particularly on INNs where gradient-based methods produce noisy results.

ABSTRACT

Counterfactual examples identify how inputs can be altered to change the predicted class of a classifier, thus opening up the black-box nature of, e.g., deep neural networks. We propose a method, ECINN, that utilizes the generative capacities of invertible neural networks for image classification to generate counterfactual examples efficiently. In contrast to competing methods that sometimes need a thousand evaluations or more of the classifier, ECINN has a closed-form expression and generates a counterfactual in the time of only two evaluations. Arguably, the main challenge of generating counterfactual examples is to alter only input features that affect the predicted outcome, i.e., class-dependent features. Our experiments demonstrate how ECINN alters class-dependent image regions to change the perceptual and predicted class of the counterfactuals. Additionally, we extend ECINN to also produce heatmaps (ECINNh) for easy inspection of, e.g., pairwise class-dependent changes in the generated counterfactual examples. Experimentally, we find that ECINNh outperforms established methods that generate heatmap-based explanations.

Motivation & Objective

  • To address the inefficiency of existing counterfactual generation methods that require hundreds or thousands of model queries.
  • To enable the generation of realistic, minimal, and actionable counterfactual examples in image classification that alter only class-dependent features.
  • To develop a method that produces high-quality, interpretable heatmaps for invertible neural networks (INNs), overcoming the noise issues of gradient-based explanation methods.
  • To demonstrate that INNs’ semantically organized latent spaces enable closed-form counterfactual corrections, enabling one-pass inference.

Proposed method

  • ECINN uses a pre-trained invertible neural network (INN) to map input images into a latent space where class-dependent features are semantically organized.
  • It formulates counterfactual corrections as a closed-form optimization in the latent space, ensuring minimal and meaningful changes to only class-relevant features.
  • After correcting the latent representation to shift the model’s prediction to the target class, ECINN applies the inverse INN to reconstruct the counterfactual image from the corrected latent vector.
  • The method extends to ECINNh, which computes heatmaps by analyzing the difference between original and counterfactual images, providing visual insights into class-dependent feature changes.
  • ECINN requires only two evaluations of the classifier: one forward pass and one inverse pass, making it significantly more efficient than iterative methods.
  • The approach leverages the invertibility and disentangled representations of INNs to ensure faithful, realistic, and diverse counterfactual examples.

Experimental results

Research questions

  • RQ1Can counterfactual examples be generated efficiently with only two model evaluations, rather than thousands?
  • RQ2Can invertible neural networks enable closed-form correction of latent representations to generate realistic and minimal counterfactuals?
  • RQ3Do heatmaps derived from ECINN produce more coherent and faithful explanations than gradient-based methods on INNs?
  • RQ4Why do gradient-based explanation methods produce noisy heatmaps on INNs, and can ECINNh mitigate this?
  • RQ5Can ECINN effectively alter only class-dependent features (e.g., facial expressions, makeup) while preserving class-independent features (e.g., background, hair color)?

Key findings

  • ECINN generates counterfactual examples in just two model evaluations—significantly faster than iterative methods requiring hundreds or thousands of queries.
  • The method successfully alters only class-dependent features such as facial expressions, makeup, and facial structure, while preserving background, hair color, and overall image layout.
  • ECINNh produces more coherent and meaningful heatmaps than Integrated Gradients, DeepLift, DeepLiftSHAP, and GradSHAP, especially on INNs, where gradient methods yield noisy results.
  • The study hypothesizes that the absence of ReLU activations in INN layers contributes to noisy gradient explanations, which ECINNh avoids by using structural differences between inputs and counterfactuals.
  • ECINNh reveals model behavior such as holistic makeup detection (not just lips), confirming that models trained on makeup labels use facial context rather than isolated features.
  • Heatmaps from ECINNh show strong alignment with human perception, e.g., emphasizing lips and eyes for smiling, and are nearly identical for correlated labels like lipstick and heavy makeup, indicating faithful model behavior interpretation.

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.