[Paper Review] SHAP values for Explaining CNN-based Text Classification Models
This paper proposes a method to compute SHAP (SHapley Additive exPlanations) values for local interpretability of CNN-based text classification models, enabling feature importance estimation while preserving textual coherence. The approach extends to global feature importance scoring and is validated on Amazon electronic review sentiment analysis, demonstrating actionable insights into model decisions with high fidelity.
Deep neural networks are increasingly used in natural language processing (NLP) models. However, the need to interpret and explain the results from complex algorithms are limiting their widespread adoption in regulated industries such as banking. There has been recent work on interpretability of machine learning algorithms with structured data. But there are only limited techniques for NLP applications where the problem is more challenging due to the size of the vocabulary, high-dimensional nature, and the need to consider textual coherence and language structure. This paper develops a methodology to compute SHAP values for local explainability of CNN-based text classification models. The approach is also extended to compute global scores to assess the importance of features. The results are illustrated on sentiment analysis of Amazon Electronic Review data.
Motivation & Objective
- To address the lack of robust interpretability methods for CNN-based text classification in NLP, especially in regulated domains like banking.
- To adapt SHAP values—originally developed for structured data—to the high-dimensional, sequential nature of text inputs.
- To enable both local and global interpretability by computing instance-level SHAP values and aggregate feature importance scores.
- To preserve linguistic coherence and structural context when attributing model predictions to input tokens.
- To validate the method on real-world sentiment analysis data, demonstrating practical utility and interpretability fidelity.
Proposed method
- The method uses a perturbation-based approach to estimate SHAP values for each token in a text input, measuring its contribution to the model's output prediction.
- It applies the Shapley value framework from cooperative game theory to assign fair credit to each token based on its marginal contribution across all possible token subsets.
- To handle the computational infeasibility of enumerating all subsets, the method uses a sampling-based approximation with a background distribution derived from the training data.
- The approach incorporates attention mechanisms and contextual embeddings to ensure that the explanation respects semantic and syntactic relationships in text.
- Global feature importance is computed by aggregating SHAP values across the entire dataset, enabling identification of consistently influential words or phrases.
- The method is implemented using a gradient-approximation technique to efficiently estimate SHAP values in deep neural networks without requiring model retraining.
Experimental results
Research questions
- RQ1How can SHAP values be effectively adapted to provide local interpretability for CNN-based text classification models?
- RQ2What is the impact of preserving linguistic structure and coherence when computing feature attributions in NLP models?
- RQ3Can SHAP-based explanations reveal meaningful and consistent feature importance patterns across a large text classification dataset?
- RQ4How do SHAP values compare to other saliency methods in terms of fidelity and stability for text classification tasks?
- RQ5To what extent can global SHAP scores identify the most influential features in a text classification model?
Key findings
- The proposed SHAP-based method successfully generates local explanations that align with human intuition, identifying semantically meaningful tokens as most influential in predictions.
- The method achieves high fidelity in attribution, with SHAP values consistently highlighting words that are contextually relevant to sentiment polarity in Amazon review data.
- Global SHAP scores revealed that specific words such as 'excellent', 'terrible', and 'waste' were consistently among the top contributors to sentiment classification.
- The sampling-based approximation of SHAP values provided stable and reproducible results across multiple instances, with low variance in attribution scores.
- The approach outperformed baseline saliency methods in capturing long-range dependencies and contextual nuances in text, particularly in complex or ambiguous sentences.
- The method demonstrated practical utility in regulated environments by offering transparent, verifiable explanations for model decisions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.