Revealing Model Biases: Assessing Deep Neural Networks via Recovered
  Sample Analysis
This paper proposes a straightforward and cost-effective approach to assess
whether a deep neural network (DNN) relies on the primary concepts of training
samples or simply learns discriminative, yet simple and irrelevant features
that can differentiate between classes. The paper highlights that DNNs, as
discriminative classifiers, often find the simplest features to discriminate
between classes, leading to a potential bias towards irrelevant features and
sometimes missing generalization. While a generalization test is one way to
evaluate a trained model's performance, it can be costly and may not cover all
scenarios to ensure that the model has learned the primary concepts.
Furthermore, even after conducting a generalization test, identifying bias in
the model may not be possible. Here, the paper proposes a method that involves
recovering samples from the parameters of the trained model and analyzing the
reconstruction quality. We believe that if the model's weights are optimized to
discriminate based on some features, these features will be reflected in the
reconstructed samples. If the recovered samples contain the primary concepts of
the training data, it can be concluded that the model has learned the essential
and determining features. On the other hand, if the recovered samples contain
irrelevant features, it can be concluded that the model is biased towards these
features. The proposed method does not require any test or generalization
samples, only the parameters of the trained model and the training data that
lie on the margin. Our experiments demonstrate that the proposed method can
determine whether the model has learned the desired features of the training
data. The paper highlights that our understanding of how these models work is
limited, and the proposed approach addresses this issue.
Mohammad Mahdi Mehmanchi, Mahbod Nouri, Mohammad Sabokrou
# Revealing Model Biases: Assessing Deep Neural Networks via Recovered Sample Analysis

###### Abstract

This paper proposes a straightforward and cost-effective approach to assess whether a deep neural network (DNN) relies on the primary concepts of training samples or simply learns discriminative, yet simple and irrelevant features that can differentiate between classes. The paper highlights that DNNs, as discriminative classifiers, often find the simplest features to discriminate between classes, leading to a potential bias towards irrelevant features and sometimes missing generalization. While a generalization test is one way to evaluate a trained model's performance, it can be costly and may not cover all scenarios to ensure that the model has learned the primary concepts. Furthermore, even after conducting a generalization test, identifying bias in the model may not be possible. Here, the paper proposes a method that involves recovering samples from the parameters of the trained model and analyzing the reconstruction quality. We believe that if the model's weights are optimized to discriminate based on some features, these features will be reflected in the reconstructed samples. If the recovered samples contain the primary concepts of the training data, it can be concluded that the model has learned the essential and determining features. On the other hand, if the recovered samples contain irrelevant features, it can be concluded that the model is biased towards these features. The proposed method does not require any test or generalization samples, only the parameters of the trained model and the training data that lie on the margin. Our experiments demonstrate that the proposed method can determine whether the model has learned the desired features of the training data. The paper highlights that our understanding of how these models work is limited, and the proposed approach addresses this issue.

## 1 Introduction

Deep Neural Networks (DNNs) have become a ubiquitous approach in various fields, including computer vision (Chai et al. (2021); Voulodimos et al. (2018)), natural language processing (Deng and Liu (2018)), and speech recognition (Nassif et al. (2019)), among others. Despite their impressive performance, the internal workings of these models are often considered a black box, and understanding their decision-making process is a challenging problem. Interpreting how DNNs are working can
be crucial in many applications, such as medical diagnosis or autonomous driving, where the model's decisions need to be explainable. Several studies have indicated that DNNs possess significant weaknesses, including susceptibility to distribution shifts (Sugiyama and Kawanabe (2012)), lack of interpretability (Chakraborty et al. (2017)), and insufficient robustness (Szegedy et al. (2013)).

Moreover, it has been widely investigated that DNNs, as discriminative models, attempt to identify simple yet effective features that distinguish between different classes (Shah et al. (2020)). For instance, a model that discriminates based on color or texture may not necessarily learn the underlying shape. Furthermore, studies have shown that such DNNs often exhibit bias towards background featuresMoayeri et al. (2022)). Consequently, if there are irrelevant or biased concepts that assist the model in discriminating its training samples, the model may become overly reliant on them. Therefore, a fundamental and crucial inquiry to pose is _whether a DNN has learned the primary concepts of the training data or simply memorized irrelevant features to make predictions._

Perhaps, the most natural way to answer this question is to evaluate the test error of the model and also check the model's generalization. However, in many cases, we do not have access to test data, and we can only use the trained model to evaluate its performance. Moreover, this approach does not correspond to all key properties of the model such as robustness. Besides, evaluating the model on test data and also checking the model's robustness against a wide range of OOD samples is timely and computationally expensive. As a result, various works have been done to examine this question. For instance, a recent line of work (Morwani et al. (2023); Addepalli et al. (2022a)) has focused on simplicity biases and ways to mitigate it.

In a nutshell, this paper attempts to answer the question of whether trained models grasp the core concepts of their training data or merely memorize biased or irrelevant features that facilitate discrimination. The primary assumption is that no testing data is available.

The main intuition is that after training, the model's learned knowledge is likely distilled in the parameters of the model (i.e., weights of a DNN). Accordingly, if we attempt to extract the information that the model has learned, its knowledge, specifically which features it has learned, should be reflected in the extracted information derived from the weights. This paper proposes a cost-effective approach to evaluate the model's performance by reconstructing samples from the trained model's weights and analyzing the quality of the reconstructed samples.

We discuss that the reconstructed samples will contain features that the model's weights have been optimized to discriminate based on. In other words, if the model has learned to differentiate between classes based on certain features, these features will be reflected in the reconstructed samples. Therefore, if the reconstructed samples contain the primary concepts of the training data, it can be concluded that the model has learned the essential and determining features. On the other hand, if the model fails to generate an accurate reconstruction of the main concepts of its training inputs, it can be concluded that the model has been biased toward some irrelevant features. The parameters of the trained model and the training data that lie on the margin, are all that are necessary to apply our approach. We leverage the SSIM metric (Wang et al. (2004)) to evaluate the image's quality and demonstrate that it provides an effective means of assessing the model's performance when handling intricate data and learning intricate features. However, for simplistic data sets such as MNIST, it is essential to have human supervision to evaluate the model's efficacy.

The main contributions of this paper are:

* We propose a novel and powerful approach, that enables us to accurately evaluate model biases, assessing whether the model learns discriminative yet simple and irrelevant features, or grasps the fundamental concepts of the training data solely by utilizing trained models and training data, without requiring any test or validation data.
* We design a comprehensive set of experiments with varying levels of bias complexity to analyze the behavior of the model during training. Interestingly, we observed that in the presence of challenging biases we intentionally crafted, the model focused more on learning the main concept. However, when faced with simpler biases, the model tended to converge quickly and ceased to learn further.
Related work

The concept of reconstructing training samples from trained DNN parameters has been previously explored by Haim et al. (2022). Their work revealed a privacy concern by demonstrating that a significant portion of the actual training samples could be reconstructed from a trained neural network classifier. Our proposed method is inspired by these findings but focuses on assessing the learned features from reconstructed samples to infer potential biases and discriminatory features that might not have been captured by the training process.

Another significant contribution to understanding the theoretical properties of DNNs is the introduction of the Heavy-Tailed Self-Regularization (HT-SR) theory by Martin and Mahoney (2020). This theory suggests a connection between the weight matrix correlations in DNNs and heavy-tailed random matrix theory, providing a metric for predicting test accuracies across different architectures. Taking this concept further, Martin et al. (2021) showcased the effectiveness of power-law-based metrics derived from the HT-SR theory in predicting properties of pre-trained neural networks, even when training or testing data is unavailable. Addepalli et al. (2022) investigated the relationship between simplicity bias and brutleness of DNNs, proposing the Feature Reconstruction Regularizer (FRR) to encourage the use of more diverse features in classification. In a related effort to identify maliciously tampered data in pretrained models, Wang et al. (2020) studied the detection of Trojan networks, focusing on data-scarce conditions. While their work emphasizes detecting adversarial attacks and preserving privacy, our proposed method concentrates on identifying biases in learned features and assessing the quality of pre-trained models.

In another line of research, Li and Xu (2021) introduced a method to discover the unknown biased attribute of an image classifier based on hyperplanes in the generative model's latent space. Their goal was to help human experts uncover unnoticeable biased attributes in object and scene classifiers. Kleyko et al. (2020) developed a theory for one-layer perceptrons to predict the performance of neural networks in various classification tasks. This theory was based on Gaussian statistics and provided a framework to count classification accuracies for different classes by investigating the mean vector and covariance matrix of the postsynaptic sums. Similarly, Untrinheer et al. (2020) proposed a formal setting that demonstrated the ability to predict DNN accuracy by solely examining the weights of trained networks without evaluating them on input data. Their results showed that simple statistics of the weights could rank networks by their performance, even across different datasets and architectures. A practical framework called ContRE Wu et al. (2021) was proposed which used contrastive examples to estimate generalization performance. This framework followed the assumption that robust DNN models with good generalization performance could extract consistent features and make consistent predictions from the same image under varying data transformations. By examining classification errors and Fisher ratios on generated contrastive examples, ContRE assessed and analyzed the generalization performance of DNN models in complement with a testing set.

In conclusion, our approach draws inspiration from various prior work on understanding and analyzing deep neural network properties, focusing primarily on identifying biases in the learned features and their relevance to the primary concepts of the training data. We believe that our work not only enhances our understanding of the underlying mechanisms of these models but also contributes to improving their generalization and robustness.

## 3 Preliminaries

**Notation**: In this section, we introduce the necessary notations for understanding the reconstruction algorithm. We show the set \(\{1,2,...,n\}\) with \([n]\). Let \(S=\{(x_{i},y_{i})\}_{i=1}^{n}\subseteq\mathbb{R}^{d}\times\{-1,1\}\) denotes a binary classification training dataset where \(n\) is the number of training samples and \(d\) stands for the number features in each sample. Moreover, let \(f_{\theta}:\mathbb{R}^{d}\rightarrow\mathbb{R}\) be a neural network with weights \(\theta\) where \(\theta\ \in\mathbb{R}^{p}\) and \(p\) denotes the number of weights. We show the training loss function with \(\ell:\mathbb{R}\rightarrow\mathbb{R}\) and the empirical loss on the dataset \(S\) with \(L(\theta)=\sum\limits_{i=1}^{n}\ell(y_{i}f_{\theta}(x_{i}))\).

**Reconstruction scheme**: We use the proposed method in Haim et al. (2022) to reconstruct the training data. Here, we provide the details of their method:

Suppose that \(f_{\theta}\) is a homogeneous ReLU neural network and we aim to minimize the binary cross entropy loss function over the dataset \(S\) using gradient flow. Moreover, assume that there is some time
\(t_{0}\) such that \(L(\theta(t_{0}))<1\). Then, as it showed by (Lyu and Li (2019)), the gradient flow converges in direction to a first order KKT point of the following max-margin problem:

\[\min_{\theta}\frac{1}{2}||\theta||^{2}\qquad s.t.\qquad\forall i\in[n]\quad y_{i }f_{\theta}(x_{i})\geq 1 \tag{1}\]

So, if gradient flow converges in direction to \(\theta^{*}\), then there exists \(\lambda_{1},...,\lambda_{n}\in\mathbb{R}\) such that:

\[\theta^{*}=\sum_{i=1}^{n}\lambda_{i}y_{i}\nabla_{\theta}f_{\theta^{*}}(x_{i}) \tag{2}\]

\[\forall i\in[n]\quad y_{i}f_{\theta^{*}}(x_{i})\geq 1 \tag{3}\]

\[\forall i\in[n]\quad\lambda_{i}\geq 0 \tag{4}\]

\[\forall i\in[n]\quad\lambda_{i}=0\quad if\quad y_{i}f_{\theta^{*}}(x_{i})\neq 1 \tag{5}\]

Now, by having a trained neural network with weights \(\theta^{*}\), we wish to reconstruct \(m\) training samples. We manually set \(y_{1:\frac{n}{2}}=-1\) and \(y_{\frac{n}{2}:m}=1\) The reconstruction loss function is then defined based on the equations 2 and 4 as follows:

\[L_{reconstruction}=\alpha_{1}||\theta^{*}-\sum_{i=1}^{m}\lambda_{i}y_{i} \nabla_{\theta}f_{\theta^{*}}(x_{i})||_{2}^{2}+\alpha_{2}\sum_{i=1}^{m}max \{-\lambda_{i},0\}+\alpha_{3}L_{prior}, \tag{6}\]

where \(L_{prior}\) is defined for image datasets as \(L_{prior}=max\{z-1,0\}+max\{-z-1,0\}\) for each pixel \(z\) to penalize the pixel values outside the range \([-1,1]\). By minimizing the equation 6 with respect to \(x_{i}^{\prime}s\) and \(\lambda_{i}^{\prime}s\) we can reconstruct the training data that lie on the margin.

## 4 Proposed method

As mentioned earlier, the main motivation of this paper is to answer the question "whether a trained neural network has learned the intended concepts of the training data or not" without accessing to test data. To answer this question, we propose a simple cost-efficient idea. Our idea is based on the intuitive hypothesis that the knowledge acquired by a model \(\mathcal{M}\) during training, even if the model has learned biased or irrelevant features, is encoded in the model's weights. So, by extracting the network's learned knowledge we can discover whether the model has learned the important concepts of training data, e.g. objects, or not. Specifically, suppose that the weights \(\mathcal{W}\) of model \(\mathcal{M}\) is trained on dataset \(\mathcal{X}\). We denote the optimized weights by \(\mathcal{W}^{*}\). Therefore, we expect the learned and utilized knowledge by the model to be distilled in \(\mathcal{W}^{*}\). We recover the learned knowledge of the model in the Recovery module \(\mathcal{R}(\mathcal{W})\) by reconstructing training data from \(\mathcal{W}^{*}\). Then, we compare the reconstructed samples to the original training data, and if the primary features of training data are reconstructed well, then we conclude that the network has learned the primary features of training data. A schematic of our proposed framework is shown in Figure 1. One way to evaluate the reconstructed data is human supervision. Moreover, we leverage the SSIM metric (Wang et al. (2004)) and introduce a Score function \(\mathcal{S}(\mathcal{M},X,\mathcal{W}^{*})\) for comparing the reconstructed samples with training data. The details of our score function are provided in section 4.3.

Now suppose we introduce different biases of varying degrees to our dataset, represented by \(\mathcal{T}_{i}\) which convert \(X\) to \(X_{\mathcal{T}_{i}}\) (see section 4.1). For a simple bias \(\mathcal{T}_{1}\), the model \(\mathcal{M}_{1}\) first attempts to learn this bias and subsequently ceases training after identifying it. As a result, \(\mathcal{M}_{1}\) would not learn the primary features of training data. On the other hand, if model \(\mathcal{M}_{2}\) is trained on a harder bias \(\mathcal{T}_{2}\), which is harder for the network to learn it, \(\mathcal{M}_{2}\) can learn the primary features of training data to some extent. So we should have:

\[\mathcal{S}(\mathcal{M}_{1},X_{\mathcal{T}_{1}},\mathcal{W}^{*}{}_{1})\leq \mathcal{S}(\mathcal{M}_{2},X_{\mathcal{T}_{2}},\mathcal{W}^{*}{}_{2}). \tag{7}\]

More generally, suppose that N models \(\mathcal{M}_{1}\)... \(\mathcal{M}_{N}\) are trained on N datasets \(X_{\mathcal{T}_{1}}\)... \(X_{\mathcal{T}_{N}}\) where each \(X_{\mathcal{T}_{i}}\) is a biased version of the base dataset \(X\). Now for every i,j \(\in[N]\), if we have :

\[\mathcal{S}(\mathcal{M}_{i},X_{\mathcal{T}_{i}},\mathcal{W}_{i})<\mathcal{S}( \mathcal{M}_{j},X_{\mathcal{T}_{j}},\mathcal{W}_{j}), \tag{8}\]
then probably the model \(\mathcal{M}_{j}\) is a better model in terms of learning the main concepts of the training data and thus have a better generalization.

### \(\mathcal{T}\) Designing different levels of bias

To investigate the primary question of this paper, we manually add a small square trigger to the images. This trigger affects the network's performance, and we can identify how the network's performance relates to the reconstructed samples. Suppose that we have a base dataset \(X\), e.g, CIFAR10. We add the trigger in three different levels of difficulty: Level One: the trigger is placed in the top left corner of the images of \(X\), which is the easiest trigger for the network to detect, to obtain \(X_{\mathcal{T}_{1}}\). Level Two: we randomly select three different positions for each class (six positions total), and for each image of \(X\), we place the square trigger in one of the chosen positions to obtain \(X_{\mathcal{T}_{2}}\). This trigger is harder to detect due to the position of the triggers being randomized. Level Three: we randomly select five different positions for each class (ten positions total), and for each image of \(X\), we place the square trigger in one of the selected positions to obtain \(X_{\mathcal{T}_{3}}\). This level of trigger is the most difficult to detect. By training a neural network on each of the obtained datasets \(X_{\mathcal{T}_{1}}\), \(X_{\mathcal{T}_{2}}\), and \(X_{\mathcal{T}_{3}}\), we obtain three different models \(\mathcal{M}_{1},\mathcal{M}_{2},\) and \(\mathcal{M}_{3}\) as well as a model \(\mathcal{M}_{base}\) trained on the base dataset \(X\) without any changes.

### \(\mathcal{R}\) Knowledge recovery module

For a trained neural network with optimized weights \(W^{*}\), the output of \(\mathcal{R}(\mathcal{W}^{*})\) is the reconstructed training data from the optimized weights. We use the proposed method in (Haim et al. (2022)) for reconstructing the training data. See section 3 for the details of the reconstruction algorithm. It is important to note that the reconstruction algorithm proposed in this research has both theoretical and practical limitations. On the theory side, the trained neural network should be a homogeneous ReLU network that minimizes the cross entropy loss function over a binary classification problem while achieving zero training error. On the practical side, the method has only been shown to work on small training data and is not well-suited for use with CNNs.

### \(\mathcal{S}\) Score function

Suppose that a neural network \(\mathcal{M}\) is trained on dataset \(X\) with \(n\) training samples to obtain the optimal weights \(W^{*}\). Moreover, assume that we have reconstructed \(m\) training samples where \(m>n\). As proposed in (Haim et al. (2022)), first the reconstructed images are scaled to fit into the range

Figure 1: An overview of our proposed method. Our methodology involves training several neural networks on both biased and unbiased datasets, resulting in different models. Next, we extract the learned knowledge of each model from the weights of the trained network and determine if the models have captured the primary concepts of the training data by evaluating this knowledge.
\([0,1]\). Then for each training sample, the distance of that training sample from all reconstructed samples is computed. By computing the mean of the closest reconstructed samples to each training data, pairs of (training image, reconstructed image) are formed. Finally, the SSIM score is computed for each pair and the pairs are sorted based on their SSIM score (in descending order).

Now, we put all sorted pairs in set \(P=\{(I_{1},I_{1}^{\prime}),(I_{2},I_{2}^{\prime}),...,(I_{n},I_{n}^{\prime})\}\) where each \(I_{i}\) shows a training image, each \(I_{i}^{\prime}\) denotes a reconstructed image, and \((I_{1},I_{1}^{\prime})\) and \((I_{n},I_{n}^{\prime})\) have the highest and lowest SSIM scores, respectively. We define the Score function \(\mathcal{S}(\mathcal{M},X,\mathcal{W}^{*})\) as

\[\mathcal{S}(\mathcal{M},X,\mathcal{W}^{*})=\frac{1}{k}\sum_{i=1}^{k}SSIM(I_{i},I_{i}^{\prime}), \tag{9}\]

where \(k\in[n]\). While in the above formulation, we used the entire training data \(\{I_{1},...,I_{n}\}\), we can only use the training data that lie on the margin because the reconstruction algorithm can only reconstruct the training data that lie on the margin.

## 5 Experiment results

In this section, we conducted a comprehensive experiment to evaluate the validity of the proposed idea. The results intriguingly confirm that the idea effectively works. It is worth mentioning that, due to current limitations in the used data reconstruction method, we were only able to evaluate our method on low-resolution datasets (see also section 4.2). However, our primary objective was to demonstrate the validity of the idea rather than achieving optimal performance. Furthermore, we couldn't find any existing work that addresses the same tasks as our paper, making direct comparisons challenging. Therefore, we provide a thorough analysis on various datasets to showcase the validity of our idea.

### Experimental setup

For our experiments, we utilize MNIST Deng (2012) and CIFAR10 Krizhevsky et al. (2009) datasets and convert both into binary classification problems - odd/even for MNIST and vehicles/animals for CIFAR10. We employ a fully connected ReLU neural network with architecture (d-1000-1000-1) where d refers to the input dimension. We only add bias terms to the first network layer to maintain homogeneity. The experiments in section 5.2 are done with 500 training images (250 images for each class). All other experiments are dome with 100 training images (50 images for each class). We use the hyperparameters suggested in Haim et al. (2022) for each dataset. Similarly, in all experiments, the number of reconstructed samples is set to twice that of the training samples. However, we also run a hyperparameter search to make sure that the suggested hyperparameters are suitable for different experiments. In all experiments, the training error reaches zero and we continue training the network until it reaches the training loss of less than 1e-5. We compute test errors leveraging the standard MNIST and CIFAR10 test images in all experiments. While we change the training images for different experiments, we keep the test data constant throughout. As we discussed in section 4.3, we use the average SSIM values of best \(k\) reconstructed images as our score function to evaluate the reconstructed images' quality. In all experiments, we set k = 10 since most of the reconstructed images are of poor quality and are thus unsuitable for evaluating the reconstruction's quality. We use the average SSIM of the best 10 reconstructed images to assess the quality of the reconstruction (recovery) module. We do not use the average SSIM of all reconstructed images as most of the reconstructed images have poorer quality, with only a few having good quality.

### Evaluating the recovery module performance

First, we examine the results obtained by Haim et al. (2022) to validate that their reconstruction scheme reconstructs discriminative features with better quality. The best reconstructed samples for MNIST and CIFAR10 are shown in Figures 2 and 3 respectively, and the average of the best 10 SSIMs are reported in table 2. Both figures clearly indicate that the primary objects in each dataset - the digits in MNIST and the animals/vehicles in CIFAR10 - are reconstructed with significantly higher quality than the background pixels. Furthermore, according to Table 2, the reconstruction quality of CIFAR10 images is significantly better than that of MNIST images. This is likely due to the fact that the neural network must learn more complex features in order to classify the CIFAR10
images, resulting in the reconstruction algorithm being able to reconstruct more pixels and achieving a higher SSIM score.

### Cifar10

#### 5.3.1 Different levels of bias

As we discussed in section 4.1, we design different datasets from a base dataset \(X\) to obtain different trained models \(\mathcal{M}_{1},\mathcal{M}_{2},\) and \(\mathcal{M}_{3}\). For CIFAR10 as the base dataset, we set the pixel values of square triggers to 0 for the vehicle class and 1 for the animal class. Figure 5 shows the reconstructed samples recovered from each model \(\mathcal{M}_{i}\) as well as the base model \(\mathcal{M}_{base}\). It is evident from this figure that the reconstructed samples for the first level of difficulty (model \(\mathcal{M}_{1}\)) have poor quality as the main objects in the images (vehicles or animals) are not reconstructed well. This suggests that model \(\mathcal{M}_{1}\) has not learned the primary objects (vehicles and animals) in the dataset and has poor generalization. Conversely, the reconstructed samples for the two other levels of difficulty are of reasonable quality, indicating that the model has learned the main objects in the dataset. Our hypothesis is confirmed in Figure 6, which clearly demonstrates a direct relationship between the model's ability to learn the main concepts of the training data, measured by test accuracy, and the quality of reconstructed samples, measured by the average SSIM value of the best 10 reconstructed samples. An interesting finding from Figures 5 and 6 is that both models \(\mathcal{M}_{2}\) and \(\mathcal{M}_{3}\) have better test accuracy and better mean SSIM score than the base model \(\mathcal{M}_{base}\). This suggests that adding biases that are hard to detect, may improve the model's performance.

#### 5.3.2 Contrast changing

Now, instead of adding triggers to the images, we change the contrast factor of the images. We perform this experiment because this situation is closer to actual real-world biased images. We set the contrast factor for vehicles class and animals to 0.5 and 2, respectively. We obtained a test accuracy of

\begin{table}
\begin{tabular}{l l l} \hline Dataset & Test accuracy & Mean best 10 SSIMs \\ \hline MNIST & 0.898 & 0.1862 \\ CIFAR10 & 0.771 & 0.5182 \\ \hline \end{tabular}
\end{table}
Table 1: Test accuracy of the neural network trained on 500 MNIST/CIFAR10 images for a binary classification task as well as the average SSIM of best 10 reconstructed images from the weights of trained neural network.

Figure 3: Top 30 reconstructed samples from MNIST dataset. Odd rows show reconstructed samples and even rows show the corresponding training sample. The neural network was trained on 500 MNIST images. It is obvious from the figure that the background pixels did not reconstruct well.

Figure 2: Top 30 reconstructed samples from CIFAR10 dataset. Odd rows show reconstructed samples and even rows show the corresponding training sample. The neural network was trained on 500 CIFAR10 images.
0.691, which indicates that adjusting the contrast of classes does not have a significant negative impact on the model's performance. Since the model has a good performance, we expect to reconstruct the main objects of the training set. In Figure 4, the top 30 reconstructed samples are shown, and it is clear that the main objects are reconstructed well in this experiment. The average SSIM of the best 10 reconstructed samples is 0.5774 for this experiment. If we compare this experiment with the previous experiments in 5.3.1, we notice that these experiments also confirm 8.

### Mnist

Similar to the previous part, we introduce three different difficulty levels of bias to MNIST images. The relationship between the quality of reconstructed samples and test accuracy is shown in Figure 7. As it is evident from this figure, for the model with the lowest test accuracy, we also obtain the lowest reconstruction quality. However, for other models, it is difficult to validate equation 8 because the accuracy of these models is very close to each other. It is important to note that for the MNIST dataset, the SSIM metric is not a good representative of the model's performance. This is because, in the MNIST images, a large portion of the pixels are background pixels. So, if the reconstruction algorithm recovers the digits well and has a good performance, it cannot reconstruct the background pixels well and thus yields to poor SSIM score. See table 2. This experiment clearly shows that the SSIM metric (or other image quality metrics) cannot reveal the model's performance in all datasets. However, in complicated and real-world datasets, where the model needs to learn more complex features to classify correctly, the SSIM metric can be a good representative of the model's performance.

To support our results, we have provided more experiments in the Appendix.

## 6 Discussion and limitations

Our proposed method is primarily based on the reconstruction scheme proposed by Haim et al. (2022). Consequently, the limitations of their work also apply to our approach. So, our method works only for fully connected homogeneous ReLU neural networks for binary classification tasks. However, Haim et al. showed that their reconstruction algorithm also works for non-homogeneous ReLU neural

Figure 4: Top 30 reconstructed samples from CIFAR10 dataset with changed contrast. The neural network was trained on 100 CIFAR10 images with changed contrast. The contrast factor is set to 0.5 and 2 for the vehicles class and animals class, respectively.

Figure 5: Top 30 reconstructed samples for different models trained on CIFAR10 dataset with different bias levels. See section 4.1 for the details of each model.
networks. Another limitation is that we cannot use our method for networks that are trained on large datasets. To circumvent these limitations, we need to modify the proposed reconstruction algorithm in this research.

Another limitation of our work is that we need to have access to training data that lie on the margin to compute our reconstruction score. This limitation can be removed in two ways: First, as we have shown in our experiments, human visualization is also a good way to evaluate the quality of reconstructed samples. However, if we want a complete machinery process without the assistance of humans, it may be applicable to use non-reference-based image quality metrics to evaluate the quality of reconstruction images.

## 7 Conclusion

In this paper, we proposed a simple method for discovering if a neural network has learned the primary concepts of the training data, such as digits in MNIST images and vehicles/animals in CIFAR10 images. Our method consists of an extraction phase that uses the reconstruction scheme introduced by citethaim2022reconstructing. We demonstrated that by extracting the learned knowledge of the network, we can assess how well the model has learned the intended attributes of the training data.

Figure 6: Comparison of different models test accuracy and their reconstruction performance on CIFAR10. \(\mathcal{M}_{base}\): trained model on original CIFAR10 images. \(\mathcal{M}_{1}\): trained model on CIFAR10 images with level one bias difficulty. \(\mathcal{M}_{2}\): trained model on CIFAR10 images with level two bias difficulty. \(\mathcal{M}_{3}\): trained model on CIFAR10 images with level three bias difficulty.

Figure 7: Comparison of different models test accuracy and their reconstruction performance on MNIST. \(\mathcal{M}_{base}\): trained model on original MNIST images. \(\mathcal{M}_{1}\): trained model on MNIST images with level one bias difficulty. \(\mathcal{M}_{2}\): trained model on MNIST images with level three bias difficulty.
Specifically, we showed that for a trained network, if the primary attributes of the training data are reconstructed well, then that network is likely to have learned the main concepts of the training data. However, if the primary attributes of the training data are not reconstructed well, then that network is likely to have learned some other discriminative features unrelated to the main concepts. Moreover, we demonstrated that adding biases that are difficult to detect in datasets can improve the performance of a neural network and enhance its generalization.
