Learning Variational Word Masks to Improve the Interpretability of Neural Text Classifiers

Hanjie Chen, Yangfeng Ji

Abstract

Hanjie Chen, Yangfeng Ji. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).

2020.

Introduction

Deep learning models excel at text classification but remain notorious "black boxes," making it difficult to discern why a specific label was assigned. Current interpretability methods generally fall into two categories: post-hoc explanations (like LIME or SHAP), which guess at a model's logic without improving it, and inherently interpretable models, which often require complex architectural changes or expensive human-annotated rationales. This research introduces VMASK (Variational Word Mask), a model-agnostic layer designed to bridge this gap by making models intrinsically more interpretable without sacrificing performance.

The VMASK Framework

VMASK is a "word mask" layer inserted immediately after the word embedding layer. It is built on the Information Bottleneck (IB) principle, which forces the model to maximize the information it retains about the label (accuracy) while minimizing the information it keeps from the input text (compression).

For every word in the vocabulary, the model learns a probability of whether that word should be "kept" or "masked out." To handle the discrete nature of masking during training, the authors employ the Gumbel-Softmax trick, allowing the masks to be learned via standard backpropagation. Because it resides after the embedding layer, VMASK is model-agnostic and can be integrated into CNNs, LSTMs, and Transformers like BERT.

Experimental Evaluation

The researchers evaluated VMASK across seven benchmark datasets:

  • Sentiment Analysis: IMDB, SST-1, SST-2, Yelp.
  • Topic Classification: AG News, TREC.
  • Subjectivity: Subj.

Key Insights: Importance vs. Frequency

A significant finding is that VMASK acts as a task-specific regularizer. By filtering out noise, it improves generalization. Crucially, VMASK's importance scores are not merely a reflection of word frequency. It successfully identifies low-frequency but high-impact words (e.g., "funnest," "craveable") while assigning low importance to common stopwords (e.g., "the," "is").

Importance score vs. word frequency scatter plot.

Quantitative and Qualitative Results

VMASK-enhanced models consistently outperformed their base counterparts. For instance, on the SST-1 dataset, CNN-VMASK reached 48.92% accuracy, up from the base CNN's 46.32%.

To measure interpretability quantitatively, the authors used metrics like Post-hoc Accuracy and AOPC (Area Over the Perturbation Curve), which track how model confidence changes as important words are removed. VMASK models scored significantly higher than baselines like IBA (Information Bottleneck Attribution), demonstrating that the words VMASK identifies are indeed the primary drivers of model decisions.

Post-hoc accuracy across seven datasets for various architectures.

Qualitatively, VMASK models focus on clear sentiment-bearing words (e.g., "heartwarming," "delightful"), whereas base models often fixate on irrelevant function words like "of" or "to."

Limitations and Future Work

While VMASK improved BERT, the interpretability gains were less pronounced than in CNNs or LSTMs, likely due to BERT's complex self-attention mechanism. Additionally, this study used fixed embeddings; future research could explore the impact of fine-tuning embeddings alongside VMASK. Finally, while inference is fast, the variational inference machinery does increase training time.

Conclusion

VMASK provides a robust, model-agnostic method for improving both the performance and interpretability of neural text classifiers. By leveraging the Information Bottleneck principle, it forces models to focus on the most salient features, turning the "black box" into a more transparent and effective tool.

Summary updated

BibTeX
@inproceedings{chen2020learning,
  author = {Hanjie Chen and Yangfeng Ji},
  title = {{Learning Variational Word Masks to Improve the Interpretability of Neural Text Classifiers}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  url = {https://openreview.net/forum?id=GZLOHHJqNec},
}
Figure