On Completeness-aware Concept-Based Explanations in Deep Neural Networks

Chih-Kuan Yeh, Been Kim, Sercan O. Arik, Chun-Liang Li, Tomas Pfister, Pradeep Ravikumar

Introduction

The lack of explainability of deep neural networks (DNNs) arguably hampers their full potential for real-world impact. Explanations can help domain experts better understand rationales behind the model decisions, identify systematic failure cases, and potentially provide feedback to model builders for improvements. Most commonly-used methods for DNNs explain each prediction by quantifying the importance of each input feature . One caveat with such explanations is that they typically focus on the local behavior for each data point, rather than globally explaining how the model reasons. Besides, the weighted input features are not necessarily the most intuitive explanations for human understanding, particularly when using low-level features such as raw pixel values. In contrast, human reasoning often comprise “concept-based thinking,” extracting similarities from numerous examples and grouping them systematically based on their resemblance . It is thus of interest to develop such “concept-based explanations” to characterize the global behavior of a DNN in a way understandable to humans, explaining how DNNs use concepts in arriving at particular decisions.

A few recent studies have focused on bringing such concept-based explainability to DNNs, largely based on the common implicit assumption that the concepts lie in low-dimensional subspaces of some intermediate DNN activations. Via supervised training based on labeled concepts, TCAV trains linear concept classifiers to derive concept vectors, and uses how sensitive predictions are to these vectors (via directional derivatives) to measure the importance of a concept with respect to a specific class. Zhou et al. considers the decomposition of model predictions in terms of projections onto concept vectors. Instead of human-labeled concept data, Ghorbani et al. employs k-means clustering of super-pixel segmentations of images to discover concepts. Bouchacourt and Denoyer proposes a Bayesian generative model involving concept vectors. One drawback of these approaches is that they do not take into account how much each concept plays a role in the prediction. In particular, selecting a set of concepts salient to a particular class does not guarantee that these concepts are sufficient in explaining the prediction. The notion of sufficiency is also referred to as “completeness” of explanations, as in . This motivates the following key questions: Is there an unsupervised approach to extract concepts that are sufficiently predictive of a DNN’s decisions? If so, how can we measure this sufficiency?

In this paper, we propose such a completeness score for concept-based explanations. Our metric can be applied to a set of concept vectors that lie in a subspace of some intermediate DNN activations, which is a general assumption in previous work in this context . Intuitively speaking, a set of “complete” concepts can fully explain the prediction of the underlying model. By further assuming that for a complete set of concepts, the projections of activations onto the concepts are a sufficient statistic for the prediction of the model, we may measure the “completion” of the concepts by the accuracy of the model just given these concept based sufficient statistics. For concept discovery, we propose a novel algorithm, which could also be viewed as optimizing a surrogate likelihood of the concept-based data generation process, motivated by topic modeling . To ensure that the discovered complete concepts are also coherent (distinct from other concepts) and semantically meaningful, we further introduce an interpretability regularizer.

Beyond concept discovery, we also propose a score, ConceptSHAP, for quantification of concept attributions as contextualized importance. ConceptSHAP uniquely satisfies a key set of axioms involving the contribution of each concept to the completeness score . We also propose a class-specific version of ConceptSHAP that decomposes it with respect to each class in multi-class classification. This can be used to find class-specific concepts that contribute the most to a specific class. To verify the effectiveness of our automated completeness-aware concept discovery method, we create a synthetic dataset with apriori-known ground truth concepts. We show that our approach outperforms all compared methods in correct retrieval of the concepts as well as in terms of its coherency via a user study. Lastly, we demonstrate how our concept discovery algorithm provides additional insights into the behavior of DNN models on both image and language real-world datasets.

Related Work

Most post-hoc interpretability methods fall under the categories: (a) feature-based explanation methods, that attribute the decision to important input features , (b) sample-based explanation methods, that attribute the decision to previously observed samples , and (c) counterfactual-based explanation methods, which answers the question: “what to alter in the current input to change the outcome of the model” .Recent work has also focused on evaluations of explanations, ranging from human-centric evaluations to functionally-grounded evaluations . Our work provides an evaluation of concept explanations based on the completeness criteria, which is related to the ‘fidelity’ .

Our work is related to methods that learn semantically-meaningful latent variables. Some use dimensionality reduction methods , while others uncover higher level human-relatable concepts by dimensionality reduction (e.g. for speech and language ). More recently Locatello et al. shows that meaningful latent dimensions cannot be acquired in a completely unsupervised setting, implying the necessity of inductive biases for discovering meaningful latent dimensions. Our work uses indirect supervision from the classifier of interest to discover semantically meaningful latent dimensions. Chen et al. uses the representative training patches to explain a prediction in a self-interpretable framework for image classification. Koh et al. learn models that first predict human labeled concepts, then use concept scores to predict model. Goyal et al. measures the causal effect of concepts by using a conditional VAE model. These methods either require a training model from scratch or training a generative model, whereas our method can be applied on given models and different data types.

Defining Completeness of Concepts

Completeness Score: Given a prediction model f(x)=h(ϕ(x))f(\mathbf{x})=h(\phi(\mathbf{x})), a set of concept vectors c1,...,cm\mathbf{c}_{1},...,\mathbf{c}_{m}, we define the completeness score ηf(c1,...,cm)\eta_{f}(\mathbf{c}_{1},...,\mathbf{c}_{m}) as:

To calculate the completeness score, we can set gg to be a DNN or a simple linear projection, and optimize using stochastic gradient descent. In our experiments, we simply set gg to be a two-layer perceptron with 500 hidden units. We note that we approximate f(xt)f(\mathbf{x}_{t}) by h(gf(vc(xt)))h(g_{f}(v_{\mathbf{c}}(\mathbf{x}_{t}))), but not an arbitrary neural network hg(vc(xt))h_{g}(v_{\mathbf{c}}(\mathbf{x}_{t})) for two benefits: (a) the measure of completeness considers the architecture and parameter of the given model to be explained (b) the computation is much more efficient since we only need to optimize the parameters of gg, instead of the whole backbone hgh_{g}. The completeness score measures how “sufficient” are the concept scores as a sufficient statistic of the model, based on the assumption that the concept scores of “complete” concepts are sufficient statistics of the model prediction f(⋅)f(\cdot). By measuring the accuracy achieved by the concept score, we are effectively measuring how “complete” the concepts are. We note that the completeness score can also be used to measure how sufficient concepts can explain a dataset independent of the model, by replacing ϕ(⋅),h(⋅)\phi(\cdot),h(\cdot) with identical functions, and f(x)f(\mathbf{x}) with yy. Below is an illustrative example on why we need the completeness score:

The completeness score offers a way to assess the ‘sufficiency’ of the discovered concepts to “explain" reasoning behind a model’s decision. Not only the completeness score is useful in evaluating a proposed concept discovery method, but it can also shed light on how much of the learned information by DNN may not be ‘understandable’ to humans. For example, if the completeness score is very high, but discovered concepts aren’t making cohesive sense to humans, this may mean that the DNN is basing its decisions on other concepts that are potentially hard to explain.

Discovering Completeness-aware Interpretable Concepts

Our goal is to discover a set of maximally-complete concepts under the definition 3.1, where each concept is interpretable and semantically-meaningful to humans. We first discuss the limitations of recent notable works related to concept discovery and then explain how we address them. TCAV and ACE are concept discovery methods that use training data for specific concepts and use trained linear concept classifier to derive concept vectors. They quantify the saliency of a concept to a class using ‘TCAV score’, based on the similarity of the loss gradients to the concept vectors. This score implicitly assumes a first-order relationship between the concepts and the model outputs. Regarding labeling of the concepts, TCAV relies on human-defined labels, while ACE uses automatically-derived image clusters by k-means clustering of super-pixel segmentations. There are two main caveats to these approaches. The first is that while they may retrieve an important set of concepts, there is no guarantee on how ‘complete’ the concepts are in explain the model – e.g., one may have 10 concepts with high TCAV scores, but they may still be very insufficient in understanding the predictions. Besides, human-suggested exogenous concept data might even encode confirmation bias. The second caveat is that their saliency scores may fail to capture concepts that have non-linear relationships with the output due to first-order assumption. The concepts in Example 3.1 might not be retrieved by the TCAV score since XOR is not a linear relationship. Overall, our completeness score complements previous works in concept discovery by adding a criterion to determine whether a set of concepts are sufficient to explain the model. The discussion of our relation to PCA is in the Appendix.

2 Our method

The goal of our method is to obtain concepts that are complete to the model. We consider the case where each data point xi\mathbf{x}^{i} has parts x1:Ti\mathbf{x}_{1:T}^{i}, as described above. We assume that input data has spatial dependency, which can help learning coherent concepts. Thus, we encourage proximity between each concept and its nearest neighbors patches. Note that the assumption works well with images and language, as we will demonstrate in the result section. We aim that the concepts would obtain consistent nearest neighbors that only occur in parts of the input, e.g. head of animals or the grass in the background so that the concepts are pertained to certain spacial regions. By encouraging the closeness between each concept and its nearest neighbors, we aim to obtain consistent nearest neighbors to enhance interpretability. Lastly, we optimize the completeness terms to encourage the completeness of the discovered concepts.

To optimize the completeness of the discovered concepts, we optimize the surrogate loss for the completeness term for both concept vectors c1:m\mathbf{c}_{1:m} and the mapping function gg:

An interpretation for finding the underlying concepts whose concept score maximizes the recovered prediction score is analogous to treating the prediction of DNNs as a topic model. By assuming the data generation process of (x,y)(\mathbf{x},y) follows the probabilistic graphical model xt→zt\mathbf{x}_{t}\rightarrow\mathbf{z}_{t} and z1:T→y\mathbf{z}_{1:T}\rightarrow y, such that the concept assignment zt\mathbf{z}_{t} is generated by the data, and the overall concept assignment z1:T\mathbf{z}_{1:T} determines the label yy. The log likelihood of the data log⁡P[y∣x]\log P[y|\mathbf{x}] can be estimated by log⁡P[y∣x]=log⁡∫zP[y∣z]P[z∣x]≈log⁡P[y∣E[z∣x]],\log P[y|\mathbf{x}]=\log\int_{z}P[y|z]P[z|\mathbf{x}]\approx\log P[y|E[z|\mathbf{x}]], by replacing the sampling by a deterministic average. We note that vc(x1:T)v_{\mathbf{c}}(\mathbf{x}_{1:T}) resembles E[z∣x]E[z|\mathbf{x}] and P(y∣h(g(vc(x)))P(y|h(g(v_{\mathbf{c}}(\mathbf{x}))) resembles P[y∣E[z∣x]]P[y|E[z|\mathbf{x}]], and as in supervised topic modeling , we jointly optimize the latent “topic” and the prediction model, but in an end-to-end fashion to maintain efficiency instead of EM update.

To enhance the interpretability of our concepts beyond “topics”, we further design a regularizer to encourage the spacial dependency (and thus coherency) of concepts. Intuitively, we require that the top-K nearest neighbor training input patches of each concept to be sufficiently close to the concept, and different concepts are as different as possible. This formulation encourages the top-K nearest neighbors of the concepts would be coherent, and thus allows explainability by ostensive definition. K is a hyperparameter that is usually chosen based on domain knowledge of the desired frequency of concepts. In our results, we fix K to be half of the average class size in our experiments. When using batch update, we find that picking K=(batch size⋅average class ratio)/2K=(\text{batch size}\cdot\text{average class ratio})/2 works well in our experiments, where average class ratio=average instance of each class/total number of instances\text{average class ratio}={\text{average instance of each class}}/{\text{total number of instances}}. That is, the regularizer term tries to maximize Φ(xti)⋅ck\Phi(\mathbf{x}_{t}^{i})\cdot\mathbf{c}_{k} while minimizing cj⋅ck\mathbf{c}_{j}\cdot\mathbf{c}_{k}. Φ(xti)⋅ck\Phi(\mathbf{x}_{t}^{i})\cdot\mathbf{c}_{k} is the similarity between the ttht^{th} patch of the ithi^{th} example and cj⋅ck\mathbf{c}_{j}\cdot\mathbf{c}_{k} is the similarity between the jthj^{th} concept vector and the kthk^{th} concept vector. By averaging over all concepts, and defining TckT_{\mathbf{c}_{k}} as the set of top-K nearest neighbors of ck\mathbf{c}_{k}, the final regularization term is

By adding the regularization term to (2), the final objective becomes

for which we use stochastic gradient descent to optimize variables c1:m,g\mathbf{c}_{1:m},g jointly. When the optimization converges, gg is a (local) optimal value given c1:m\mathbf{c}_{1:m}. Since only concept vectors c1:m\mathbf{c}_{1:m}, and the mapping function gg is optimized in the process, the optimization process converges much faster compared to training the model from scratch. The computational cost for discovering concepts and calculating conceptSHAP is about 3 hours for AwA dataset and less than 20 minutes for the toy dataset and IMDB, using a single 1080 Ti GPU, which can be further accelerated with parallelism. The choice of which layer to apply hy,gh_{y},g and the corresponding architecture are further discussed in the appendix.

3 ConceptSHAP: How important is each concept?

Given a set of concept vectors CS={c1,c2,...cm}C_{S}=\{\mathbf{c}_{1},\mathbf{c}_{2},...\mathbf{c}_{m}\} with a high completeness score, we would like to evaluate the importance of each individual concept by quantifying how much each individual concept contributes to the final completeness score. Let si\mathbf{s}_{i} denote the importance score for concept ci\mathbf{c}_{i}, such that si\mathbf{s}_{i} quantifies how much of the completeness score η(CS)\eta(C_{S}) is contributed by ci\mathbf{c}_{i}. Motivated by its successful applications in quantifying attributes for complex systems, we adapt Shapley values to fairly assign the importance of each concept (which we call ConceptSHAP):

Given a set of concepts CS={c1,c2,...cm}C_{S}=\{\mathbf{c}_{1},\mathbf{c}_{2},...\mathbf{c}_{m}\} and some completeness score η\eta, we define the ConceptSHAP si\mathbf{s}_{i} for concept ci\mathbf{c}_{i} as

The main benefit of Shapley for importance scoring is that it uniquely satisfies the set of desired axioms: efficiency, symmetry, dummy, and additivity. As these axioms are widely discussed in previous works , we leave the definitions and proof to Appendix.

Thus far, conceptSHAP measures the global attribution (i.e., contribution to completeness when all classes are considered). However, per-class saliency, how much concepts contribute to prediction of a particular class, might be informative in many cases. To obtain the concept importance score for each class, we define the completeness score with respect to the class by considering data points that belong to it, which is formalized as:

Given a prediction model f(x)=h(ϕ(x))f(\mathbf{x})=h(\phi(\mathbf{x})), a set of concept vectors c1,c2,...,cm\mathbf{c}_{1},\mathbf{c}_{2},...,\mathbf{c}_{m} that lie in the feature subspace in ϕ(⋅)\phi(\cdot), we define the completeness score ηf,j(c1,...,cm)\eta_{f,j}(\mathbf{c}_{1},...,\mathbf{c}_{m}) for class jj as:

where VjV_{j} is the set of validation data with ground truth label jj, and ar,ja_{r,j} is the accuracy of random predictions for data in class jj, and g^\hat{g} is derived via the optimization of completeness. We then define the perclass ConceptSHAP for concept ii with respect to class jj as:

Given a prediction model f(x)f(\mathbf{x}), a set of concept vectors in the feature subspace in ϕ(⋅)\phi(\cdot). We can define the perclass ConceptSHAP for concept ii with respect to class jj as: si,j(η)=si(ηf,j).\mathbf{s}_{i,j}(\eta)=\mathbf{s}_{i}(\eta_{f,j}).

For each class jj, we may select the concepts with the highest conceptSHAP score with respect to class jj. We note that ∑j∣Vj∣∣V∣ηf,j=η\sum_{j}\frac{|V_{j}|}{|V|}\eta_{f,j}=\eta and thus with the additivity axiom, ∑j∣Vj∣∣V∣si,j(ηf,j)=si(η)\sum_{j}\frac{|V_{j}|}{|V|}\mathbf{s}_{i,j}(\eta_{f,j})=\mathbf{s}_{i}(\eta).

Experiments

In this section, we demonstrate our method both on a synthetic dataset, where we have ground truth concept importance, as well as on real-world image and language datasets.

We construct a synthetic image dataset with known and complete concepts, to evaluate how accurately the proposed concept discovery algorithm can extract them. In this dataset, each image contains at most 15 shapes (shown in Fig. 1(a)), and only 5 of them are relevant for the ground truth class, by construction. For each sample xi\mathbf{x}^{i}, zji\mathbf{z}_{j}^{i} is a binary variable which represents whether xi\mathbf{x}^{i} contains shape jj. z1:15i\mathbf{z}_{1:15}^{i} is a 15-dimensional binary variable with elements independently sampled from Bernoulli distribution with p=0.5p=0.5. We construct a 15-dimensional multi-label target for each sample, where the target of sample ii, yiy^{i} is a function that depends only on z1:5i\mathbf{z}_{1:5}^{i}, which represents whether the first 5 shape exists in xi\mathbf{x}^{i}. For example, y1=∼(z1⋅z3)+z4,y2=z2+z3+z4,y3=z2⋅z3+z4⋅z5y_{1}=\sim(\mathbf{\mathbf{z}_{1}}\cdot\mathbf{\mathbf{z}_{3}})+\mathbf{\mathbf{z}_{4}},y_{2}=\mathbf{\mathbf{z}_{2}}+\mathbf{\mathbf{z}_{3}}+\mathbf{\mathbf{z}_{4}},y_{3}=\mathbf{\mathbf{z}_{2}}\cdot\mathbf{\mathbf{z}_{3}}+\mathbf{\mathbf{z}_{4}}\cdot\mathbf{\mathbf{z}_{5}}, where ∼\sim denotes logical Not (details are in Appendix). We construct 48k training samples and 12k evaluation samples and use a convolutional neural network with 5 layers, obtaining 0.9990.999 accuracy. We take the last convolution layer as the feature layer ϕ(x).\phi(\mathbf{x}).

Evaluations:

We conduct a user-study with 20 users to evaluate the nearest neighbor samples of a few concept discovery methods. At each question, a user sees 10 nearest neighbor images of each discovered concept vector (as shown on the right of Fig. 1(b)), and is asked to choose the most common and coherent shape out of the 15 shapes based on the 10 nearest neighbors. We evaluate the results for our method, k-means clustering, PCA, ACE, and ACE-SP when m=5m=5 concepts are retrieved. Each user is tested on two randomly chosen methods in random order, and thus each method is tested on 8 users. We report the average number of correct concepts and the number of agreed concepts (where the mode of each question is chosen as the correct answer) for each method answered by users in Table 1. The average number of correct concepts measures how many of the correct concepts are retrieved by user via nearest neighbors. The average number of agreed concepts measures how consistent are the shapes retrieved by different users, which is related to the coherency and conciseness of the nearest neighbors for each method. We also provide an automated alignment score based on how the discovered concept direction classifies different concepts – see Appendix for details.

Results:

We compare our methods to ACE, k-means clustering, and PCA. For k-means and PCA, we take the embedding of the patch as input to be consistent to our method. For ACE, we implement a version which replaces the superpixels with patches and another version that takes superpixels as input, which we refer as ACE and ACE-SP respectively. We report the correct concepts and agreed concepts from the user study, and an automated alignment score which does not require humans. We do not calculate the alignment score of ACE-SP since it does not operate on patches and thus is unfair to compare with others (which would lead to much lower scores.) Our method outperforms others on corrected concepts and alignment score, is superior in retrieving the accurate concepts beyond the limitations of others. The number of agreed concepts is also the highest for our method, showing how highly-interpretability it is to humans such that the same concepts are consistently retrieved based on nearest neighbors. As qualitative results, Fig. 1(b) shows the top-6 nearest neighbors for each concept ck\mathbf{c}_{k} of our concept discovery method based on the dot product ⟨ck,Φ(xa)b⟩\langle\mathbf{c}_{k},\Phi(\mathbf{x}_{a})^{b}\rangle. All nearest neighbors contain a specific shape that corresponds to the ground-truth shapes 1 to 5. For example, all nearest neighbors of concept 1 contain the ground truth shape 1, which are cross as listed in Fig. 1(a). A complete list of the top-10 nearest neighbors of all concept discovery methods is shown in Appendix.

2 Image classification

We perform experiments on Animals with Attribute (AwA) that contains 50 animal classes. We use 26905 images for training and 2965 images for evaluation. We use the Inception-V3 model, pre-trained on Imagenet , which yields 0.90.9 test accuracy. We apply our concept discovery algorithm to obtain m=70m=70 concepts. We conduct ad-hoc duplicate concept removal, by removing one concept vector if there are two vectors where the dot product is over 0.95. This gives us 53 concepts in total. We then calculate the ConceptSHAP and per class saliency score for each concept and each class. For each class, the top concepts based on the conceptSHAP are the most important concepts to classify this class, as shown in Fig.3. While ConceptSHAP is useful in capturing the sufficiency of concepts for prediction, sometimes we may want to show examples. We propose to measure the quality of the nearest neighbors explanations by the average dot product between the nearest-neighbor patches that belongs to the class and the concept vector. In other words, the quality of the nearest neighbors explanations is simply the first term in R(c)R(\mathbf{c}), which we denote as R1(c)=∑k=1m∑xab⊆Tck⟨Φ(xab),ck⟩R_{1}(\mathbf{c})=\sum_{k=1}^{m}\sum_{\mathbf{x}_{a}^{b}\subseteq T_{\mathbf{c}_{k}}}\langle\Phi(\mathbf{x}_{a}^{b}),\mathbf{c}_{k}\rangle, where the top-K set is limited to image patches in the class of interest. When the nearest neighbor set contains patches of the same original image, we only show the patch with the highest similarity to the concept to increase the diversity.

Results:

We show the top concepts (ranked by conceptSHAP) of 3 classes with R1(c)R_{1}(\mathbf{c})>0.8 in Fig. 3 (full results are in Appendix). Note that since our method finds concepts for all classes as opposed to specific to one class (such as ), we discover common concepts across many classes. For example, concept 7, whose nearest neighbors show grass texture, is important for the classes ‘Squirrel’, ‘Rabbit’, ‘Bob Cat’, since all these animals appear in prairie. Concept 8 shows a oval head and large black round eyes shared by the classes ‘Rabbit’, ‘Squirrel’, ‘Weasel’, while concept 46 shows head of the ‘Bob cat’, which is shared by the classes ‘Lion’, ‘Leopard’, and ‘Tiger’, ‘Antelope’, and ‘Gorilla’, which all show animal heads that are more rectangular and significantly different to the animal heads of concept 8. We find that having concepts shared between classes is useful to interpret the model. Fig. 2 shows that our method achieves the highest completeness of all methods on both the synthetic dataset and AwA. As a sanity check, we include the baseline ‘ours-noc’, where the completeness objective is removed from (3). Our method has much higher completeness than ‘ours-noc’, demonstrating the necessity of the completeness term. In Appendix, we show some more top concepts for PCA, Kmeans, where the top concepts for PCA and Kmeans are also chosen as the same setting as ours.

Human Study:

We conduct a human study for the top neighbors for concepts discovered by our method, PCA, and Kmeans on the classes ‘Squirrel’, ‘Rabbit’, ‘Bob Cat’. For each method, we randomly choose 1 top concept per class for the 3 classes, and thus we choose 3 concepts per method (9 concepts in total). For each concept, we show users 4 top images of that concept, and ask users to choose the image (out of 3 different options) that they believe should belong to the same concept (where one of the option will actually belong to the same concept, and the other two are random image patches of the same class that does not belong to that concept). We then calculate the average accuracy to measure the human interpretability of the concept discover method. We conduct a user study with 10 users, where each of them are asked with the same 9 questions (1 question per concept chosen). The average correct ratio for our method, PCA, and Kmeans are 0.733, 0.267, and 0.6 respectively, showing our method’s superiority. Kmeans outperforms PCA as it also encourages closeness of top nearest neighbors (which is better for ostensive definition).

3 Text classification

We apply our method on IMDB, a text dataset with movie reviews classified as either positive or negative. We use 37500 reviews for training and 12500 for testing. We employ a 4-layer CNN model with 0.9 test accuracy. We apply our concept discover method to obtain 4 concepts, where the part of data xji\mathbf{x}_{j}^{i} consists of 10 consecutive words of the sentence. The completeness of the 4 concepts is 0.97, thus the 4 concepts are highly representative of the classification model.

Result:

For each concept, Table 2 shows (a) the top nearest neighbors based on the dot product of the concept and part of reviews (b) the most frequent words in the top-500 nearest neighbors (excluding stop words) (c) the conceptSHAP score for each concept. We can see that concepts 1 and 2 contain mostly negative sentiments, evident from the nearest neighbors – concept 1 tends to criticize the movie/film directly, while concept 2 contains negativity in comments via words such as “not”, “doesn’t”, “even”. We note that the ratings in concept 2 are also negative since the scores 1 and 2 are considered to be very negative in movie review. On the other hand, concepts 3 and 4 contain mostly positive sentiments, as evident from the nearest neighbors – concept 3 seems to discuss the plot of the movie without directing acclaiming or criticizing the movie, while concept 4 often contains very positive adjectives such as “excellent”, “wonderful” that are extremely positive. More nearest neighbors are provided in the Appendix.

Appending discovered concepts:

We perform an additional experiment where we randomly append 5 nearest neighbors (out of 500-nearest neighbors) of each concept to the end of all testing instances for further validation of the usefulness of the discovered concepts. For example, we may add “wasting my time with a comment but this movie” along with 4 other nearest neighbors of concept 1 to the end of a testing sentence. The original average prediction score for the testing sentences is 0.516, and the average prediction score after randomly appending 5 nearest neighbors of each concept becomes 0.103, 0.364, 0.594, 0.678 for concept 1, 2, 3, 4. As a controlled experiment, we appended 5 random sentences to the testing sentences, and the average prediction score is 0.498. This suggests that the concept score is highly related to the how the model makes prediction and may be used to manipulate the prediction. We note that while concept 1 contains stronger and more direct negative words than concept 2, concept 2 has a higher conceptSHAP value than concept 1. We hypothesize this is due to the fact that concept 2 may better detect weak negative sentences that may be difficult to be explained by concept 1, and thus may contribute more to the completeness score.

Conclusions

We propose to quantify the sufficiency of a particular set of concepts in explaining the model’s behavior by the completeness of concepts. By optimizing the completeness term coupled with additional constraints to ensure interpretability, we can discover concepts that are complete and interpretable. Through experiments on synthetic and real-world image and language data, we demonstrate that our method can recover ground truth concepts correctly, and provide conceptual insights of the model by examining the nearest neighbors. Although our work focuses on post-hoc explainability of pre-trained DNNs, joint training with our proposed objective function is possible to train inherently-interpretable DNNs. An interesting future direction is exploring the benefits of joint learning of the concepts along with the model, for better interpretability.

Broader Impact

Bringing explainability can be crucial for AI deployments, for decision makers to build trust, for users to understand decisions, and for model developers to improve the quality. There are many use cases, from Finance, Healthcare, Employment/Recruiting, Retail, Environmental Sciences etc., that the explainability indeed constitutes the bottleneck to use deep neural networks (DNNs) despite their high performance. Thus, bringing explainability to DNNs can open many horizons for new AI deployments.

There are different forms of explainability, and our contributions are specifically for the very important ‘concept-based’ explanations, towards a coherent and complete transparency to DNNs. Our paper contributes to the quantification of the “completeness” of concept explanations, which can be useful to evaluate how sufficient existing and future concept-based explanations are, on the task of explaining a neural network. Validating the how sufficient the explanations are in explaining the model is a necessary sanity check, but often overlooked for concept explanations. As the field of explainable AI progresses rapidly, critiques and doubts on whether explanations are actually useful and accountable for models have also increased. Our objective metric bridges the gap between existing explanations and model accountability.

Most post-hoc concept-based explanations are applied only on image data. Our method is data type agnostic. We demonstrate our canonical idea on both image and language data, which we believe can be applied to other data types as well. We believe our work lays a groundwork on general concept-based explanations, and hopefully will encourage future works on exploring concept explanations on all kinds of data types. Our concept discovery method explain a model using a small number of concepts, which can be explained by providing nearest neighbors in the training data to help users understand the concepts better. Such explanations provide a broader understanding of the model compared to the widely-used methods, such as saliency maps, and can be helpful for model developers and data scientists in understanding how the model works, improving the model based on insights, and ultimately learning from AI systems to build better AI systems.

Ackowlegement

We acknowledge the support of DARPA via FA87501720152.

References

Appendix A Relation to PCA

We show that under strict conditions, the PCA vectors applied on an intermediate layer where the principle components are used as concept vectors, maximizes the completeness score.

We note that the assumptions for this proposition are extremely stringent, and may not hold in general. When the isometry and other assumptions do not hold, PCA no longer maximizes the completeness score as the lowest reconstruction in the intermediate layer do not imply the highest prediction accuracy in the output. In fact, DNNs are shown to be very sensitive to small perturbations in the input – they can yield very different outputs although the difference in the input is small (and often perceptually hard to recognize to humans). Thus, even though the reconstruction loss between two inputs are low at an intermediate layer, subsequent deep nonlinear processing may cause them to diverge significantly. The principal components are also not trained to be semantically meaningful, but to greedily minimize the reconstruction error (or maximize the projected variance). Even though completeness score and PCA share the idea of minimizing the reconstruction loss via dimensionality reduction, the lack of human interpretability of the principle components is a major bottleneck for PCA.

We provide this proposition only because completeness and PCA share the idea of minimizing the reconstruction loss via dimensionality reduction. Another notable limitation of using PCA as concept vectors is the lack of human interpretability of the principle components. The PCA vectors are not trained to be semantically meaningful, but to greedily minimize the reconstruction error (or maximize the projected variance).

Proof of Proposition A.1

and since f(x)f(\mathbf{x}) is equal to Y, we can rewrite to

By definition, ∑x⊆Vx∥ϕ(x)−l(ϕ(x)c)∥F2\sum_{\mathbf{x}\subseteq V_{x}}\|\phi(\mathbf{x})-l(\phi(\mathbf{x})\mathbf{c})\|_{F}^{2} is minimized by the projection, and thus l(ϕ(x)c)=proj(ϕ(x),c)l(\phi(\mathbf{x})\mathbf{c})=\text{proj}(\phi(\mathbf{x}),\mathbf{c}).

and subsequently get that for any c\mathbf{c}

Thus, PCA vectors maximize the L2 surrogate of the completeness score. We emphasize that Proposition A.1 has several assumptions that may not be practical. However, the proposition is only meant to show that PCA optimizes our definition of completeness under a very stringent condition, as the key idea of completeness and PCA are both to prevent information loss through dimension reduction.

Appendix B Shapley Axioms for ConceptSHAP

The axiomatic properties for ConceptSHAP are listed in the following proposition:

Given a set of concepts CS={c1,c2,...cm}C_{S}=\{\mathbf{c}_{1},\mathbf{c}_{2},...\mathbf{c}_{m}\} and a completeness score η\eta, and some importance score si\mathbf{s}_{i} for each concept ci\mathbf{c}_{i} that depends on the completeness score η\eta. si\mathbf{s}_{i} defined by conceptSHAP is the unique importance assignment that satisfy the following four axioms:

Efficiency: The sum of all importance value should sum up to the total completeness score, ∑i=1msi(η)=η(CS)\sum_{i=1}^{m}\mathbf{s}_{i}(\eta)=\eta(C_{S}).

Symmetry: For two concept that are equivalent s.t. η(u∪{ci})=η(u∪{cj})\eta(u\cup\{\mathbf{c}_{i}\})=\eta(u\cup\{\mathbf{c}_{j}\}) for every subset u⊆CS∖{ci,cj}u\subseteq C_{S}\setminus\{\mathbf{c}_{i},\mathbf{c}_{j}\}, si(η)=sj(η)\mathbf{s}_{i}(\eta)=\mathbf{s}_{j}(\eta).

Dummy: If η(u∪{ci})=η(u)\eta(u\cup\{\mathbf{c}_{i}\})=\eta(u) for every subset u⊆CS∖{ci}u\subseteq C_{S}\setminus\{\mathbf{c}_{i}\}, then si(η)=0\mathbf{s}_{i}(\eta)=0.

Additivity: If η\eta and η′\eta^{\prime} have importance value s(η)\mathbf{s}(\eta) and s(η′)\mathbf{s}(\eta^{\prime}) respectively, then the importance value of the sum of two completeness score should be equal to the sum of the two importance values, i.e, si(η+η′)=si(η)+si(η′)\mathbf{s}_{i}(\eta+\eta^{\prime})=\mathbf{s}_{i}(\eta)+\mathbf{s}_{i}(\eta^{\prime}) for all i.

The proof and the interpretation for these concepts are well discussed in .

Appendix C Additional Experiments Results and Settings

where ee is some constant. We then evaluate how well the set of discovered concepts c1:m\mathbf{c}_{1:m} aligns with shapes 1 to 5:

which measures the best average matching accuracy by assigning the best concept vector to differentiate each shape. For each concept vector cj\mathbf{c}_{j}, we test cj\mathbf{c}_{j} and −cj-\mathbf{c}_{j} and choose the direction that leads to the highest alignment score.

Creation of the Toy Example

The complete list of the target y is y1=∼(z1⋅z3)+z4,y2=z2+z3+z4,y3=z2⋅z3+z4⋅z5,y4=z2 XOR z3,y5=z2+z5,y6=∼(z1+z4)+z5,y7=(z2⋅z3) XOR z5,y8=z1⋅z5+z2,y9=z3,y10=(z1⋅z2) XOR z4,y11=∼(z3+z5),y12=z1+z4+z5,y13=z2 XOR z3,y14=∼(z1⋅z5+z4),y15=z4 XOR z5.y_{1}=\sim(\mathbf{\mathbf{z}_{1}}\cdot\mathbf{\mathbf{z}_{3}})+\mathbf{\mathbf{z}_{4}},y_{2}=\mathbf{\mathbf{z}_{2}}+\mathbf{\mathbf{z}_{3}}+\mathbf{\mathbf{z}_{4}},y_{3}=\mathbf{\mathbf{z}_{2}}\cdot\mathbf{\mathbf{z}_{3}}+\mathbf{\mathbf{z}_{4}}\cdot\mathbf{\mathbf{z}_{5}},y_{4}=\mathbf{\mathbf{z}_{2}}\text{ XOR }\mathbf{\mathbf{z}_{3}},y_{5}=\mathbf{\mathbf{z}_{2}}+\mathbf{\mathbf{z}_{5}},y_{6}=\sim(\mathbf{\mathbf{z}_{1}}+\mathbf{\mathbf{z}_{4}})+\mathbf{\mathbf{z}_{5}},y_{7}=(\mathbf{\mathbf{z}_{2}}\cdot\mathbf{\mathbf{z}_{3}})\text{ XOR }\mathbf{\mathbf{z}_{5}},y_{8}=\mathbf{\mathbf{z}_{1}}\cdot\mathbf{\mathbf{z}_{5}}+\mathbf{\mathbf{z}_{2}},y_{9}=\mathbf{\mathbf{z}_{3}},y_{10}=(\mathbf{\mathbf{z}_{1}}\cdot\mathbf{\mathbf{z}_{2}})\text{ XOR }\mathbf{\mathbf{z}_{4}},y_{11}=\sim(\mathbf{\mathbf{z}_{3}}+\mathbf{\mathbf{z}_{5}}),y_{12}=\mathbf{\mathbf{z}_{1}}+\mathbf{\mathbf{z}_{4}}+\mathbf{\mathbf{z}_{5}},y_{13}=\mathbf{\mathbf{z}_{2}}\text{ XOR }\mathbf{\mathbf{z}_{3}},y_{14}=\sim(\mathbf{\mathbf{z}_{1}}\cdot\mathbf{\mathbf{z}_{5}}+\mathbf{\mathbf{z}_{4}}),y_{15}=\mathbf{\mathbf{z}_{4}}\text{ XOR }\mathbf{\mathbf{z}_{5}}.

We create the dataset in matplotlib, where the color of each shape is sampled independently from green, red, blue, black, orange, purple, yellow, and the location is sampled randomly with the constraint that different shapes do not coincide with each other.

Hyper-parameter Choice and Sensitivity

To choose the hyperparameters, one can use a small-scale evaluation dataset to choose a few important hyperparameters. One should choose the hyperparamters so that they get concepts with high completeness and R1(c)R_{1}(\mathbf{c}), and we better describe the impact of these hyperparamters to guide such selection.

Choice of λ1,λ2,β\mathbf{\lambda_{1},\lambda_{2},\beta}: We set λ1=λ2=0.1,β=0.2\lambda_{1}=\lambda_{2}=0.1,\beta=0.2 for the toy dataset. We show the completeness score for varying λ1,λ2,β\lambda_{1},\lambda_{2},\beta in Figure 7,8,9 (when varying λ1\lambda_{1}, we fix λ2=0.1\lambda_{2}=0.1, and β=0.2\beta=0.2.) We see that both the completeness and alignment score are above 0.93 when λ1\lambda_{1} and λ2\lambda_{2} are in the range of [0.05,0.3][0.05,0.3], and β\beta is in the range of [0,0.3][0,0.3], and thus our method outperforms all baselines with a wide range of hyper-parameters. Therefore, our method is not sensitive to the hyper-parameter in the toy dataset. We set the λ1=λ2=0.1,β=0.3\lambda_{1}=\lambda_{2}=0.1,\beta=0.3 for the NLP dataset, and we set λ1=λ2=10.0,β=0\lambda_{1}=\lambda_{2}=10.0,\beta=0 for AwA dataset since the optimization becomes more difficult with a deeper neural network, and thus we increase the regularizer strength to ensure interpretability. The completeness is above 0.9 when λ1\lambda_{1} and λ2\lambda_{2} are set in the range of $.Overall,ourmethodisnottoosensitivetotheselectionofhyper−parameter.Thegeneralprincipleforhyper−parametertuningistochoselarger. Overall, our method is not too sensitive to the selection of hyper-parameter. The general principle for hyper-parameter tuning is to chose larger\lambda_{1}andand\lambda_{2}$ that still gives a completeness value (usually > 0.95).

Choice of h,gh,g: The intermediate layer (which effects hh) can be chosen depending on the size of the nearest neighbor patch the user would like to visualize, since this size depends on the receptive field of the feature layer. Deeper layers have larger receptive fields while shallower layers have smaller receptive field size. In AwA experiments, we choose Mixed_5d layer so that the receptive field is 127×127127\times 127, which is half of the original image size and capable of capturing both larger and smaller concepts. If the user is only interested in smaller and more low level concepts (such as the texture of image), we can apply our method to earlier layers. As a hyper-parameter control experiment, we apply our method to mixed_5c layer where the receptive field is 95×9595\times 95 and visualize the result in Fig. 4, where indeed smaller (low level) concepts such as eyes (in constrast to head), furry, sandy are captured (which we name the concepts). If one finds the concepts discovered to be too small (low level), they could apply the method on a deeper layer and vice versa. For the choice of gg, we let it be a two layer neural network (with 512 neurons) followed by the remaining network hh, so that hh is also optimized in eq.3, which we fix in all experiments.

Additional Nearest Neighbors for toy example

We show 10 nearest neighbors for each concept obtained by our methods and baseline methods in the toy example in Figure 10. The 10 nearest neighbors for each concept obtained by different methods is used to perform the user study, to test if the nearest neighbors allow human to retrieve the correct ground truth concepts for each method.

User Study Setting and Discussion

For the user study, we set m=5m=5 (i.e. 5 discovered concepts) for all compared methods. The order of the 2 randomly chosen conditions (and which 2 conditions are paired), the order of the questions, the order of choices are all randomized to avoid biases and learning effects. All users are graduate students with some knowledge of machine learning. None of them have (self-reported) color-blindness. For each discovered concept, an user is asked to find the most common and coherent shape given the top 10 nearest neighbors. An example question is shown in Figure 15. Each user is given 10 questions, which correspond to the nearest neighbors of the discovered concepts for two random methods. (each method has 5 discovered concepts, and thus two methods have 10 discovered concepts in total). There are 20 users in total, and thus each method is tested on 8 users. For each method, we report the average number of correct answers chosen by the users. For example, if an user chooses shape 1,2,5,7,5, then the number of the correct answers chosen by the user will be 3 (since 1,2,5 are the ground truth shape obtained by the user). We average the correct answers chosen by 8 users for each method to obtain the “average number of correct answers chosen by users”. We also report the average number of agreed answers chosen by the users. For example, if most users choose 1,2,5,7,5 for five questions respectively, we set 1,2,5,7,5 as the ground truth for the five questions. If user A answered 1,2,5,7,10 for the five questions respectively, his number of agreed answers would be 4. We average the agreed answers chosen by 8 users for each method to obtain the “average number of agreed answers chosen by users”.

We find that other methods mainly fail due to (a) the same concept are chosen repeatedly (e.g. concept 2 and concept 4 of ACE). (b) lack of disentanglement (coherency) of concepts (e.g. concept 5 of PCA shows two shape in all 10 nearest neighbors). (c) highlighted concepts are not related to the ground truth concept (e.g. concept 4 of Kmeans). (a), (c) are related to the lack of completeness of the method, and (b) is related to the lack of coherency of the method.

Implementation Details

For calculating ConceptSHAP, we use the method in kernelSHAP to calculate the Shapley values efficiently by regression. For ACE in toy example, we set the number of cluster to be 15, and choose the concepts based on TCAV score. For ACE in toy example, we set the number of clusters to be 150, and choose the concepts based on TCAV score. For PCA, we return the top mm principle components when the number of discovered concepts is mm. For k-means, we set the cluster size to be mm when the number of discovered concepts is mm, and return the cluster mean as the discovered concepts.

Qualitative Results for Baselines in AwA

We show nearest neighbors of the top concepts of PCA and Kmeans of the three class “Rabbit”, “Squirrel”, and “Weasel” in AwA in figure 5 and 6 respectively.

Additional Nearest Neighbors for AwA

We show additional nearest neighbors of the top concepts in AwA for all 50 classes from Figure 16 to Figure 24. For each class, the 3 concepts with the highest ConceptSHAP respect to the class with R1(c)R_{1}(\mathbf{c}) above 0.8 is shown, along with the ConceptSHAP score with respect to the class. We see that many important concepts are shared between different classes, where most of them are semantically meaningful. To list some examples, concept 7 corresponds to the concept of grass, concept 33 shows a specific kind of wolf-like face (which has two different colors on the face), concept 27 corresponds to the sky/ocean view, concept 25 shows a side face that is shared among many animals, concept 46 shows a front face of cat-like animals, concept 21 shows sandy/ wilderness texture of the background, concept 38 shows gray back ground that looks like asphalt road, concept 43 shows similar ears of several animals, concept 31 shows furry/ rough texture with a plain background.

Additional Nearest Neighbors for NLP

We show additional nearest neighbors of the 4 concepts in NLP. The nearest neighbors of concept 1 and concept 2 are generally negative, and concept 3 and concept 4 are generally positive.