Counterfactual Concept Bottleneck Models

## Abstract

Abstract Current deep learning models are not designed to simultaneously address three fundamental questions: predict class labels to solve a given classification task (the "What?"), simulate changes in the situation to evaluate how this impacts class predictions (the "How?"), and imagine how the scenario should change to result in different class predictions (the "Why not?"). The inability to answer these questions represents a crucial gap in deploying reliable AI agents, calibrating human trust, and improving human-machine interaction. To bridge this gap, we introduce CounterFactual Concept Bottleneck Models (CF-CBMs), a class of models designed to efficiently address the above queries all at once without the need to run post-hoc searches. Our experimental results demonstrate that CF-CBMs: achieve classification accuracy comparable to black-box models and existing CBMs (“What?”), rely on fewer important concepts leading to simpler explanations (“How?”), and produce interpretable, concept-based counterfactuals (“Why not?”). Additionally, we show that training the counterfactual generator jointly with the CBM leads to two key improvements: (i) it alters the model’s decision-making process, making the model rely on fewer important concepts (leading to simpler explanations), and (ii) it significantly increases the causal effect of concept interventions on class predictions, making the model more responsive to these changes.

## 1 Introduction

Figure: Figure 1: CF-CBMs generate counterfactuals at the concept level rather than at the input level, as the changes are more interpretable. On the contrary, identifying the changes in the input level require significant more effort from the user.
Refer to caption: x1.png

To calibrate human trust and enhance human-machine interactions, deep learning (DL) models should learn how to master three fundamental questions: predict class labels for new inputs (the “What is the arthritis grade of the X-RAY in Figure 1?”), simulate changes in the situation to evaluate how this impacts class predictions (the “How would the absence of bone spurs impact the arthritis grade?”), and imagine alternative scenarios that would result in different class predictions (the “Why is the arthritis grade not *grade 1*?”)—also known as counterfactual explanations (Wachter et al., ).
Notably, no existing deep learning model is currently designed to answer all these questions by design.

Concept Bottleneck Models (CBMs)(Koh et al., ) are deep learning architectures designed to answer both “what?” and “how?” questions. They achieve this by first predicting human-understandable concepts(Kim et al., ), which human experts can examine evaluating how intervening on such concepts influences the model’s class predictions. However, CBMs fall short in answering “why not?” queries as they are not trained to produce concept-based counterfactuals. Conversely, state-of-the-art counterfactual generation methods (Wachter et al., ; Pawelczyk et al., ; Guyomard et al., ; Nemirovsky et al., ) are trained to answer “what?” and “why not?” questions, yet they are not designed to answer “how?” queries, especially when working with unstructured data such as images. Moreover, in these cases, counterfactual methods may generate an image that either i) looks nearly identical to the original, or ii) incorporates pixel-level modifications of difficult interpretation from the human perspective spreading across thousands of pixels throughout the entire image (as shown in Figure 1). This scattering of modifications makes it hard to understand the answers to the “why not” questions. In addition, it is difficult to answer “how” questions because semantically coherent pixel-level interventions are hard to define and perform for domain experts (e.g., radiologists) (Abid et al., ). In summary, input-level counterfactuals often lack actionable insights, limiting their usefulness in real-world settings, while concept-based models lack the ability to answer counterfactual queries.

Contributions. To bridge these gaps, we introduce CounterFactual Concept Bottleneck Models (CF-CBM), a class of deep learning models designed to jointly master three fundamental questions for a classification problem - "What?", "How?" and "Why not?", generating interpretable concept-based counterfactuals. Our key innovation lies in a latent process generating two similar concept vectors. The model uses the first concept vector to predict the target class label (as in standard CBMs), while the second is used to predict an alternative class label.
Our experimental results demonstrate that CF-CBMs: achieve classification accuracy comparable to black-box models and existing CBMs (“What?”), rely on fewer important concepts leading to simpler explanations (“How?”), and produce interpretable, concept-based counterfactuals (“Why not?”). Additionally, we show that training the counterfactual generator jointly with the CBM leads to two key improvements: (i) it fundamentally alters the model’s decision-making process, making the model rely on fewer important concepts, thus leading to simpler explanations, and (ii) it significantly increases the causal effect of concept interventions on class predictions, making the model more responsive to these changes.
We also provide the code we developed(^1^11[https://github.com/gabriele-dominici/Counterfactual-CBM](https://github.com/gabriele-dominici/Counterfactual-CBM)).

Figure: Figure 2: Counterfactual CBMs inference. For a given input sample, the task predictor answers “what?” queries predicting class labels. The concept predictor answers “how?” queries simulating changes in the scenarios through interventions. When taking the counterfactual latent distribution $z^{\prime}$, the concept predictor answers “why not?” queries via concept-based counterfactuals, which are easier to understand then counterfactuals at the input level.
Refer to caption: x2.png

## 2 Background

Concept Bottleneck Models (CBMs).
Concept Bottleneck Models (Koh et al., ) are interpretable architectures that explain their predictions using high-level units of information (i.e., “concepts”). Given a sample’s raw features $x\in X\subseteq\mathbb{R}^{d}$ (e.g., an image’s pixels), a set of $r$ concepts $c_{i}\in C\subseteq\{0,1\}^{r}$ (e.g., “bone spurs”, “narrow joint space”), and a set of $l$ class labels $y_{j}\in Y\subseteq\{0,1\}^{l}$ (e.g., labels “arthritis grade 2” or “arthritis grade 1”). A CBM estimates the conditional distribution $\prod_{j}p(y_{j}\mid c_{1},\dots,c_{r})\prod_{i}p(c_{i}\mid x)$ where $p(c_{i}\mid x)$ is a set of independent Bernoulli distributions.
At test time,
human experts may *intervene* on mispredicted concept labels to improve CBMs’ task performance, simulating different scenarios.
In a probabilistic perspective (Bahadori & Heckerman, ; Misino et al., ), (ideal) concepts $c$ represent key factors of variation (Kingma & Welling, ; Zarlenga et al., ) of observed data $x$ and $y$, as illustrated in the graphical model
$x$$c$$y$
.

Counterfactual Explanations.
A counterfactual is a hypothetical statement in contrast with actual events that helps us understand the potential consequences of different choices or circumstances  (Pearl et al., ). In the context of machine learning, Wachter et al. () define counterfactual explanations as an optimization problem representing an answer to a “why not” question. The optimization aims to find for each observation $x$ the closest datapoint $x^{\prime}$ such that a classifier $m:X\rightarrow Y$ produces a class label $m(x^{\prime})$ that is different from the original label $m(x)$.

## 3 Counterfactual Concept Bottleneck Models

CounterFactual Concept Bottleneck Models (CF-CBMs, Figure 2) is a novel class of interpretable models designed to generate counterfactuals via variational inference at the concept level.
In the following, we motivate CF-CBMs’ architecture and optimization objective (Section 3.1). Sections 3.3 and 3.2 show how CF-CBMs answer the different questions and how users can act upon generated counterfactuals.

### 3.1 Generating Concept-Based Counterfactuals

To realize concept-based counterfactuals, we extend the graphical model
$x$$c$$y$
introducing two additional variables: $c^{\prime}$, representing concept-based counterfactual labels; and $y^{\prime}$, representing the counterfactual class label. We represent the counterfactual dependency on the actual concepts $c$ with an arrow from $c$ to $c^{\prime}$, while $y^{\prime}$ depends on $c^{\prime}$:

$$ $x$ $c$ $y$ $c^{\prime}$ $y^{\prime}$ (1) $$

We also notice that multiple counterfactuals can be used to explain any given fact (Wachter et al., ; Pearl, ). To address this, an ideal solution would be to use a generative approach modeling the discrete distributions over $c$ and $c^{\prime}$. However, modeling such distributions directly might be unfeasible in practice (Richardson & Domingos, ) as it requires either modelling complex concept dependencies with discrete distributions which scale exponentially with the number of concepts, or assuming that concepts are independent of each other, an often unrealistic assumption. For this reason, we use a latent variable approach (Kingma & Welling, ) to model concept dependencies in a continuous latent distribution, which allows us to model discrete concept values as independent of each other given the latent variable.

Architecture.
CF-CBMs are latent variable models generating
counterfactuals via variational inference. To this end, they add two random variables $z$ and $z^{\prime}$ to Diagram 1. These variables represent latent factors of variation whose probability distributions are easier to model and sample compared to those for $c$ and $c^{\prime}$. We also include arrows from $c$ and $y$ to the counterfactual latent distribution $z^{\prime}$ in order to explicitly model the dependency of $z^{\prime}$ on the symbolic values of actual concept $c$ and class labels $y$, resulting in the following overall probabilistic graphical model:

$$ $x$ $c$ $y$ $c^{\prime}$ $y^{\prime}$ $z$ $z^{\prime}$ (2) $$

This way, the generative distribution factorizes as:

$$ $\displaystyle p(c,y,z,c^{\prime},y^{\prime},z^{\prime},x)=p(c,y|z)p(c^{\prime} ,y^{\prime}|z^{\prime})p(x|z)p(\mathbf{z}|c,y)$ (3) $\displaystyle p(c,y|z)=p(y|c)p(c|z),\quad p(c^{\prime},y^{\prime}|z^{\prime})= p(y^{\prime}|c^{\prime})p(c^{\prime}|z^{\prime}),\quad p(\mathbf{z}|c,y)=p(z)p (z^{\prime}|z,c,y)$ (4) $$

In our approach, $p(y|c)$ and $p(y^{\prime}|c^{\prime})$ are modeled as categorical distributions parametrized by the same task predictor $f$; $p(c|z)$ and $p(c^{\prime}|z^{\prime})$ as sets of Bernoulli distributions parametrized by the same concept predictor $\phi_{z}$. In practice, we assume that the input $x$ is always observed at test time, making the term and $p(x|z)$ irrelevant. Finally, $p(z)$ is a normal prior distribution and $p(z^{\prime}|z,c,y)$ is a learnable normal prior whose mean and variance are parametrized by neural networks $\phi_{p\mu}$ and $\phi_{p\sigma}$.

Amortized inference. CF-CBMs amortize inference needed for training by introducing two approximate Gaussian posteriors $q(z|x)$ and $q(z^{\prime}|z,c,y,y^{\prime})$ whose mean and variance are parametrized by a pair of neural networks $(\phi_{\mu},\phi_{\sigma})$ ($(\phi_{\mu^{\prime}},\phi_{\sigma^{\prime}})$, respectively). The corresponding inference graphical model (i.e. the encoder) is shown in Appendix A.

Optimization problem.
CF-CBMs are trained to optimize the log-likelihood of tuples $(c,y,y\textquoteright)$, where $y\textquoteright$ is randomly sampled from a uniform distribution for each observation of $x$, simulating a scenario in which a user requests the generation of a counterfactual for a specific label. Following a variational inference approach, we optimize the evidence lower bound of the log-likelihood, which results (see Appendix A) in the following objective function to maximize:

$$ $\displaystyle\mathcal{L}=$ $\displaystyle\overbrace{\lambda_{1}\mathbb{E}_{z\sim q(z|x)}[\log p(c|z)]+\log p (y|c)}^{\text{ reconstruction of $c$ and $y$}}-\overbrace{\lambda_{2}D_{KL}[q( z|x)||p(z)]}^{\text{ prior regularization on $z$}}$ $\displaystyle+$ $\displaystyle\overbrace{\lambda_{3}\mathbb{E}_{z,z^{\prime},c^{\prime}\sim p(c ^{\prime}|z^{\prime})q(z^{\prime}|\alpha)q(z|x))}[\log p(y^{\prime}|c^{\prime} )]}^{\text{ reconstruction of $y^{\prime}$}}-\overbrace{\lambda_{4}D_{KL}[q(z^ {\prime}|\alpha)||p(z^{\prime}|z,c,y)]}^{\text{prior regularization on $z^{ \prime}$ }}$ $$

where $D_{KL}$ is the Kullback–Leibler divergence, $\alpha=(z,c,y,y^{\prime})$ and $\lambda_{i}$ are hyperparameters.
Moreover, in order to enforce concept-based counterfactuals to be as close as possible to the current concept labels, we add an additional term to the objective:

$$ $\displaystyle\mathcal{L}_{dz}=-\overbrace{\lambda_{5}D_{KL}\left[q(z|x)||q(z^{ \prime}|\alpha)\right]}^{\text{posterior distance}}-\overbrace{\lambda_{6}D_{ KL}\left[p(z)||p(z^{\prime}|z,c,y)\right]}^{\text{prior distance}}$ (5) $$

### 3.2 Answering “what?”, “how?” and “why not?” queries

CF-CBMs design allows them to answer “what?”, “how?” and “why not?” queries through the following steps (Figure 2):

1. What? Predict concept and class labels:

- (a)
Sample from latent concept posterior: $z\sim\mathcal{N}(\phi_{\mu}(x),\phi_{\sigma}(x))$
- (b)
Sample to predict concept and class labels:
$\hat{y}\sim\text{Categorical}(f(\hat{c})),\ \hat{c}\sim\text{Bernoulli}(\phi_{
z}(z))$

2. How? Simulate changes in the situation and evaluate the impact on the outcome. Similar to standard CBMs, it is possible to intervene at the concept level—since these concepts are inherently interpretable—and analyze how these modifications impact the model’s prediction:

- (a)
Simulate changes intervening on concept values:
$\hat{c}_{i}\mathrel{:}=\tilde{c}_{i}\quad\forall i\in\mathcal{I}$
where $\tilde{c}_{i}$ is the intervened value for each concept $i$ in the set $\mathcal{I}$ of the intervened concepts.
- (b)
Sample to predict class labels based on the intervened concepts:
$\tilde{y}\sim\text{Categorical}(f(\hat{c}))$

3. Why not? Imagine interpretable counterfactuals via the conditional generation of new concept tuples:

- (a)
Sample from latent counterfactual posterior:
$\displaystyle z^{\prime}\sim\mathcal{N}(\phi_{\mu^{\prime}}(\alpha),\phi_{
\sigma^{\prime}}(\alpha)),\quad\alpha=(z,\hat{c},\hat{y},y^{\prime}),\quad y^{
\prime}\sim\text{Categorical}(v),\ v\sim\mathcal{U}\{0,|y|\}$
- (b)
Sample to predict counterfactual labels:
$\hat{y}^{\prime}\sim\text{Categorical}(f(\hat{c}^{\prime})),\ \hat{c}^{\prime}
\sim\text{Bernoulli}(\phi_{z}(z^{\prime}))$

The following example illustrates a concrete scenario.

Example. Consider a knee X-ray scan with the task of classifying the severity of arthritis as either Grade 1 or Grade 2. Additionally, we have access to two key concepts: “narrow joint space” and “bone spurs,” which are critical in determining the level of arthritis. A CF-CBM addresses the three interpretability questions as follows:
Predict: the model predicts concept labels $\hat{c}={\hat{c}_{NarrowJointSpace}=1,\hat{c}_{BoneSpurs}=1}$ and class labels ${\hat{y}_{Grade1}=0,\hat{y}_{Grade2}=1}$, indicating the presence of both concepts and a Grade 2 classification. Simulate: it is possible to intervene on the concept "bone spurs" $\hat{c}_{BoneSpurs}=0$, simulating a different scenario, and observe that the model still predicts the same class, Grade 2, showing the model’s robustness to changes in one concept. Imagine: generate the counterfactual where the desired class changes to ${\hat{y}_{Grade1}\textquoteright=1,\hat{y}_{Grade2}\textquoteright=0}$. The corresponding concept-level counterfactual would be ${\hat{c}_{NarrowJointSpace}\textquoteright=0,\hat{c}_{BoneSpurs}
\textquoteright=1}$, demonstrating how modifying these concepts could lead to a different classification.

### 3.3 Test-time Functionalities

In contrast to standard CBMs, CF-CBMs can either sample or estimate the most probable counterfactual to: (i) explain the effect of concept interventions on tasks, (ii) show users how to get a desired class label, and (iii) propose concept interventions via “task-driven” interventions.

Counterfactuals explain the effect of concept interventions on downstream tasks.
Plain concept-based explanations indicate the presence or absence of a concept for a given class prediction. However, the complexity of plain explanations grows quickly with the number of concepts. Concept-based counterfactuals, instead, induce simpler, sparser explanations (via Eq. 5)
representing minimal modifications of concept labels that would have led to a different class prediction.

Act upon concept-based counterfactuals.
Concept-based counterfactuals can guide users towards achieving desired outcomes (indicated by class labels), especially when users do not know how to alter their status (represented by concepts). In this scenario:
(i) a user specifies a desired class label $y^{\prime}$ for the downstream task representing their goal (e.g., get a loan), (ii) CF-CBMs generate a concept-based counterfactual $p(c^{\prime}|y^{\prime},\hat{y},\hat{c})$ representing minimal concept modifications changing the class label from the predicted $\hat{y}$ to the desired $y^{\prime}$ (e.g., save $10\%$ more each month), (iii) the user can act upon the counterfactual $c^{\prime}$ to accomplish the goal represented by $y^{\prime}$.

Task-driven interventions fix mispredicted concepts. A key feature of CBMs is enabling human-in-the-loop interventions: at test time, users can correct mispredicted concept labels to enhance downstream task performance ($c\rightarrow y$ intervention). Concept interventions can be useful when intervening on concepts is easier than intervening on the downstream task. For instance, it might be easier to identify bone spurs ($c$) in a knee X-ray scan than to provide an accurate arthritis level ($y$).
While still supporting concept interventions, CF-CBMs may also invert this mechanism via *task-driven interventions* ($y\rightarrow c$), exploiting its counterfactual generation abilities. Task-driven interventions can be used to correct mispredicted class labels when intervening on the downstream task is easier than intervening on concepts. For instance, it might be easier to identify a mispredicted Parkinson’s disease ($y$) rather than intervening in the genetic pathways ($c$) leading to the disease.
In this scenario, users can intervene on the class label (rather than on the concepts) suggesting a correct $y^{\prime}$. Considering this additional information, CF-CBMs propose a more accurate set of concept labels $\hat{c}^{\prime}$ representing potential concept intervention previously unknown to the user.

## 4 Experiments

Our experiments aim to answer the following questions:

- •
What? prediction generalization: Do CF-CBMs attain similar task/concept accuracy as standard CBMs?
- •
How? intervention impact: Does optimizing counterfactual generation end-to-end with the predictor alter the importance assigned by the model to each concept?
- •
Why not? counterfactual actionability: Can CF-CBMs produce valid, plausible, efficient counterfactuals? Can CF-CBMs generate accurate task-driven interventions?

This section describes essential information about experiments.
We provide further details in Appendix C.

#### Data & task setup

In our experiments we use three different datasets commonly used to evaluate CBMs: dSprites (Matthey et al., ), where the task is to predict specific combinations of objects having different shapes, positions, sizes and colours; MNIST addition (Manhaeve et al., ), where the task is to predict the sum of two digits; and CUB (Welinder et al., ), where the task is to predict bird species based on bird characteristics.
In all experiments, images are encoded using a pre-trained ResNet18 (He et al., ).

#### Evaluation

In our analysis we use the following metrics. What? (prediction generalization): we compute the Area Under the Receiver Operating Characteristic Curve (Hand & Till, ) for concepts and tasks (ROC AUC ($\uparrow$)(^2^22($\uparrow$): the higher the better. ($\downarrow$): the lower the better.)).
How? (intervention impact): we assess the influence of concepts on the downstream task using the Causal Concept Effect (CaCE) (Goyal et al., ), which quantifies the degree to which each concept is critical for a class. This allows us to evaluate the impact of optimizing counterfactuals end-to-end versus using post-hoc methods. Additionally, in scenarios where confounders are present, CaCE can help determine whether the impact of these confounders is high or low.
Why not? (counterfactual actionability): drawing from previous works on counterfactuals, we compute: (i) the validity(^3^33A.k.a. “correctness” (Abid et al., ).)($\uparrow$) (Wachter et al., ) by checking whether the model predicts the desired class labels based on the generated counterfactual; (ii) the proximity ($\downarrow$) (Pawelczyk et al., ) which evaluates counterfactuals’ “reliability” as their similarity w.r.t. training samples; (iii) the time ($\downarrow$)  (Romashov et al., ) to generate counterfactuals.
In addition, we propose the following metrics to assess the quality of counterfactuals: (i) the $\Delta$-Sparsity ($\downarrow$) which evaluates user’s “wasted efforts” by counting the number concepts changed (Guo et al., ) w.r.t. the minimal number of changes that would have generated a counterfactual according to the dataset; (ii) the “plausibility” (Wachter et al., ) as the Intersection over Union (IoU ($\uparrow$)) (Jaccard, ) between counterfactuals and ground-truth concept vectors; (iii) the variability ($\uparrow$) which evaluates counterfactuals’ “diversity”, as the cardinality ratio between the set of counterfactuals generated and the set of training concept vectors; (iv)
finally, we measure the concept accuracy of generated interventions (Acc Int. ($\uparrow$)) w.r.t. ground-truth optimal interventions that evaluate the model’s ability to generate potential concept interventions. Following Espinosa Zarlenga et al. (), we inject noise on predicted concepts to reduce task accuracy, then we sample counterfactuals, conditioning on the ground-truth label, and use them to fix mispredicted concept labels automatically.
All metrics are reported using the mean and the standard error over five different runs with different initializations.

#### Baselines

In our experiments, we compare CF-CBM with a Black Box model, a standard CBM and a more powerful CBM as Concept Embedding Model (CEM) (Espinosa Zarlenga et al., ) in terms of generalization performance. To ensure a fair comparison, we create counterfactual baselines by adapting post-hoc methods to standard CBMs, allowing for a direct comparison between our approach and other state-of-the-art models. We propose this experimental design for two main reasons. First, standard CBMs cannot generate counterfactuals by design, hence they need an external generator. Second, the standard, direct application of post-hoc methods on unstructured data types (e.g., image pixels rather than concepts) would have significantly compromised counterfactuals’ interpretability and difficult comparison between the generated results. We remark that this already represents an undocumented procedure in the current literature, as post-hoc methods typically derive counterfactuals from input features, not in the concept space. However, this also enables us to compare post-hoc counterfactual methods with our model, which incorporates counterfactual constraints during training.
Among post-hoc approaches we select: (i) the Bayesian Counterfactual (BayCon) (Romashov et al., ), which generates counterfactuals via probabilistic feature sampling and Bayesian optimization; (ii) the Counterfactual Conditional Heterogeneous Variational
AutoEncoder (C-CHVAE) (Pawelczyk et al., ), which iteratively perturbs the latent space of a VAE until it finds counterfactuals; (iii) the VAE CounterFactual (VAE-CF) (Mahajan et al., ), which improves C-CHVAE by conditioning counterfactuals on model’s predictions; (iv) the Variational Counter Net (VCNet) (Guyomard et al., ), which conditions latent counterfactual sampling on a specific target label $y^{\prime}$.

## 5 Key Findings & Results

### 5.1 What? Prediction Generalization

CF-CBMs match generalization performance of standard CBMs.
CF-CBMs attain both concept and task ROC AUC similar to Black Box, standard CBM and CEM, a more expressive CBM (details about these results in Appendix D). This finding demonstrates that generating counterfactuals does not have a negative impact on classification performances on the datasets we considered. Our goal was not to improve performance but to improve interpretability. This outcome highlights how CF-CBMs generalise standard CBM architectures by matching their predictive accuracy while introducing new fundamental functionalities (i.e., counterfactual explanations and task-driven interventions).

### 5.2 How? Intervention impact

**Table 1: CF-CBMs ignore the confounding concept on the modified dSprites dataset.**
|  | Post-hoc | Joint (ours) |
| --- | --- | --- |
| Shape 1 | $0.16\pm 0.03$ | $0.30\pm 0.15$ |
| Shape 2 | $0.13\pm 0.03$ | $0.18\pm 0.08$ |
| Shape 3 | $0.16\pm 0.03$ | $0.32\pm 0.09$ |
| Two obj | $0.04\pm 0.01$ | $0.16\pm 0.07$ |
| Colours (confounder) | $0.17\pm 0.03$ | $0.02\pm 0.01$ |

Jointly training counterfactuals’ generator and CBMs makes
the model rely on fewer important concepts leading to simpler explanations (Table 2)
Following Koh et al. (), CF-CBMs allow users to intervene directly on the concepts, enabling simulation of diverse scenarios and observation of their effects on the model’s final prediction, as quantified by the Causal Concept Effect (CaCE) (Goyal et al., ).
To assess the impact of CF-CBMs joint training design on how the model perceives the importance of each concept we conducted experiments using a modified dSprites dataset, following Goyal et al. (), where a high correlation was introduced between an object’s color and its class label.
While standard CBM explanations weighted shape and color (confounders) equally for class prediction, CF-CBMs correctly prioritized shape as the primary predictor, as shown in Table 2.
Specifically, altering color in standard CBMs resulted in a CaCE score of 0.17, demonstrating a 17% chance of prediction change due to this confounding factor. This reveals that standard CBMs are susceptible to relying on shortcuts in decision-making (Marconato et al., ).
In contrast, CF-CBMs showed minimal sensitivity to color changes, with a CaCE score of just 0.02, demonstrating significantly higher robustness against confounding features. Additionally, CF-CBMs assigned higher CaCE scores to shape concepts, indicating a stronger reliance on these critical features, unlike the post-hoc version. This trend was consistently observed across the other datasets: MNIST (p-value = 0.003) and CUB (p-value = 0.000), where CF-CBMs and CBMs exhibited distinct CaCE distributions as confirmed by the Kolmogorov-Smirnov test (the distributions are shown in App. D). Table 2 further illustrates that CF-CBMs achieved a higher mean CaCE for the top 10% of concepts, signifying that the model concentrates on a smaller subset of highly relevant concepts. This focus results in more concise and interpretable explanations by engaging a reduced number of concepts. Moreover, CF-CBMs exhibited a lower mean CaCE for the bottom 50% of concepts, suggesting that the model learned to disregard less critical features, *thereby enhancing robustness against concept perturbations*. The Mann-Whitney U test results reveal that three out of four comparisons were statistically significant, underscoring the impact of joint training.
This shift in decision-making comes from the CF-CBM’s objective of generating counterfactuals that alter only the minimal subset of concept labels required to change the class prediction—e.g., adjusting shape but not color. Consequently, the model’s task predictor is forced to focus on the minimal set of decisive features. For additional details on the CaCE score distributions, refer to Appendix D. Overall, our findings suggest that jointly training CF-CBMs not only improves model interpretability but also yields a more robust decision-making process.

**Table 3: CF-CBMs outperform all baselines in counterfactuals’ validity across all datasets.**
|  | dSprites ($\uparrow$) | MNIST add ($\uparrow$) | CUB ($\uparrow$) | avg. ($\uparrow$) |
| --- | --- | --- | --- | --- |
| CBM+BayCon | $\mathbf{100.0\pm 0.0}$ | $94.6\pm 0.5$ | $66.2\pm 0.5$ | $86.9\pm 0.3$ |
| CBM+CCHVAE | $98.4\pm 0.6$ | $94.7\pm 0.2$ | $78.7\pm 0.4$ | $90.6\pm 1.2$ |
| CBM+VAECF | $\mathbf{100.0\pm 0.0}$ | $82.0\pm 5.9$ | $95.2\pm 0.2$ | $92.4\pm 2.0$ |
| CBM+VCNET | $\mathbf{100.0\pm 0.0}$ | $89.9\pm 0.9$ | $93.1\pm 0.5$ | $94.3\pm 0.5$ |
| CF-CBM (ours) | $\mathbf{100.0\pm 0.0}$ | $\mathbf{96.4\pm 0.7}$ | $\mathbf{99.0\pm 0.1}$ | $\mathbf{98.5\pm 0.3}$ |

### 5.3 Why not? Counterfactual actionability

CF-CBMs outperform baselines in counterfactuals’ validity. (Table 3)
CF-CBMs attain the highest counterfactual validity across all datasets when compared to counterfactual generation baselines applied to the concept space of standard CBMs. This result shows that CF-CBMs can effectively generate concept vectors that lead to user-requested class labels. The gap w.r.t. baselines increases in complex datasets involving a vast search space over multiple concepts and classes. In the MNIST addition dataset (20 concepts, 19 classes), CF-CBMs achieve $+14$ percentage points (p.p.) higher validity than VAECF and $+7$ p.p. higher than VCNet. In CUB (118 concepts, 200 classes), CF-CBMs find solutions with a significantly higher validity w.r.t. iterative methods: $+33$ p.p. higher than BayCon and $+20$ p.p. higher than C-CHVAE.

Figure: Figure 3: CF-CBMs balance the trade off between counterfactuals’ reliability (proximity) and user effort ($\Delta$-Sparsity). The arrow $(\rightarrow)$ points towards optimal values. Pareto-optimal models form the frontier of the shaded region, whereas dominated solutions are located within the shaded region.
Refer to caption: x3.png

CF-CBMs balance counterfactuals’ reliability with minimal user effort. (Figure 3)
High-quality counterfactuals should satisfy two key properties simultaneously: to be reliable and to require the least amount of users’ effort to act upon. However, minimizing user’s effort alone might lead to learning shortcuts producing less reliable counterfactuals, while optimizing reliability might generate counterfactuals that change the values of multiple concepts and represent a significant burden for users to take actions. For this reason, these two properties should be evaluated together:

- •
CF-CBMs generate reliable counterfactuals: When processing large datasets, the training distribution covers a large portion of the feasible action space. For this reason, counterfactual solutions close to training samples are likely to be more reliable, as discussed by Pawelczyk et al. (); Laugel et al. (); Wachter et al. (). Our results show that CF-CBMs generate highly reliable counterfactuals across all datasets. Baseline models instead struggle to produce counterfactual close to training samples in at least one dataset.
- •
CF-CBMs generate counterfactuals requiring minimal user effort to act upon: CF-CBMs consistently generate counterfactuals close to the optimal sparsity i.e., the fewest possible concept changes to alter the class prediction. This represents a significant result in terms of actionability because each concept modification requires user effort. For this reason, should a counterfactual require many concept label changes compared to the original concept vector, it would lead to a substantial unnecessary effort. Across all datasets, CF-CBMs stand out for their consistency in this aspect: their counterfactuals are either the sparsest or very close to the sparsest. This makes them highly effective and user-friendly, avoiding the burden of unnecessary actions.

CF-CBMs calibrate the variability-plausibility trade-off. (Figure 4)
Another key trade-off in generating counterfactuals corresponds to the tension between producing counterfactuals with high diversity, allowing users to pick among different roadmaps to action, and producing plausible counterfactuals corresponding to user actions that are likely to be feasible in practice. However, learning shortcuts might lead to trivial solutions with a poor variability-plausibility trade-off. For instance, once a plausible counterfactual is found, a trivial solution could be to generate always the same counterfacual, thus leading to minimal diversity, while maximizing the variability increases the chance of generating less plausible counterfactuals.
In practice, these two properties are measured by variability and IoU between counterfactuals and ground-truth concept vectors.

Figure: Figure 4: CF-CBMs calibrate the trade off between counterfactuals’ diversity (variability) and plausibility (IoU). The arrow $(\rightarrow)$ points towards optimal values. Pareto-optimal models form the frontier of the shaded region, whereas dominated solutions are located within the shaded region. “CF-CBM $n$” samples $n$ counterfactuals from the latent distribution as described in App. B.
Refer to caption: x4.png

A higher variability implies that our model can produce a wider range of counterfactuals. A higher IoU value suggests that generated counterfactuals are also representative of the training distribution which contains plausible solutions. Our results show that CF-CBMs balance the optimization of these two properties better than existing methods. The gap w.r.t. BayCon and VCNet is already significant on dSprites where CF-CBMs produce counterfactuals with $+25$ p.p. higher IoU (plausibility) and $\times 3$ more variable. In MNIST addition the VAECF’s performances significantly deteriorate, while C-CHVAE mainly struggles in CUB.

Figure: Figure 5: CF-CBMs generate reliable (proximity) and accurate interventions (ROC AUC Int.). The arrow $(\rightarrow)$ points towards optimal values. Pareto-optimal models form the frontier of the shaded region, whereas dominated solutions are located within the shaded region.
Refer to caption: x5.png

CF-CBMs generate accurate task-driven interventions. (Figure 5)
CF-CBMs enable task-driven interventions showing users how to modify concepts to get the desired class label. This represents a novel crucial functionality when users are aware of a desired outcome but lack the knowledge required to intervene on concepts. CF-CBM significantly outperforms other baselines in concept accuracy of task-driven interventions by up to $78$ p.p. Such performance can be explained as the generation of task-driven interventions is conditioned on a user-provided target class label which provides fundamental information for the model to search in the latent concept distribution. Appendix D shows that CF-CBMs attain similar results while applying different levels of noise on predicted concept labels.

Figure: Figure 6: CF-CBMs efficiently generate counterfactuals on the fly, on par with the fastest generators.
Refer to caption: x6.png

CF-CBMs efficiently generate counterfactuals on the fly. (Figure 6)
Generation efficiency is a key feature for real-time applications. In this respect, CF-CBMs significantly outperform iterative models such as C-CHVAE and BayCon. These models quickly struggle in large search spaces involving a high number of concepts: generating a counterfactual takes more than a minute on dSprites (7 concepts) and up to a few hours on CUB (118 concepts). CF-CBMs instead scale well with the size of the data set by requiring less than a second on dSprites and a few seconds on CUB, on par with VAECF and VCNet. This efficiency enables a wider range of applications requiring a high number of concepts and quick feedbacks.

## 6 Discussion & Conclusion

Limitations.
CF-CBMs combine features from CBMs and generative models, carrying forward their strengths and limitations. From generative models, CF-CBMs inherit the ability to efficiently approximate the data distribution. However, this approximation does not guarantee counterfactuals’ optimality when compared to exact methods (Wachter et al., ). Besides, CF-CBMs require concept annotations to ground explanations, as standard CBMs. Reasoning shortcuts (Marconato et al., ), concept impurities (Zarlenga et al., ), and information bottlenecks (Espinosa Zarlenga et al., ) are also typical limitations of CBM architectures, especially when the concept bottleneck is not complete (Yeh et al., ). However, recent works show how CBMs (and the same argument holds for CF-CBMs) could be extended using language models to automatically extract concepts annotations (Oikarinen et al., ).

**Table 4: CF-CBMs efficiently address “what?”, “how?”, and “why not?” questions while supporting both concept and task-interventions, as opposed to existing CBMs and counterfactual generators.**
|  | CF-CBM (ours) | CBM | Black Box | BayCon | C-CHVAE | VAE-CF | VCNet |
| --- | --- | --- | --- | --- | --- | --- | --- |
| What? | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  |  | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |
| How? | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  |  |  |  |
| Why not? | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |
| Concept interventions | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  |  |  |  |
| Task-driven interventions | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  |  |  |  |  |
| Real-time | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |  |  |  | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ | ${\color[rgb]{0,0.390625,0}\definecolor[named]{pgfstrokecolor}{rgb}{<br>0,0.390625,0}\bm{\checkmark}}$ |

Relations with concept-based models.
CF-CBMs share common ground with existing CBMs in modeling concepts in latent spaces. However, current models use the latent concept space to improve task accuracy (Espinosa Zarlenga et al., ; Barbiero et al., ), promote concept disentanglement (Misino et al., ; Marconato et al., ), or estimate confidence intervals for CBM’s predictions (Kim et al., ). Differently, CF-CBMs leverage the latent concept space to extend the capabilities of the CBM family by introducing two key functionalities (Table 4): counterfactual explanations and task-driven interventions.

Relations with generative structured models.
CF-CBMs are latent generative models characterized by a structured latent space. This characterization aligns them with other methodologies utilizing hierarchical priors (Sønderby et al. (); Maaløe et al. (); Vahdat & Kautz (); Klushyn et al. ()), mixture priors (Bauer & Mnih ()), and autoregressive priors (Chen et al. (); van den Oord et al. (); Razavi et al. ()). However, the structure of CF-CBMs’ latent variables explicitly captures both the concept and the counterfactual latent space, thus promoting structural interpretability, unlike existing structured latent variable models.

Relation with counterfactual models.
Existing DL methods generating counterfactuals typically offer post-hoc explanations (Ghandeharioun et al., ; Abid et al., ) or require interpretable input features (Guyomard et al., ; Pawelczyk et al., ; Mahajan et al., ). However, applying post-hoc methods directly to unstructured data types (e.g., pixels rather than concepts) significantly reduces counterfactuals’ interpretability (Kim et al., ). In contrast, CF-CBMs: (i) are data-agnostic, allowing for the extraction of interpretable counterfactuals regardless of the data type, (ii) provide answers to “how?” questions by allowing interventions, (iii) modify the decision-making process by optimizing counterfactuals through joint optimization leading to relying on fewer concepts and (iv) support both concept and task-driven interventions (Table 4).
As a side effect, concept-based counterfactuals may also introduce benefits in terms of privacy as sensitive and unique details embedded in input data (e.g., the image of a radiography) remain concealed, thus mitigating the risk of data extraction through repeated model queries (Goethals et al., ; Naretto et al., ; Pawelczyk et al., ).

Broader Impact.
The ability to answer all the three questions represents a fundamental step to calibrate human trust and enhance human-machine interactions. In this work, we show how combining existing interpretable models (such as CBMs) and post-hoc counterfactual generators may represent a possible solution to address “what?”, “how?”, and “why not?” queries. Experimental results show that training the counterfactual generator jointly with the CBM leads to two key improvements: (i) it alters the model’s decision-making process, making the model rely on fewer important concepts (leading to simpler explanations), and (ii) it significantly increases the causal effect of concept interventions on class predictions, making the model more responsive to these changes.
Besides, the ability to perform task-driven interventions may provide actionable insights to improve CF-CBMs’ predictions whenever users observe a mispredicted class label but do not know how to intervene on concepts. Finally, the proposed latent variable approach enables to efficiently model concept dependencies while generating multiple counterfactuals for a given input. This represents a key advantage w.r.t. iterative methods in practical applications where proposing a variety of interpretable counterfactuals on the fly represents a fundamental advantage.

## Appendix A Ammortized inference and ELBO Derivation

To derive the ELBO objective function defined in Section 3.1, we start from the maximization of the log-likelihood of the tuple $(c,y,y^{\prime})$:

$$ $\log p(c,y,y^{\prime})=\log\int_{c^{\prime},z,z^{\prime}}p(c,c^{\prime},y,y^{ \prime},z,z^{\prime})dc^{\prime}dzdz^{\prime}$ $$

where $p(c,c^{\prime},y,y^{\prime},z,z^{\prime})$ factorizes as in Section 3.1. We consider the variational approximation $q(z,z^{\prime},c^{\prime}|x,y,c,y^{\prime})=q(z|x)q(z^{\prime}|z,c,y,y^{\prime
})p(c^{\prime}|z^{\prime})$ thus exploiting the observation of $x$ to better infer $z$:

$$ $x$ $c$ $y$ $y^{\prime}$ $z$ $z^{\prime}$ $$

We have:

$$ $\displaystyle\log p(c,y,y^{\prime})=\log\int$ $\displaystyle\frac{q(z|x)q(z^{\prime}|z,c,y,y^{\prime})p(c^{\prime}|z^{\prime} )}{q(z|x)q(z^{\prime}|z,c,y,y^{\prime})p(c^{\prime}|z^{\prime})}\cdot$ $\displaystyle\quad\quad\cdot p(c,c^{\prime},y,y^{\prime},z,z^{\prime})dc^{ \prime}dzdz^{\prime}$ $$

and, given the Jensen’s inequality, we obtain:

$$ $\displaystyle\log p(c,y,y^{\prime})\geq\int$ $\displaystyle q(z|x)q(z^{\prime}|z,c,y,y^{\prime})p(c^{\prime}|z^{\prime})\cdot$ $\displaystyle\cdot\log\frac{p(c,c^{\prime},y,y^{\prime},z,z^{\prime})}{q(z|x)q (z^{\prime}|z,c,y,y^{\prime})p(c^{\prime}|z^{\prime})}dc^{\prime}dzdz^{\prime}$ $$

that can be rewritten as:

$$ $\displaystyle\log p(c,y,y^{\prime})\geq$ $\displaystyle\mathbb{E}_{z}[\log(c|z)]+$ $\displaystyle\log p(y|c)+$ $\displaystyle\mathbb{E}_{z,z^{\prime},c^{\prime}}[\log p(y^{\prime}|c^{\prime} )]-$ $\displaystyle D_{KL}[p(z)|q(z|x)]-$ $\displaystyle D_{KL}[p(z^{\prime})|q(z^{\prime}|z,c,y,y^{\prime})].$ $$

## Appendix B Take the best bet or contemplate a multiverse?

All these functionalities can be used in two ways: the “best bet” mode and “multiverse” mode. In the “best bet” mode, CF-CBMs provide maximum a posteriori estimates by taking the mode of posterior distributions. Using this mode, users will be provided with the most probable counterfactual for each input. In “multiverse” mode instead, CF-CBMs sample from posterior distributions. This allows the model to generate multiple counterfactuals for each input, thus allowing users to choose among a variety of actions/interventions. For instance, in a healthcare scenario, the “best bet” mode might suggest the most probable alternative treatment plan based on patient data, while the “multiverse” mode could present a range of treatment strategies under varying clinical conditions, each representing a different plausible future.

## Appendix C Experimental details

### C.1 Data & task setup

In our experiments we use three different datasets commonly used to evaluate CBMs:

- •
dSprites (Matthey et al., ) — It is composed of images of one of three objects (square, ellipse, heart) in different positions and of different sizes. Starting from it, we design a binary task, which is to predict if in the image there is at least a square or a heart. We also combine initial images to obtain new ones with more than one object. The concepts for this task are: (1) the presence of a square, (2) the presence of an ellipse, (3) the presence of a heart, (4) the presence of two objects, (5) objects are red, (6) objects are green, (7) objects are blu.
- •
MNIST addition — The task of this dataset is to predict the sum of two MNIST digits (Deng, ). The concepts of this task are the one-hot encoding of the first and the second digits concatenated together.
- •
CUB (Welinder et al., ) — It contains pictures of birds and the final task is to predict their species (among 200 species). The concepts are 118 bird features that human annotators selected.

### C.2 Evaluation Metrics

In our analysis we use the following metrics. What? (prediction generalization): we compute the Area Under the Receiver Operating Characteristic Curve (Hand & Till, ) for concepts and tasks (ROC AUC ($\uparrow$).
How? (intervention impact): we compute the impact of each concept on the downstream task, inspecting the task predictor $f$ (Yuksekgonul et al., ). For each class, we look at the related weights of the task predictor (a Linear layer), one weight for each concept. In this way, it is visible the impact of each concept on each specific class. Then, we evaluate the impact of intervening on confounding concepts for class predictions (Koh et al., ). We modify the dSprites task to highly correlate the colors with the shapes and therefore the task label. For instance, in 85% of samples with a positive label (presence of at least one square or heart), the objects are green, while in 85% of the samples with a negative label, the objects are red or blue.
Why not? (counterfactual actionability): drawing from previous works on counterfactuals, we compute: (i) the validity($\uparrow$) (Wachter et al., ) by checking whether the model predicts the desired class labels based on the generated counterfactual; (ii) the proximity ($\downarrow$) (Pawelczyk et al., ) which evaluates counterfactuals’ “reliability” as their similarity w.r.t. training samples; (iii) the time ($\downarrow$)  (Romashov et al., ) to generate a counterfactual for a set of samples.

In addition, we propose the following metrics to assess the quality of counterfactuals: (i) the $\Delta$-Sparsity ($\downarrow$) which evaluates user’s “wasted efforts” by counting the number concepts changed (Guo et al., ) w.r.t. the minimal number of changes that would have generated a counterfactual according to the dataset:

$$ $\Delta Sparsity=|OptimalSparsity-Sparsity|\\$ $$

where $OptimalSparsity$ represents the mean Hamming distance between each concept vector in the test set and the closest concept vector of a drawn random class $y^{\prime}$, found using a “brute-force" approach and $Sparsity$ represents the mean Hamming distance between the predicted concepts $\hat{c}$ and the predicted concept counterfactuals $\hat{c^{\prime}}$;
(ii) the “plausibility” (Wachter et al., ) as the Intersection over Union (IoU ($\uparrow$)) (Jaccard, ) between counterfactuals and ground-truth concept vectors; (iii) the variability ($\uparrow$) which evaluates counterfactuals’ “diversity”, as the cardinality ratio between the set of counterfactuals generated and the set of training concept vectors

$$ $Variability=\frac{|c^{\prime}|}{|c|}$ $$

where $|c^{\prime}|$ represents the cardinality of the set composed by all $\hat{c^{\prime}}$, while $|c|$ represents the cardinality of the set composed by all $c$; (iv)
finally, we measure the concept accuracy of generated interventions (Acc Int. ($\uparrow$)) w.r.t. ground-truth optimal interventions that evaluate the model’s ability to generate potential concept interventions.
Following Espinosa Zarlenga et al. (), we inject noise on predicted concepts $\hat{c}$ to reduce task accuracy (randomly flip the value of some concepts), then we sample counterfactuals, conditioning on the ground-truth label $y$, and use them to fix mispredicted concept labels automatically.

$$ $AccInt.=\frac{\sum_{i\in c}1_{c_{i}=\hat{c^{\prime}_{i}}}}{|c|}$ $$

where $c_{i}$ represents the concept ground truth for the sample $i$, while $\hat{c^{\prime}_{i}}$ represents the counterfactual generated for the sample $i$ that tries to recover $c$.

### C.3 Baselines and Implementation details

Hyperparameters To train our models and the baselines we selected the best hyperparameters according to our experiments. Table 5 shows the number of epochs, learning rate, and embedding size in the latent space, batch size for each dataset. They are shared among the baselines, and we took the best checkpoint out of the entire training for each model. In addition, Table 6 illustrates the parameters used to weight each term in the loss. However, all these details are in the released code.

**Table 5: Model Hyperparameters shared across all models. During the training, we select the best checkpoint for each model.**
| Hyperparams | dSprites | MNIST add | CUB |
| --- | --- | --- | --- |
| Epochs | 75 | 150 | 150 |
| Learning rate | 0.005 | 0.005 | 0.005 |
| Hidden size | 128 | 128 | 128 |
| Batch size | 1024 | 1024 | 1024 |

**Table 6: Loss weights**
| Method | Dataset |  |  |  |
| --- | --- | --- | --- | --- |
|  | Loss Term | dSprites | MNIST add | CUB |
| CBM | Concept | 1.0 | 1.0 | 1.0 |
| Task | 0.1 | 0.1 | 0.1 |  |
| CCHVAE | Reconstruction | 1.0 | 1.0 | 1.0 |
| KL | 0.5 | 0.5 | 0.5 |  |
| VAECF | Reconstruction | 3.0 | 1.3 | 1.0 |
| KL | 1.0 | 1.0 | 2.0 |  |
| Validity | 15.0 | 15.0 | 15.0 |  |
| VCNET | Concept | 1.0 | 1.0 | 1.0 |
| Task | 0.5 | 0.5 | 0.5 |  |
| Reconstruction | 0.5 | 0.5 | 0.5 |  |
| KL | 0.8 | 0.8 | 0.8 |  |
| CF-CBM | Concept | 10.0 | 10.0 | 1.0 |
| Task | 0.7 | 1.0 | 0.1 |  |
| Validity | 0.3 | 0.2 | 0.02 |  |
| $z$ KL | 1.2 | 2.0 | 0.2 |  |
| $z^{\prime}$ KL | 1.2 | 2.0 | 0.2 |  |
| Prior distance | 1.0 | 1.7 | 0.2 |  |
| Posterior distance | 0.6 | 0.55 | 0.03 |  |

Counterfactual CBM implementation details To improve the training process of our models we decided to relax some assumptions we made in Section 3.1. Employing a Bernoulli distribution to predict concepts and a Categorical distribution for the class prediction would make the training process more difficult, ruining the gradient in the backpropagation process. Therefore, we predict them directly with the output of the concept predictor and the task predictor applying a Sigmoid function and a Softamx on top of them, respectively. To optimise them, we choose to use a Binary Cross Entropy loss for the concept loss, and a Cross Entropy Loss for the task loss.

Code, licenses and hardware For our experiments, we implement all baselines and methods in Python 3.9 and relied upon open-source libraries such as PyTorch 2.0 (Paszke et al., ) (BSD license), PytorchLightning v2.1.2 (Apache Licence 2.0), Sklearn 1.2 (Pedregosa et al., ) (BSD license). In addition, we used Matplotlib (Hunter, ) 3.7 (BSD license) to produce the plots shown in this paper. The datasets we used are freely available on the web with licenses: dSprites (Apache 2.0) MNIST (CC 3.0 DEED) and CUB (MIT License).
We will publicly release the code with all the details used to reproduce all the experiments under an MIT license.
The experiments were performed on a device equipped with an M3 Max and 36GB of RAM, without the use of a GPU. Approximately 80 hours of computational time were utilized from the start of the project, whereas reproducing the experiments detailed here requires only 10 hours.

## Appendix D Further metrics and results

In addition to the result present in Section 5, Table 7 shows the task and concept performance of our model and the baselines.
Moreover, Figure 7 illustrates the Acc Int. achieved by all models with different levels of noise injected at the concept level. It is visible how CF-CBM achieves stable Acc Int. results with different level of noise injected at the concept level. This is not the case for the other baselines.
Finally, Figure 8 shows the distribution of the CaCE score obtained in MNIST add and CUB in the post-hoc and joint fashions. It allows to directly see the distributions used to compute the metrics in Table 2.

**Table 7: CF-CBM attains generalization performance of standard CBMs on concepts and class labels.**
|  | dsprites | MNIST add | CUB |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  | Task (%) ($\uparrow$) | Concept (%) ($\uparrow$) | Task (%) ($\uparrow$) | Concept (%) ($\uparrow$) | Task (%) ($\uparrow$) | Concept (%) ($\uparrow$) |
| Black Box | $99.9\pm 0.0$ | - | $98.4\pm 0.0$ | - | $94.4\pm 0.0$ | - |
| CBM | $99.6\pm 0.1$ | $98.8\pm 0.1$ | $98.4\pm 0.0$ | $99.7\pm 0.0$ | $93.0\pm 0.0$ | $85.3\pm 0.1$ |
| CEM | $99.8\pm 0.1$ | $98.6\pm 0.1$ | $98.4\pm 0.0$ | $99.5\pm 0.0$ | $93.3\pm 0.1$ | $85.7\pm 0.1$ |
| BayCon | $99.6\pm 0.0$ | $98.7\pm 0.1$ | $98.4\pm 0.0$ | $99.7\pm 0.0$ | $93.1\pm 0.1$ | $85.3\pm 0.1$ |
| CCHVAE | $99.5\pm 0.1$ | $98.9\pm 0.1$ | $98.4\pm 0.0$ | $99.7\pm 0.0$ | $93.2\pm 0.1$ | $85.4\pm 0.1$ |
| VAECF | $99.5\pm 0.0$ | $98.8\pm 0.1$ | $98.4\pm 0.0$ | $99.7\pm 0.0$ | $92.9\pm 0.2$ | $85.4\pm 0.1$ |
| VCNET | $99.7\pm 0.0$ | $98.6\pm 0.1$ | $98.2\pm 0.0$ | $99.6\pm 0.0$ | $89.6\pm 0.5$ | $80.7\pm 0.1$ |
| CF-CBM | $99.7\pm 0.0$ | $98.7\pm 0.1$ | $97.0\pm 0.1$ | $99.3\pm 0.0$ | $91.4\pm 0.2$ | $84.8\pm 0.2$ |

Figure: Figure 7: CF-CBMs attain similar results while applying different levels of noise on predicted concept labels.
Refer to caption: x7.png

Figure: Figure 8: The distribution of the CaCE score of the CUB and MNIST add dataset obtained by the end-to-end (Joint) approach and by the post-hoc one.
Refer to caption: x8.png

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: Additional comments/questions: 
* [L042-044] This is a bold claim....what about the field of XAI? Pearl's ladder of causality has been quite influential in deep learning (including XAI), so I would assume that any methods aimed at counterfactual explanations would address these questions to some extent.
* I find the abstract a bit strange. Causal inference is a broad field attempting to answer (from a statistical perspective) the how and why questions, but it is not explicitly mentioned. Also, "existing CBMs" are mentioned in passing but the authors don’t say what they are or how they work. Maybe it would be better to more precisely situate the paper in the context of recent attempts to integrate causal inference with deep learning.  
* [Sec 2] I don't insist, but it would be nice to see a citation acknowledging early efforts of using VAEs for causal inference [https://proceedings.neurips.cc/paper/2017/hash/94b5bde6de888ddf9cde6748ad2523d1-Abstract.html]
* [Eqn 1, L123] I don't understand why sampling a counterfactual concept c' does not also require sampling a fresh set of covariates x'. It seems to me that for concepts that matter in the real world, you would need to update the observed features as the concept is manipulated. To ground this in the x-ray example, if the concept is changed from "narrow joint space" to "bone spurs", would the distribution over pixels not also need to be updated? Clarifying this point seems important to justify why the $p(x|z)$ term is ignored in the optimization [L152].
* [L169] how are specific values for $\lambda_i$ [Table 6] chosen? Was a validation set used for tuning? Is the method sensitive to these values? I'm not satisfied with "these details are in the released code" [L850]
* [L260-265] The experiments inherit some datasets from prior papers, such as Koh et al 2020. Is there a reason why the OAI x-ray dataset from that paper was not used? X-rays are used as a working example throughout the paper [Fig 1, Fig 2, Sec 3.2] so this omission surprised me.
* [Sec 4, Sec 5] How does the method do when asked to simulate concept pairings that are OOD w.r.t. its training data? I would imagine for the CUB dataset there will be combinations of bird characteristics that are not represented by real-life birds; is it possible to examine the predictions for these concepts?. The strength of human counterfactual reasoning comes in part from OOD generalization, e.g. imagining a pink elephant. Replicating this using ML seems quite difficult. In the end I still have questions around whether what is being done here is meaningfully different from structured generative/discriminative modeling [L503-509] with interpretable features that can be adjusted on the fly. I think this is certainly related to counterfactual reasoning, but may not encompass it completely.
* [L516] If I express the counterfactual as E[Y|do(X)=X', Y=Y'] and the interventional as E[Y|do(X)=X'], then it would seem that counterfactual explainability methods can answer the "how" question by just marginalizing out the specific observation, i.e. E[Y|do(X)=X'] = E_{Y'}[ E[Y|do(X)=X', Y=Y']. You could replace the observation being a label (Y=Y') with the observation being a concept or other covariate as needed. Is there something wrong with this line of reasoning? Modeling counterfactuals seems more challenging than modeling interventions, so I am wondering if the authors have thought of how to go from one to the other in a post-hoc manner without designing a method that explicitly models all three levels of Pearls' ladder.
soundness: 2
strengths: The authors tackle an extremely challenging problem (counterfactual reasoning using deep learning); making meaningful progress along this direction would have a big impact.

The authors show how training using a structured objective allows for test-time manipulations that shed light on how predictions are made

They extend CBM to include counterfactual sampling, which in principle allows a single model to estimate quantities at all three levels of Pearl’s ladder of causation.

The proposed method relies on concept labels, which may be difficult to collect in realistic settings.
summary: The authors extend the concept bottleneck model framework to allow simulation of counterfactual concepts and labels. The method is based on a variational approach that models concepts as latent confounders, and approximates this posterior using concept labels at training time. This extension opens the door to explaining prediction at a finer level of detail, focusing on intermediate concepts rather than pixel values.
weaknesses: The training objective is fairly complex and introduces many hyperparameters. The authors do not discuss how to tune these.

There is a disconnect between the working example of x-ray imaging and the types of datasets considered in the experiments.

I felt that details of the SCM design and subsequent training (e.g. ignoring p(x|z)) were not justified

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: Could you provide additional visual examples of counterfactuals generated by your model and baseline methods for each dataset? Visualizing these comparisons would be highly intuitive and beneficial for readers, helping them clearly see the improvements.
soundness: 3
strengths: 1. The method is straightforward and intuitive, combining two existing approaches, counterfactual reasoning and concept bottleneck modeling with moderate novelty. The experiments provide solid evidence of its effectiveness.
2. This paper is well organized, and abstract and introduction effectively set the stage for the paper's major content.
3. The method enhances the interpretability of counterfactuals, making it potentially valuable for many real-life settings like medical applications, as the authors suggest, beneficial for clinical decision-making processes.
summary: This paper presents a method that combines counterfactual and concept bottleneck that can answer "What?", "How?" and "Why not?" all at once. It leverages latent variable models to generate counterfactuals via variational inference. It achieves comparable classification accuracy to standard CBMs and black-box models and outperforms in generating interpretable, concept-base counterfactuals.
weaknesses: 1. While the paper uses 3 datasets, they are relatively simple. In this paper, authors use examples of medical images (fig 1) but did not actually experiment with any medical dataset. Using more diverse and complex real-life dataset (e.g., CIFAR-100 or MIMIC-CXR) would strengthen the paper and demonstrate broader applicability.
2. The paper lacks visualizations of counterfactuals. For example, when discussing improvements in counterfactual quality, it would be helpful to show visual comparisons with baselines. Providing real counterfactual comparisons would better substantiate the claims and help readers understand the model's advantages.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 4
questions: - Please refer to the weaknesses.
soundness: 3
strengths: - The paper is easy to read, and the figures are well described and informative.
- Explanations seem to be easy to use.
- The method is tested against many baselines.
summary: The paper introduces a concept bottleneck model with the ability to generate counterfactual explanations. The paper aims to answer three questions: what, how and why not. The what questions are answered by showing the concepts used to make predictions. The how questions are answered by changing the concepts and observing how the prediction changes. Finally, why not questions can be answered by providing an alternative outcome and observing how the concepts change to understand what-if situations. The method also enables what the authors call “task-driven” interventions that allow users to correct wrongly predicted concepts. The models are tested on three datasets: dSprites, MNIST add CUB, and tested on various metrics. In general, based on the experiments, the proposed model demonstrates good performance across multiple tasks and datasets.
weaknesses: - I am concerned regarding the number of hyperparameters that need to be set for the loss function. It is not clear how important they are, and how much tuning is needed. How easy is it to tune these hyperparameters? How do they affect the results? Is it easier to have separate systems rather than one big as the one proposed?
- The method requires handcrafted concepts, and it might not be easy to come up with these concepts. Further, there might be a lot of labor involved in creating these concepts. Moreover, the predictive performance depends on how well these concepts describe the input features.
- Figure 1: Is it only for illustration or is this actually the result from trained models on x-ray images?
- I might have missed it, but I cannot find the citation for the dataset from which the x-ray images come. If I did not miss it, please cite it so it becomes easier for readers to find it. Moreover, are there any restrictions on showing these images, that is, what is the license of these images?
- I believe the x-ray images to be from the Osteoarthritis Initiative dataset. It is used to motivate the paper, but why is it not used in the experiments? Are there any weaknesses with the method making the dataset unsuitable for experimentation and showcasing results?
- Line 156: Why does z' need to be conditioned on both c and y? Don't we already know y if we know c?
- Line 224: How do we know Equation 5 gives us sparser explanations? Is it because the posterior is moved towards the prior distribution? But this is defined in the latent space. How can we know that the concepts c will be sparse even though the posterior of z is close to the prior?
- How are the models trained? Are certain parts frozen, or are all components trained jointly?
- Is it possible to show readers the explanations themselves for the datasets used and not only Figure 1 for a dataset not used? We have seen many quantitative results, but part of XAI also involves qualitative qualities. How do these explanations perform qualitatively with end-users? Are they useful to human end-users? And who are the intended end-users for these explanations?
- Although we do not need to run post-hoc searches, new black-box components are introduced into the model. How does that affect the overall interpretability of the model? I believe that can also have negative side effects and not only positive influences.

---

confidence: 4
contribution: 3
initial_rating: 8
presentation: 3
questions: - 5.1 I find it important to have the results of this question also in the main paper, e.g., average values, as it is an important one. I would additionally suggest the authors change the wording of the conclusion. It seems that on average CF-CBMs are slightly lowerd in predictive performance. While I don’t think this is a drawback of the proposed emthod, I think stating the method is on par is slightly overstated. That CF-CVM is not necessarily on par is an important information for the reader/user. Again stating this won’t decrease the contribution. 

- 5.2. I don’t understand the intuition behind why CF-CBMs should be less prone to confounding factors? What mechanism in their learning is beneficial for this? Maybe an ablation study would be intersting to underscore these findings.

- Please provide code to the paper, e.g., an anonymized github link.

- Lastly, this [1] might be an interesting paper to add to the Introduction as it tackles learning concepts (e.g., for CBMs) focussing on learning inspectable concepts, e.g., via counterfactual querying. Of course [1] focuses on counterfactual concepts, whereas this work focuses on counterfactuals for a model decision.

[1] Wolfgang Stammer, Antonia Wüst, David Steinmann, and Kristian Kersting. “Neural Concept Binder.” In: Advances in Neural Information Processing Systems (NeurIPS) (2024)
soundness: 3
strengths: The paper is very well written and structured. It is well motivated and the methodological contribution as far as I can tell is clear and important.
summary: This work introduces the framework of counter factual CBMs, aimed specifically to increase the variability and depth of inspection question that can be asked towards a CBM. In other words, CF-CBM aims to increase the level of interpretability and interactability of standard CBM models without losing performance.
weaknesses: I just have a few minor remarks which I have added to the questions section.

Meta-review: The paper extends the concept bottleneck model (CBM) framework to enable counterfactual reasoning, allowing for finer-grained explanations of model predictions using intermediate concepts instead of raw pixel values. The proposed method relies on a variational approach that treats concepts as latent confounders, with posterior distributions approximated using concept labels during training. This approach addresses the "what," "how," and "why not" questions about predictions, offering a unified method for interpretability and intervention in predictions.

Strengths

+ The paper addresses a challenging and impactful problem: integrating counterfactual reasoning with deep learning models for enhanced interpretability.
+ The method enhances traditional CBMs to handle counterfactual sampling, potentially addressing all three levels of Pearl's ladder of causation.
+ Solid experimental results demonstrate that the proposed method maintains classification performance comparable to standard CBMs and black-box models.
+ The paper is well-organized, clearly written, and effectively introduces the motivation, contributions, and experimental findings.
+ The approach improves the interpretability of counterfactuals, which is valuable for real-world applications, particularly in domains like medical decision-making.
+ The method is tested against multiple baselines and datasets, showing robustness in various settings.

Weaknesses

+ The training process introduces multiple hyperparameters, but the authors do not provide sufficient details on tuning or sensitivity analysis, raising concerns about practical usability.
+ Despite using medical imagery as a motivating example, no experiments were conducted on medical datasets, limiting the method's demonstrated applicability to real-world scenarios.
+ The datasets used (e.g., dSprites, MNIST, and CUB) are relatively simple, and testing on more complex or diverse datasets (e.g., MIMIC-CXR or CIFAR-100) would strengthen the claims.
+ The method relies on handcrafted concepts, which may be difficult and labor-intensive to define in practice, and predictive performance depends on the quality of these concepts.
+ The lack of visualizations comparing counterfactuals generated by the proposed method and baselines weakens the qualitative evaluation of the approach.
+ Concerns remain regarding the interpretability trade-offs introduced by additional black-box components and the absence of justification for certain design choices (e.g., ignoring p(x∣z)p(x|z)p(x∣z)).


Most concerns have been addressed by the authors during the rebuttal period.

Decision: Accept (Poster)