Joint Distribution-Informed Shapley Values for Sparse Counterfactual Explanations

Lei You, Yijun Bian, Lele Cao

TL;DR

The paper introduces COLA (COunterfactuals with Limited Actions), a model- and generator-agnostic framework designed to make counterfactual explanations much more practical by minimizing the number of feature changes required to alter a model's prediction. By leveraging Optimal Transport (OT) to align factual and counterfactual datasets, COLA drives a novel joint-probability-informed Shapley value method ($p$-SHAP) that identifies and executes only the most impactful feature edits. Empirically, COLA preserves the desired counterfactual outcomes while reducing the required feature modifications by 55% to 74%.

What Problem Does This Paper Address?

Counterfactual Explanations (CE) answer the question: "What is the smallest change needed in the input features to flip a machine learning model's prediction?" For example, a CE might tell a rejected loan applicant to increase their income by \$10,000 to get approved.

However, many existing CE algorithms suffer from a lack of sparsity—they recommend modifying far too many features at once (e.g., changing income, age, zip code, and employment history simultaneously), which is overwhelming and impractical for a user. While Feature Attribution (FA) methods like Shapley values are great at identifying important features, standard FA methods operate independently of the counterfactual generation process. This decoupling means they fail to account for the specific pathways required to achieve a target outcome, often leading to counterproductive or inefficient recommendations.

Figure 1: [Example: User engagement on an e-commerce platform] A platform aims to increase user registrations. The platform has collected data on user interactions, such as the amount of money spent (Ç), the number of clicks (›), and whether the user has registered (²). In the original data (x), no users are registered. Action plans z′ and z′′ adjust user characteristics to achieve the desired outcome (y∗) of full registration. Both plans achieve a half counterfactual effect, but z′′ requires fewer modifications compared to z′.

Methods

COLA is a post-hoc framework that refines the output of any existing counterfactual generator using a three-step pipeline:

  1. Optimal Transport (OT) Coupling: COLA models the group of factual instances and generated counterfactual instances as distributions. It solves an OT problem (using entropic regularization for speed) to find the optimal mathematical coupling matrix ($p_{OT}$) between the two sets. This effectively solves the "alignment problem" by pairing each factual instance with its most efficient counterfactual counterpart.
  2. Joint-Probability-Informed Shapley Values ($p$-SHAP): The authors generalize standard Shapley value formulations by integrating the OT coupling matrix as a joint probability distribution. This ensures that the feature attribution scores directly reflect the cost and impact of moving along the optimal transport path.
  3. Greedy Sparsification: Using the normalized absolute $p$-SHAP values as a guide, COLA greedily selects a user-defined maximum number of features ($C$) to modify, leaving all other features untouched.
Overview of the COLA framework pipeline, showing the progression from OT coupling to p-SHAP calculation and feature selection.

Datasets

The authors evaluated COLA across 4 diverse tabular datasets commonly used in binary classification and algorithmic fairness benchmarking:

  • HELOC (FICO home equity line of credit risk)
  • German Credit (financial credit risk)
  • Hotel Bookings (demand and cancellation prediction)
  • COMPAS (recidivism risk scoring)

To prove the framework's versatility, they tested it across 12 different machine learning architectures (including LightGBM, XGBoost, SVMs, and Deep Neural Networks) and 5 distinct counterfactual generators (DiCE, AReS, GlobeCE, KNN, and Discount).

Key Insights and Ideas

  • The Alignment Proxy: The core "aha moment" is treating the mapping between factuals and counterfactuals as an optimal transport problem. OT serves as a highly effective convex proxy for the otherwise NP-hard discrete sparsity ($L_0$) optimization problem.
  • Theoretical Proximity Guarantees: The authors mathematically prove that under mild conditions, the refined, sparse counterfactuals generated by COLA are guaranteed to be no farther from the original factual data points than the unrefined originals (Theorem 5.1: Counterfactual Proximity).
  • The Danger of Decoupling: The paper demonstrates that running standard feature attribution (like baseline SHAP) independently of the counterfactual pathway performs poorly. Using counterfactual information without proper distribution alignment is insufficient for achieving sparse, actionable recourse.

Key Results

  • Massive Action Reduction: To achieve 100% of the original counterfactual effect, COLA required only 26% to 45% of the original feature edits. If a user is satisfied with an 80% counterfactual effect, COLA achieves it using a mere 13% to 25% of the original edits.
  • Superiority Over Baselines: As shown across multiple divergence metrics (Wasserstein distance, MMD, Mean Difference), the proposed $p$-SHAP method consistently out-sparsified alternative baseline methods like Random Baseline SHAP (RB-SHAP) and Counterfactual SHAP (CF-SHAP).
  • Near-Optimality: On a tractable benchmark (German Credit), the authors compared COLA against the mathematically true global optimum solved via Mixed-Integer Linear Programming (MILP). COLA achieved near-optimal performance at a fraction of the computational overhead required by heavy MILP solvers.
German Credit dataset evaluation showing COLA (CF-pOT) closely tracking the mathematically optimal MILP baseline.

Limitations and Future Work

  • The Alignment Gap: While OT provides an excellent proxy, a slight performance gap remains between the OT-derived alignment and the true mathematical optimum in certain instance-based settings. Finding the absolute best alignment strategy remains an open question.
  • Computational Complexity of Shapley Values: Calculating exact Shapley values scales exponentially with the number of features. Although COLA utilizes weighted linear regression approximations to keep it practical, very high-dimensional feature spaces could still pose a scaling challenge.
  • Lack of Causal Constraints: The current framework relies on statistical distributions rather than strict causal graphs. Incorporating Structural Causal Models (SCMs) to prevent recommending physically impossible feature changes (e.g., lowering age to get a loan) is a noted direction for future integration.

Summary updated

Abstract

Counterfactual explanations (CE) aim to reveal how small input changes flip a model's prediction, yet many methods modify more features than necessary, reducing clarity and actionability. We introduce \emph{COLA}, a model- and generator-agnostic post-hoc framework that refines any given CE by computing a coupling via optimal transport (OT) between factual and counterfactual sets and using it to drive a Shapley-based attribution (\emph{$p$-SHAP}) that selects a minimal set of edits while preserving the target effect. Theoretically, OT minimizes an upper bound on the $W_1$ divergence between factual and counterfactual outcomes and that, under mild conditions, refined counterfactuals are guaranteed not to move farther from the factuals than the originals. Empirically, across four datasets, twelve models, and five CE generators, COLA achieves the same target effects with only 26--45\% of the original feature edits. On a small-scale benchmark, COLA shows near-optimality.
BibTeX
@inproceedings{you2026joint,
  author = {Lei You and Yijun Bian and Lele Cao},
  title = {{Joint Distribution-Informed Shapley Values for Sparse Counterfactual Explanations}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=3vIe5pNiUN},
}
Figure