iCapsNets: Towards Interpretable Capsule Networks for Text Classification

Zhengyang Wang, Xia Hu, Shuiwang JiarXiv 2020

TL;DR

This paper introduces iCapsNets, a novel deep learning architecture for text classification that achieves both high performance and interpretability. By adapting capsule networks (originally from computer vision) to text and incorporating a novel attention mechanism, iCapsNets can explain why a specific classification is made (local interpretability) and how the model generally works (global interpretability), without sacrificing accuracy.

What Problem Does This Paper Address?

The field of text classification faces a persistent dilemma: traditional machine learning models are interpretable but lack accuracy, while modern deep learning models achieve high performance but are often "black boxes," making it difficult to understand their decision-making process. This lack of interpretability is a significant hurdle in many real-world applications where trust and transparency are crucial. The authors aim to bridge this gap by developing a deep learning model that offers both strong predictive power and clear, human-understandable explanations for its classifications.

Methods

The core of iCapsNets lies in adapting Capsule Networks (CapsNets), a concept from computer vision, to the domain of text. Instead of traditional scalar outputs, capsules are vectors that represent instantiation parameters of entities, allowing for a more nuanced representation of semantic meaning.

Key methodological contributions include:

  • Adapting CapsNets for Text: The authors propose using capsules to represent semantic meanings within text. This involves capturing low-level semantic entities (primary capsules) and then using a dynamic routing algorithm to compute high-level semantic entities (class capsules) that correspond to predefined classes.
  • Trainable Multi-Head Attention Layer: To generate primary capsules from input text, a novel trainable multi-head attention mechanism is introduced. This layer effectively transforms word embeddings into "region embeddings" (akin to phrase embeddings) and then uses attention to aggregate these into primary capsules. This attention mechanism is crucial for interpretability, as its weights indicate which parts of the text are important for forming a specific semantic representation.
  • Hierarchical Attention for Long Documents: For longer texts, a trainable multi-head hierarchical attention layer is proposed, which first processes sentences individually and then aggregates sentence-level representations to form primary capsules.
  • Dynamic Routing Algorithm: The paper utilizes the dynamic routing algorithm, a key component of CapsNets, to compute class capsules from primary capsules. This algorithm allows capsules in one layer to "vote" for the most active feature detectors in the layer below.
  • Weight Sharing Regularization: To improve efficiency and interpretability, weight sharing is employed in the attention mechanism and the capsule layer.

Datasets

The authors conducted experiments on 7 publicly available large-scale datasets, covering various text classification tasks such as sentiment analysis, topic categorization, and ontology extraction. These datasets were originally compiled by Zhang et al. [1]. The specific datasets mentioned are:

  • Yelp Review Polarity
  • Yelp Review Full
  • Yahoo! Answers
  • Amazon Review Polarity
  • Amazon Review Full
  • AG's News
  • DBPedia

Key Insights and Ideas

  • Capsules for Semantic Meaning: The fundamental idea that capsules, as vector representations, can better capture nuanced semantic meanings in text compared to scalar representations used in traditional deep learning models.
  • Attention as an Interpretability Tool: The attention mechanism is not just for performance enhancement but is explicitly leveraged to provide insights into which words or phrases contribute most to a particular semantic representation (primary capsule).
  • Bridging Local and Global Interpretability: iCapsNets are designed to offer both:
  • Local Interpretability: Explaining why a specific document was classified into a particular category by highlighting important words or n-grams.
  • Global Interpretability: Understanding the general semantic meanings captured by each primary capsule across the entire dataset.
  • Human-Intuitive Interpretation: The interpretation methods are designed to be simple and align with human intuition, making the model's reasoning understandable.
  • Trade-off is Not Inevitable: The paper challenges the common assumption that interpretability comes at the cost of performance. iCapsNets demonstrate that high accuracy and interpretability can be achieved simultaneously.

Key Results

  • Competitive Accuracy: iCapsNets achieved competitive classification accuracies across the 7 datasets, often outperforming several strong baselines, including traditional deep learning models like CNNs and RNNs, and models like FastText. For instance, on the AG's News dataset, iCapsNets Short achieved 95.9% accuracy, and iCapsNets Long achieved 96.0%, which are among the highest reported.
  • Meaningful Interpretations: The experimental results showcase that the extracted words and n-grams from the local interpretation method effectively justify the model's predictions. The global interpretation also reveals distinct semantic meanings captured by different primary capsules.
  • Efficiency Improvements: The proposed attention mechanism and weight sharing help address the efficiency issues that plagued earlier CapsNet implementations, making them more suitable for large-scale text classification tasks.

Limitations and Future Work

  • Hyperparameter Sensitivity: While not explicitly detailed as a limitation, the extensive hyperparameter settings provided in Tables 2 and 3 suggest that careful tuning is required for optimal performance.
  • Future Work: The paper implicitly suggests future work in exploring more sophisticated attention mechanisms for even finer-grained interpretations and potentially applying iCapsNets to other NLP tasks beyond classification. The authors also mention the potential for adapting the model for even longer documents or different text structures.

Summary updated

BibTeX
@misc{wang2020icapsnets,
  author = {Zhengyang Wang and Xia Hu and Shuiwang Ji},
  title = {{iCapsNets: Towards Interpretable Capsule Networks for Text Classification}},
  year = {2020},
  eprint = {2006.00075},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.00075},
}
Figure