Abstract
Recent NLP literature has seen growing interest in improving model interpretability. Along this direction, we propose a trainable neural network layer that learns a global interaction graph between words and then selects more informative words using the learned word interactions. Our layer, we call WIGRAPH, can plug into any neural network-based NLP text classifiers right after its word embedding layer. Across multiple SOTA NLP models and various NLP datasets, we demonstrate that adding the WIGRAPH layer substantially improves NLP models' interpretability and enhances models' prediction performance at the same time.
1. Introduction
In the quest for "trustworthy AI," researchers have focused on making deep learning models interpretable. Most current approaches fall into two camps: post-hoc explanations (e.g., LIME or SHAP) and intrinsic interpretability (e.g., VMASK). However, these methods often treat words in isolation. In natural language, meaning is contextual; for instance, the word "different" might be neutral on its own, but "refreshingly different" carries a strong positive sentiment. We argue that to truly understand a model's decision-making, we must explicitly model these word-word interactions.
2. Methodology
WIGRAPH is a plug-and-play neural network layer designed to be inserted into any neural text classifier immediately after the word embedding layer. It consists of three main components:
- Stochastic Edge Discovery: The model learns a global, undirected graph ($A$) where nodes are words in the vocabulary. Edges represent significant interactions for the specific task (e.g., sentiment analysis), treated as Bernoulli random variables.
- Graph-Based Message Passing: WIGRAPH uses a modified Graph Convolutional Network (GCN) operation. Each word’s embedding is updated by aggregating information from its neighbors in the learned interaction graph. This "lite" version uses only one hop and no additional weight matrices to avoid biasing the base model's existing logic.
- VIB-WI Loss: To prevent the graph from becoming noisy, we utilize a Variational Information Bottleneck (VIB) objective. This forces the model to be "maximally compressive," retaining only interactions necessary to predict the target label, which naturally leads to a sparse, interpretable graph.
3. Experimental Evaluation
We evaluated WIGRAPH across six diverse text classification benchmarks: SST-1, SST-2, and IMDB (Sentiment Analysis); AG News (Topic Classification); TREC (Question Type); and Subj (Subjectivity). The layer was tested across four base models: LSTM, BERT, RoBERTa, and distilBERT.
4. Results and Discussion
4.1 Prediction Performance
Across all base models and datasets, WIGRAPH consistently outperformed the base versions. For example, it provided a +2.63% boost to LSTM on both SST-1 and SST-2. This suggests that allowing words to "talk" to each other via the graph before the main classifier sees them allows the model to learn more robust features.
4.2 Interpretability and Faithfulness
Using the Area Over Perturbation Curve (AOPC) metric—which measures how much a model's confidence drops when "important" words are removed—WIGRAPH significantly outperformed both the base models and the VMASK baseline. This suggests that the words WIGRAPH identifies as important are truly the ones driving its decisions. Qualitatively, visualizations show that WIGRAPH highlights clusters of sentiment-carrying words (e.g., "refreshingly different") more clearly than standard models, which often highlight irrelevant stop words.
5. Conclusion and Future Work
WIGRAPH challenges the traditional "accuracy vs. interpretability" trade-off by explicitly guiding the model to look at relevant interactions. While currently limited to pairwise interactions and a vocabulary of the top 10,000 most frequent words for efficiency, future work will explore higher-order interactions (triplets) and expansion to cross-sentence tasks like Natural Language Inference (NLI).
Summary updated