Counterfactual Explanations Can Be Manipulated

Dylan Slack, Sophie Hilgard, Himabindu Lakkaraju, Sameer Singh

Abstract: Counterfactual explanations are emerging as an attractive option for providing recourse to individuals adversely impacted by algorithmic decisions. As they are deployed in critical applications (e.g. law enforcement, financial lending), it becomes important to ensure that we clearly understand the vulnerabilities of these methods and find ways to address them. However, there is little understanding of the vulnerabilities and shortcomings of counterfactual explanations. In this work, we introduce the first framework that describes the vulnerabilities of counterfactual explanations and shows how they can be manipulated. More specifically, we show counterfactual explanations may converge to drastically different counterfactuals under a small perturbation indicating they are not robust. Leveraging this insight, we introduce a novel objective to train seemingly fair models where counterfactual explanations find much lower cost recourse under a slight perturbation. We describe how these models can unfairly provide low-cost recourse for specific subgroups in the data while appearing fair to auditors. We perform experiments on loan and violent crime prediction data sets where certain subgroups achieve up to 20x lower cost recourse under the perturbation. These results raise concerns regarding the dependability of current counterfactual explanation techniques, which we hope will inspire investigations in robust counterfactual explanations.

Introduction

Counterfactual explanations (CFEs) have become a cornerstone of explainable AI (XAI), particularly for providing individuals with actionable recourse after an adverse algorithmic decision. For instance, if a loan is denied, a CFE might suggest: "If your savings were $10,000 higher, your loan would be approved." Beyond individual utility, CFEs are increasingly used by regulators and auditors to check for systemic bias. If the "cost" of recourse—the effort required to change an outcome—is significantly higher for protected groups (e.g., women) than for non-protected groups (e.g., men), the model is flagged as unfair.

The Vulnerability of Recourse

Research presented at NeurIPS 2021 reveals that CFEs are not as robust as previously assumed. The authors demonstrate that an adversarial model owner can "fairwash" a biased model. By carefully shaping the model's decision surface, an adversary can ensure that a model appears perfectly equitable to auditors while secretly harboring deep biases that are only revealed when a specific, tiny perturbation—a "trigger" ($\delta$)—is applied to the input data.

Manipulated Model for Loan Risk: A small perturbation $\delta$ allows a specific group to find much lower-cost recourse, bypassing the high-cost paths seen by auditors.

Technical Approach: Adversarial Training

The core of the attack lies in exploiting the non-convexity of the landscapes over which CFE algorithms optimize. Most CFE methods use gradient-based "hill-climbing" to find the nearest point that flips a model's prediction. The authors introduce a bi-level optimization framework where an adversary jointly learns a model $\theta$ and a perturbation vector $\delta$ such that the model remains accurate but exhibits hidden unfairness.

The goal is to create a "recourse landscape" with multiple local minima. For standard inputs, the CFE algorithm is guided into a high-cost valley, satisfying the auditor's fairness checks. However, for inputs containing the trigger $\delta$, the algorithm is nudged into a different, much lower-cost valley. To optimize through the "black-box" CFE search process, the authors utilize implicit differentiation, allowing them to calculate how changes in model weights affect the final counterfactual point.

Comparison of recourse landscapes: (a) standard training leads to similar counterfactuals for $x$ and $x+\delta$, while (b) adversarial training creates a landscape where $x+\delta$ converges to a much closer counterfactual.

Key Results and Implications

The attack was evaluated on standard fairness benchmarks, including the Communities and Crime and German Credit datasets. The results provide a significant wake-up call for the XAI community:

  • Massive Manipulation: On the Communities and Crime dataset, the adversary could provide a favored group with recourse that was 20.1x cheaper than the protected group, all while the auditor saw a disparity of near zero.
  • High Fidelity and Realism: These adversarial models maintain high accuracy on the primary task, and the resulting counterfactuals appear just as realistic as those from standard models, making the manipulation extremely difficult to detect.
  • Algorithm Agnostic: The attack proved effective across various CFE methods, including Wachter’s algorithm, DiCE, and Prototype-guided explanations.

Conclusion and Future Directions

This work uncovers a critical security and fairness gap in current explanation techniques. If the tools used for accountability can themselves be gamed, they cannot be fully trusted in high-stakes domains. The findings underscore an urgent need for the development of "robust counterfactual explanations" that are resilient to such adversarial manipulations, perhaps through randomized initialization or more constrained search spaces.

Summary updated

Abstract

Counterfactual explanations are emerging as an attractive option for providing recourse to individuals adversely impacted by algorithmic decisions. As they are deployed in critical applications (e.g. law enforcement, financial lending), it becomes important to ensure that we clearly understand the vulnerabilities of these methods and find ways to address them. However, there is little understanding of the vulnerabilities and shortcomings of counterfactual explanations. In this work, we introduce the first framework that describes the vulnerabilities of counterfactual explanations and shows how they can be manipulated. More specifically, we show counterfactual explanations may converge to drastically different counterfactuals under a small perturbation indicating they are not robust. Leveraging this insight, we introduce a novel objective to train seemingly fair models where counterfactual explanations find much lower cost recourse under a slight perturbation. We describe how these models can unfairly provide low-cost recourse for specific subgroups in the data while appearing fair to auditors. We perform experiments on loan and violent crime prediction data sets where certain subgroups achieve up to 20x lower cost recourse under the perturbation. These results raise concerns regarding the dependability of current counterfactual explanation techniques, which we hope will inspire investigations in robust counterfactual explanations.
BibTeX
@inproceedings{slack2021counterfactual,
  author = {Dylan Slack and Sophie Hilgard and Himabindu Lakkaraju and Sameer Singh},
  title = {{Counterfactual Explanations Can Be Manipulated}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=iaO_IH7CnGJ},
}
Figure