Causal Analysis for Robust Interpretability of Neural Networks
Interpreting the inner function of neural networks is crucial for the
trustworthy development and deployment of these black-box models. Prior
interpretability methods focus on correlation-based measures to attribute model
decisions to individual examples. However, these measures are susceptible to
noise and spurious correlations encoded in the model during the training phase
(e.g., biased inputs, model overfitting, or misspecification). Moreover, this
process has proven to result in noisy and unstable attributions that prevent
any transparent understanding of the model's behavior. In this paper, we
develop a robust interventional-based method grounded by causal analysis to
capture cause-effect mechanisms in pre-trained neural networks and their
relation to the prediction. Our novel approach relies on path interventions to
infer the causal mechanisms within hidden layers and isolate relevant and
necessary information (to model prediction), avoiding noisy ones. The result is
task-specific causal explanatory graphs that can audit model behavior and
express the actual causes underlying its performance. We apply our method to
vision models trained on classification tasks. On image classification tasks,
we provide extensive quantitative experiments to show that our approach can
capture more stable and faithful explanations than standard attribution-based
methods. Furthermore, the underlying causal graphs reveal the neural
interactions in the model, making it a valuable tool in other applications
(e.g., model repair).
Ola Ahmad, Nicolas Bereux, Loïc Baret, Vahid Hashemi, Freddy Lecue
# Causal Analysis for Robust Interpretability of Neural Networks

###### Abstract

Interpreting the inner function of neural networks is crucial for the trustworthy development and deployment of these black-box models. Prior interpretability methods focus on correlation-based measures to attribute model decisions to individual examples. However, these measures are susceptible to noise and spurious correlations encoded in the model during the training phase (e.g., biased inputs, model overfitting, or misspecification). Moreover, this process has proven to result in noisy and unstable attributions that prevent any transparent understanding of the model's behavior. In this paper, we develop a robust interventional-based method grounded by causal analysis to capture cause-effect mechanisms in pre-trained neural networks and their relation to the prediction. Our novel approach relies on path interventions to infer the causal mechanisms within hidden layers and isolate relevant and necessary information (to model prediction), avoiding noisy ones. The result is task-specific causal explanatory graphs that can audit model behavior and express the actual causes underlying its performance. We apply our method to vision models trained on classification tasks. On image classification tasks, we provide extensive quantitative experiments to show that our approach can capture more stable and faithful explanations than standard attribution-based methods. Furthermore, the underlying causal graphs reveal the neural interactions in the model, making it a valuable tool in other applications (e.g., model repair).

## 1 Introduction

Explainability and interpretability are crucial for deep neural networks (DNNs), which are disseminated in many applications, including vision and natural language processing. Despite their popularity, their opaque nature limits the adoption of these "black-box" models in domains requiring critical decisions without the ability to understand their behavior. Attempts to provide a transparent understanding of DNN systems have led to the development of many interpretability methods. Most of them focus on interpreting the function of DNNs through correlation-based measures, which attribute the model's decision to individual inputs [31]. The most popular ones are saliency (or feature attribution) methods [30, 28, 34, 32, 2, 26, 17, 8].

Saliency methods aim at helping the user to understand why a DNN made a particular decision by explaining the entire model. However, we observe two considerable limitations of these methods. First, they cannot explain the inner function of the neural system being examined. That means how internal neurons interact with each other to reach a particular prediction. As reported in [6], it is difficult to verify claims about black-box models without explanations of their inner workings. A second limitation, they are susceptible to noise and spurious correlations. Whether due to a property of the DNN system obtained during the training phase (e.g., biased inputs, overfitting, or misspecification) or the method being used to capture saliency [14, 15] as shown in Fig. 1). Alternatively, some methods seek to visualize the behavior of specific neurons [19] but cannot provide clear insights due to their large number and overall complex architectures.

In this paper, we propose a novel method that addresses the above limitations through the angle of causality. We show that a technique grounded in the theory of causal in
ference provides robust and faithful interpretations of model behavior while being able to reveal its neural interactions. Inspired by neuroscience, we analyze individual neurons' effects on model prediction by intervening in their connections (model's weights or filters).

We summarize our contributions as follows. a) We propose a robust interpretability approach to capture meaningful semantics and explain the inner working of DNNs. b) Our methodology relies on path interventions and cause-effect relations, providing stable and consistent explanations. More specifically, we seek to answer questions such as: _would the model's prediction have been higher if we prevented the flow of signals through particular paths?_ or, _what would have been the decision of the model had we attenuated or removed an individual or a set of components at a particular layer?_. Our analysis will lead to locating and isolating relevant and necessary information strongly and causally connected to model prediction up to a test of significance. c) We apply our method to vision models trained to classify MNIST, CIFAR10, and ImageNet data. d) We provide a flexible framework that can be applied to complex architectures and other tasks beyond interpretations.

## 2 Related Work

Interpretability and Attribution Methods.Interpretability for deep neural networks aims to provide insights into black box models' behavior. A broad family of methods has been developed in the past few years. The most common techniques are attribution methods which assign scores to input features indicating the contribution of each one to the model prediction. Gradient-based methods [30, 26, 2, 33, 29, 27] propagate gradients of pre-trained models from output backward until input. Recent studies have pointed out that these methods produce noisy and unstable attributions [14, 1]. Perturbation-based methods [20, 32, 21] are alternatives that focus on correlations between local perturbations of raw inputs and model output. They are black-box methods in the sense that they don't require access to the inner state of the model. Beyond these widely used techniques, various interpretability methods have been proposed [36]. Close to our work is [35]. They suggest disentangling knowledge hidden in the internal structure of DNNs by learning a graphical model. Their work focuses on convolutional neural networks (CNNs), where they fit the activations between neighboring layers. Our approach differs in what it considers explanatory graphs and how it infers them. We rely on causal analyses, which have been recently considered as an effective tool for DNN interpretability and explainability. Our framework does not assume a specific type of neural network, which makes the approach generic and flexible.

Capturing Explanations with Causality.More recently, causal approaches have been considered for interpreting DNNs. The inner structure of DNN has been viewed, for the first time, as a structural causal model (SCM) in [7]. They use SCM to develop an attribution method that computes the causal effect of each input feature on the output of a recurrent neural network. Other causal approaches were specifically developed to explain NLP-based language models, such as causal mediation analyses [31] and causal abstraction [9]. In contrast, [25] have developed a model-agnostic approach (CXPlain) to estimate feature importance for model interpretations. They use a causal objective to train a separate supervised model (U-net) to learn causal explanations for another black-box model. An important limitation of this method is that it has to be trained to learn to explain the target model. Another point is that its causal property is limited to the extrinsic effect of input on causing a marginal change in output. Therefore, it cannot link explanations to the model's internal structure, which remains a black box.

## 3 Causal Graph Inference of Neural Networks

### Notation and Intuition

NotationWe denote by \(\mathbf{x}\) an input image (without loss of generality), and \(y\in\mathbb{R}^{n_{y}}\) its corresponding output label, where \(n_{y}\) is the number of classes. We also denote by \(\hat{y}\in\mathbb{R}^{n_{y}}\) its predicted output obtained by a pre-trained neural network \(N(L)\) composed of \(L\) layers. We define the relation \(l\to l+1\) to refer to directed edges or connections between hidden nodes of layers \(l\) and \(l+1\), respectively. At every hidden node \(j\) of the \(l\)-th layer, we define features or activation map \(a^{l}_{j}\). We denote by causal graph \(\mathcal{G}\) an abstraction of \(N(L)\) as shown in Fig.2 (b) and (d). We use the term explanatory graph to refer to causal graphs whose nodes hold important features.

IntuitionThe activated signals \(\mathbf{a}^{l}\) flow to the next layer \(l+1\) through weighted edges \(\mathbf{W}^{l\to l+1}\) connecting hidden nodes of layers \(l\) and \(l+1\). These weights control the strength of information flow between two layers in a manner physically analog to a switch. In physical systems, manipulating the state of a switch (e.g., on-off or via continuous interventions) would change the system's physical state, thereby providing an interpretation of its behavior. We set this intuition to motivate our work. To our knowledge, there is relatively little research on DNN explainability by manipulating weights.

### Problem Formulation

Our goal is to discover causal explanatory graphs of \(N(L)\) via path (equiv. weights) interventions. Formally, we set the problem as follows. Let \(\mathbf{W}^{l\to l+1}\in\mathbb{R}^{n_{c}\times n_{p}}\) be
the weight matrix of the directed edges from layer \(l\) to \(l+1\), where \(n_{p}\) is the number of parent nodes in \(l\) and \(n_{c}\) is the number of child nodes in \(l+1\). These nodes define a subgraph \(\mathcal{G}^{l\to l+1}\). Let \(\mathbf{w}^{l\to l+1}\in\mathbb{R}^{n_{t}\times n_{p}}\), be the paths connecting \(n_{p}\) nodes in \(l\) to \(n_{t}\) target nodes in \(l+1\) (\(n_{t}<n_{c}\)). Our problem is then to estimate how significant the causal or treatment effect \((TE)\) resulting from intervening on the weights \(w_{j}^{l\to l+1}\) at node \(j\):

\[\mathbf{P}\{TE(do(w_{j}^{l\to l+1});\hat{\mathbf{Y}},\mathbf{X},\mathbf{W}\setminus w_{j}^{l \to l+1})=0\}<\alpha, \tag{1}\]

where \(do(w_{j}^{l\to l+1})\) is a mathematical operation referring to the action of interventions. \(\mathbf{X}\) is a subset of inputs in the data manifold \(\mathbf{X}\), and \(\hat{\mathbf{Y}}\) are their predictions (pre-softmax layer). \(\alpha>0\) is a probability threshold (equiv. p-value) that measures "significance". The formula in (1) defines a form of hypothesis testing, where the null hypothesis states that interventions on the paths from node \(j\) will not affect or change the original predictions of the model \(\hat{\mathbf{Y}}\). This formula means rejecting the null hypothesis, and will lead us to identify the most influential nodes of \(l\) on \(\hat{\mathbf{Y}}\).

### Causal Inference

In this section, we provide the details of our methodology for solving (1). We focus on vision models which encompass a set of convolution and MLP layers. Specifically, we use LeNet [16] with MNIST data for ease of explanations. The experiments section shows applications on common datasets and more complex architectures. Here, we seek to capture the causal explanatory graph of LeNet given inputs of digit \(k\in\mathbb{N}_{9}\).

Treatment EffectsThe first step of our approach is to compute the effects of path interventions on model outputs. Let us consider the MLP example in Fig. 2 (a) and (c). The interventions on the paths in the last hidden layer \(L-1\) allow measuring the effect on the outputs (\(y_{1}\) and \(y_{2}\)) directly. Meanwhile, for layer \(L-2\), the effects of interventions are mediated by the responses of hidden neurons in descendant layers; in this example, the child layer \(L-1\). The strength of response to path interventions depends on the structure and complexity of neural networks. Our goal is thus to analyze how significant these effects are. First, we define the treatment effect as a measure of the difference corresponding to path interventions.

**Definition 1**: _(**Treatment Effect**) Let \(\mathbf{X}\) be a set of input features and \(\hat{\mathbf{Y}}\) the corresponding output of a neural network \(N(L)\). Let \(w_{j}^{l\to l+1}\in\mathbb{R}^{n_{t}}\) be the weights vector directed from node \(j\) in layer \(l\) to \(n_{t}\) nodes in layer \(l+1\). By holding all other weights \(\mathbf{W}\setminus(w_{j}^{l\to l+1})\) fixed and intervening on \(w_{j}^{l\to l+1}\) (i.e., \(do(w_{j}^{l\to l+1})\)), we define their effect as follows:_

\[\begin{split}& TE(do(w_{j}^{l\to l+1});\hat{\mathbf{Y}},\mathbf{X},\bm {W}\setminus w_{j}^{l\to l+1})=\\ &\hat{\mathbf{Y}}_{w_{j}^{l\to l+1}=u_{1}}(\mathbf{X})-\hat{\mathbf{Y}}_{w_{j }^{l\to l+1}=u_{0}}(\mathbf{X})\end{split} \tag{2}\]

where \(u_{1}\) and \(u_{0}\) are intervention variables defined below. Equation (2) measures the relative change of the outputs

Figure 1: **Features importance from different explanation methods on a hard example from ImageNet data.** The actual class is “white wolf”. The predicted class by the pre-trained ResNet18 is “Malamute”. To the right is our method showing top 2 semantics (top head and body of wrong class) from the causal graph that explain the prediction. Other methods either fail or provide noisy features.

Figure 2: **Causal connections within the last three layers of a neural network.** (a) and (c) Coloured paths (red/yellow) transpose signals between layers to labels \(y_{1}/y_{2}\), respectively. (b) and (d) Two abstract graphs are obtained by causal inference. In each graph, neutral neurons (marked by dots) hold variant information which don’t influence models’ behavior for the corresponding label.
distribution over the inputs \(\mathbf{X}\) given the same actions at node \(j\). By considering all the \(n_{p}\) nodes in layer \(l\), we obtain the set of distributions \(\{TE\}_{j=1,\dots,n_{p}}\). Fig. 3, shows samples of the average treatment effect obtained over \(\mathbf{X}\) when interventions correspond to removing edges in the hidden layers.

Test of SignificanceTo capture the most influential nodes in the parent layer \(l\), we consider hypothesis testing as formulated in eq. (1). We observe that the null distribution is approximately Gaussian, given the sufficiently large number of samples (in training sets). This makes the z-test an appropriate choice to solve the problem. We set the probability threshold \(\alpha\) to its common value \(0.05\). That means, the effect of intervening on the paths coming out from node \(j\) is significant when eq. (1) holds with \(5\%\) chance of error.

Path InterventionsFollowing the intuition of our work, we propose the interventions \(w_{j}^{l\to l+1}=u\) such that \(u=\beta w_{j}^{l\to l+1}\), where \(\beta\) can either be discrete (remove connections) or continuous (attenuate connection's effect). In the discrete case, \(\beta\) is binary so that \(u_{1}=0\) and \(u_{0}=w_{j}^{l\to l+1}\). In the continuous case, we propose to sample \(\beta\) from a uniform distribution \(\mathcal{U}(b-\epsilon,b+\epsilon)\), where \(\epsilon<b<1.0\) is a predefined parameter and \(\epsilon=0.01\). We use continuous interventions to evaluate the consistency of the causal effects and estimated graphs.

### Path Selection

So far, we explained how to solve (1) using \(w_{j}^{l\to l+1}\) for each parent node \(j\). These weights correspond to a subset of targets we identify here via path selection. Indeed, manipulating all possible connections for a node \(j\) given parent layer \(l\) is computationally expensive and intractable for complex architectures with many neurons. An efficient way is to pay attention to specific paths and nodes via selection criterion. We propose a top-down approach starting from a specific output (e.g., class). It implies sequential processing starting from the last layer until reaching layer \(l\). Let us consider we seek to compute the effects of path interventions of LeNet's layer \(L-2\) for digit \(3\) (as shown in Fig. 4).

We start with the paths directed from all nodes in the parent layer \((L-1)\) to node \(3\) of the output layer \(L\). Computing eq. (1) reveals the most relevant nodes in \((L-1)\), up to a significance test \(\alpha=5\%\). To identify the impact of these nodes on the model, we must look at the behavior of causal effects. Negative values explain a drop in class prediction when removing edges or amortizing weights, while positive values explain an improving prediction. Hence, the nodes revealed when the causal effect is significantly below zero are considered necessary for that output (the red ones in this example). In contrast, we discover noisy or distracting nodes when path interventions have a significant positive effect. We thereby select the necessary (red) nodes as targets for the next sub-graph \(\mathcal{G}^{L-2\to L-1}\). We repeat the same process on \(L-2\), but this time we simultaneously intervene on all paths directed from a parent node (green

Figure 4: Path selection.

Figure 3: **Heatmap of the Average Treatment Effect (ATE).** We show the effect of path interventions on the convolution and linear layers of LeNet architecture for digits \(3\), \(7\) and \(8\) respectively. Y-axis indicates the total number of nodes overall layers. For instance, conv1 has 6 nodes (channels) and the last hidden layer \(fc_{2}\) has 84 nodes. The colorbar indicates the relative ATE values w.r.t the original outputs.
node) to the targets. With this process, we can efficiently estimate relevant nodes in all intermediate layers while focusing on meaningful interventions. Algorithm 1 shows the implementation steps for discovering the causal explanatory graphs of a classification neural network. We provide some visualizations of LeNet's causal graphs in the supplementary.

```
Input:\(N(L)\) pre-trained DNN, \(\mathbf{W}\) weights, \(\mathbf{X}\) task-specific examples, \(\hat{\mathbf{Y}}\) model outputs, \((k)\) task index Output:\(\mathcal{G}\) (Dict. of important nodes and their relations), \(\mathcal{D}\) (Dict. of irrelevant nodes) \(l\gets L-1\), \(\beta\leftarrow\{0,1\}\) while\(l>0\)do \(n_{p}\gets dim(l)\) for\(j=1\) to \(n_{p}\)do \(u\leftarrow\beta w_{j}^{l-l+1}\) \(do(w_{j}^{l-l+1}=u)\)  Compute \(TE(do(w_{j}^{l-l+1}),\hat{\mathbf{Y}},\mathbf{X},\mathbf{W})\) for all \(\mathbf{X}\)  Solve (1) and get nodes \((J^{l},I^{l})\) \(\mathcal{G}^{l\to l+1}\gets J^{l}\), \(\mathcal{D}^{l\to l+1}\gets I^{l}\) endfor \(l\gets l-1\) endwhile
```

**Algorithm 1** Causal Explanatory Graph Inference (\(\mathcal{G}\)) of a DNN

## 4 Explanations from Causal Graphs

The hierarchical structure of the causal graphs enables robust extraction of attributions and high-level semantics. Instead of capturing a single saliency map from all activations, we rely on features response along the causal pathways. We empirically show that these features are more stable and consistent compared to traditional attribution methods. As reported in [14], the reason for these methods to produce noisy and unstable attributions is due to distracting features in DNNs. Our method can remove the features that negatively affect model's prediction, and isolate important neurons in causal graphs/sub-graphs. Formally, given the sub-graph \(\mathcal{G}^{l\to l+1}\), we extract salient interpretations (\(s_{i}^{l+1}\)) at a node \(i\) in \(l+1\) as follows

\[s_{i}^{l+1}=\frac{1}{J^{l}}\sum_{j=1}^{J^{l}}f(w_{ji}^{l\to l+1},a_{j}^{l}), \tag{3}\]

where \(a_{j}^{l}\) is the j-th activated signal of layer \(l\), \(J^{l}\) is the number of parent nodes in \(l\) connected to the child node \(i\) in the layer \(l+1\). The response \(f\) depends on the structure of the parent layer. For convolution layers, \(w_{ji}\) is a filter and \(f\) is a convolution function; whereas for MLPs, \(f\) is linear function. Fig. 5 shows causal sub-graphs, up to _conv2_ layer (for visualization), and the underlying attributions for a LeNet model successfully classified its input.

Note that eq. (3) aggregates at every node \(i\) the responses of its parent nodes to the filters/weights. We may also be interested in analyzing and interpreting the role of each filter between the pairs \((i,j)\). Fig. 6 is an example of the response to the top-1 filters (w.r.t. the amplitude of their causal effects) for a set of relevant nodes in the last convolution layer of ResNet18. Causal attributes (of object parts) are refined by extracting the response's local maxima (and minima).

## 5 Experiments

The experiments section splits into two parts: 1) we evaluate our algorithm's capacity to estimate stable and consistent causal graphs; 2) we evaluate the explanations captured by causal graphs and compare them to various attribution methods using standard explanation metrics.

Models and datasetsWe evaluate our method on the LeNet model trained on MNIST data and the following architectures: ResNet18 [11], ResNet50V2 [12], MobileNetV2 [24], and on the latest architecture ConvNext [18]; the tiny version. These models were trained on the large-scale ImageNet data (ILSVRC-2012) [23]. We also fine-tuned these architectures on CIFAR10 dataset after updating their last classification layer. We divide the validation sets into validation and test sets. We use the samples in validation sets to discover causal explanatory graphs and the test set for evaluating the explanations.

Comparison methodsWe selected the most popular attribution methods from two categories: model-agnostic (black-box) and gradient-based (white-box) methods. We chose RISE [20] and Occlusion [32] as black-box methods, and the following gradient-based methods: Integrated

Figure 5: **Illustration of LeNet’s causal sub-graphs \(\mathcal{G}^{input\to conv1},\mathcal{G}^{conv1\to conv2}\) for class \(3\). The resulted attributes provide visual interpretations for a sample image correctly classified by the model. They are up-sampled and normalized to reflect pixel-wise probabilities (Dark greens correspond to peaks with highest scores.).**
Gradient (IG) [30], Saliency [28], Gradient Shape [2], GradXIInput [26], DeconvNet [33] and Excitation Backprob (MWP) [34].

### Evaluating the Reliability of Causal Graphs

In this experiment, we evaluate the stability and consistency of our estimation of causal graphs. Since the causal effect is based on path interventions, we need to ensure consistency in the statistical test results no matter what intervention values are used (i.e., binary or continuous). We do so by running \(1000\) experiments with an intervention parameter randomly sampled from a uniform distribution \(\mathcal{U}(b-0.01,b+0.01)\). Here, \(b\) changes monotonically every \(10\) runs in the range \((0.01,0.5)\). We report reliability by measuring the frequency of detecting the same important nodes in each layer (in percentage). In Fig 7, we show for a few samples of \(\beta\) the distribution of the nodes versus their appearance rate. As we can see, the stability of the graph does not rely on the value chosen for the intervention parameter. Regardless of the value of \(\beta\), a considerable proportion (\(98\%\) to \(100\%\)) of the nodes appear in every experiment. The stability of causal graphs indicates two facts: (1) the importance of the activated signals, which are affected by weights attenuation. (2) our method is not sensitive to the choice of interventions (binary or continuous). Furthermore, the causal effect is significant even when reducing the strength of the signal along the causal path by only a factor of \(1/2\). These results ensure that the properties of single neurons might indeed be representative of model's behavior.

### Evaluation of causal explanations

The causal graphs estimated by our method summarize knowledge from all hidden layers in the DNN and enable better interpretability. For example, Fig.5 shows that for classifying digit \(3\), there exist \(8\) relevant nodes in the Conv2 layer, each encoding signal activated at different parts of the object. To compare the explanations obtained by our method with existing attribution methods, we aggregate attributions at the relevant nodes in a specific layer. Then, we evaluate the stability and faithfulness of explanations using standard state-of-the-art metrics. The evaluations are performed using the Quantus library [13]. Details on explanation metrics and attributions visualization are provided in the supplementary.

Stability:Stability measures consistency of explanations against local perturbations of inputs. Here, we adopt Lipschitz Estimate (LE) [1], which calculates the maximum variance between an input and its \(\epsilon\)-neighbourhood, where \(\epsilon\) refers to the level of perturbations. We generate perturbations by adding white noise to inputs from the test sets. We compute explanations for every input in specific class and its noisy sample using the graphs estimated from the validation data. The maximum euclidean distance between explanations is then obtained over multiple runs where new perturbations are generated. Fig. 8 reports the results for LeNet trained on MNIST and ResNet18 fine-tuned on CIFAR10, and Fig.9 shows the results for four different architectures trained on ImageNet data.

The results (in Fig. 8 and 9) clearly indicate that the explanations generated from the causal graphs are more stable and consistent compared to other attribution methods. The explanations generated by these methods show higher variance to perturbations depending on the dataset and model. In contrast, the explanation from causal graph show consistent stability. Our method has the lowest variance with significant margin compared to the best method in each experiment.

Faithfulness:Evaluating attributions relevance for the decision obtained by the model is essential to ensure correctness and fidelity of explanations. This is commonly done by measuring the effect of obscuring or removing features from the input on model's prediction. Different techniques have been proposed to score the relevance of explanations [5, 1, 3, 4, 22]. Here, we used iterative removal of

Figure 6: **Visualizing explanations obtained by the top-1 causal filters.** We show four examples for two object classes (from ImageNet). Important neurons belong to the causal sub-graph connecting the last Conv layers \(l=layer4.1.conv1\) and \(l+1=layer4.1.conv2\) of ResNet18. We can observe consistent attributes for similar inputs. The red point indicates the location of the peaks corresponding to the absolute maximum response.
features (IROF) [22]. An image is partitioned into patches using superpixel segmentation. The patches are sorted by their mean importance w.r.t the attributions in each patch. At every iteration, an increasing number of patches with highest relevance are replaced by their mean value. The IROC computes the mean area above the curve for the class probabilities (perturbed vs. original predictions). We applied this metric to evaluate each explanation method including ours. Fig. 8) shows that our method outperforms other methods and is comparable to MWP [34] (with a relatively small margin between their medians). For ResNet18 trained on CIFAR10, most attribution methods show higher scores than LeNet on MNIST. Furthermore, the explanations obtained by our method and MWP show less sensitivity to the different data and models, indicating better trustworthiness. Fig. 9 shows IROF results for different architectures trained on ImageNet. On ImageNet, all methods, including ours, agree on the differences in behavior between the four models and that ConvNeXt is more trustable than standard ConvNets. For interested readers, we refer to [18] for further details about the core design of the ConvNeXt family of architectures.

Figure 8: **Quantitative evaluations of attribution methods for LeNet on MNIST and ResNet18 on CIFAR10. For each metric, we compare 7 attribution methods to the causal explanations obtained by our method using test images. The bars show mean and variance over samples. Lower Lipschitz Estimates (w.r.t. means) indicate higher stability. Higher IROF values (w.r.t. means) indicate strong relation between explanations and predictions.**

Figure 7: **Reliability assessment of causal graphs. We show results on four complex architectures. On the x-axis, we show the frequency of appearance of a node (%). On the y-axis is the portion of all the nodes appearing at least once during the experiments (%).**

Figure 9: **Quantitative evaluations of explanations for complex architectures on ImageNet. We evaluate 9 methods including ours using 10 representative classes from the test set.**
### Fidelity of class-specific causal neurons

The causal neurons discovered as critical (or relevant) through interventions should accurately describe model behavior. We evaluate this by measuring the model accuracy on a specific class when masking out the critical neurons connected to this class. That means high-fidelity neurons should cause a drastic drop in accuracy under discarding them. We illustrate this behavior on four models trained on ImageNet in Fig. 10. First, after discovering class-specific causal graphs, we rank the weights (and filters) in each sub-graph according to their highest effects (as described in eq. (2)). Then, we use these ranks to select the top-k critical neurons in each layer. As we observe in Fig. 10, the accuracy of all four models drastically drops after masking a small portion (\(<20\%\)) of top critical neurons, and it is more evident on smaller architectures such as ResNet18 and MobileNetV2. In addition, these results describe another way of evaluating faithfulness since critical neurons encode the important features for predicting a specific class.

## 6 Applications

Repairing model accuracyIn many practical, real-world cases, we seek fast and effective ways to repair the model's behavior without requiring extensive retraining with large datasets. We can target the proposed explanation method to achieve this goal. Each causal explanatory graph measures the neurons' contributions to a specific class (or task) by intervening on the weights connecting the neurons to the class. More specifically, amortizing the strength of activation signals passing through particular paths that cause a drop in the model's performance or a wrong prediction. It is worth noting that this operation differs from model pruning since we only block these paths at inference time. Practically, we do this by masking out irrelevant weights (and filters for convolutional layers). The experiments show that our method can improve class prediction and correct wrong predictions. To illustrate these facts, we took the four models trained on ImageNet and considered 10 representative (animal) classes for evaluation in addition to the LeNet trained oon MNIST data. For each trained model, we select to mask out a portion of the irrelevant weights discovered by our method and evaluate how they perform on these samples. Figs 11 shows test accuracy under a varying portion of the masked weights in all layers.

## 7 Conclusion and discussions

We have presented a novel method for interpreting neural network behavior based on causal inference. It estimates the causal explanatory graphs that disentangle relevant knowledge hidden in the internal structure of DNNs, which is congenital to their predictions. Our methodology tests the hypothesis that path interventions for a parent neuron connected with target neurons in the subsequent layer will significantly affect the model's output. As a case study, we applied our method to vision models for object classification. The responses of causal filters are used to compare our approach to attribution methods quantitatively. This work is not aimed at extracting high-level abstractions that are interpretable to humans, which might be considered a limitation of our method. However, we seek to understand the inner working of the model and therefore provide a valuable tool for model monitoring and repair. We show that our method can be used to improve and fix the model without retraining, which makes it worthwhile and practical for real-world cases where extensive training data are not accessible, or retraining is computationally expensive. In future work, we will consider investigating further applications of our method. For instance, class-specific important neurons can be used with regularization methods in continual and few-shot learning. Our method's computational cost is rea

Figure 11: **Regular of model performance. We show the test accuracy after masking out (\(n\%\)) of class-specific noisy filters in LeNet model for all categories of MNIST data (right), and in the 4 models for 10 representative (animal) categories of ImageNet data (left). Each color in left figure points to one different category and is fixed for each model.**

Figure 10: **Fidelity of class-specific causal neurons to the model. The left figure shows the test accuracy of four models when masking out the top-k (\(\%\)) portion of causal neurons discovered as critical using our path interventions method. The figure shows the average accuracy over ten representative classes selected from ImageNet. The right figure shows the absolute number of critical neurons at each portion.**
sonable, as shown in the supplementary, which facilitates its integration into other processes. The critical limitations of neuron importance methods are their high computational costs and sensitivity to superior correlations between neurons [10]. Relying on causal inference and path interventions allows for mitigating these limitations and provides robust interpretations.
