Skip to main content
QUICK REVIEW

[Paper Review] Understanding Convolutional Neural Networks for Text Classification

Alon Jacovi, Oren Sar Shalom|arXiv (Cornell University)|Sep 21, 2018
Explainable Artificial Intelligence (XAI)Computer Science23 references24 citations
TL;DR

This paper investigates how 1D convolutional neural networks (CNNs) process and classify text, challenging the common assumption that filters act as homogeneous n-gram detectors. It reveals that filters detect multiple semantic n-gram families via distinct activation patterns, max-pooling induces thresholding that filters out irrelevant n-grams (with 40% of pooled n-grams removable without performance loss), and filters actively suppress negated n-grams. These insights enable improved model and prediction interpretability through filter-level analysis and threshold-aware explanation methods.

ABSTRACT

We present an analysis into the inner workings of Convolutional Neural Networks (CNNs) for processing text. CNNs used for computer vision can be interpreted by projecting filters into image space, but for discrete sequence inputs CNNs remain a mystery. We aim to understand the method by which the networks process and classify text. We examine common hypotheses to this problem: that filters, accompanied by global max-pooling, serve as ngram detectors. We show that filters may capture several different semantic classes of ngrams by using different activation patterns, and that global max-pooling induces behavior which separates important ngrams from the rest. Finally, we show practical use cases derived from our findings in the form of model interpretability (explaining a trained model by deriving a concrete identity for each filter, bridging the gap between visualization tools in vision tasks and NLP) and prediction interpretability (explaining predictions). Code implementation is available online at github.com/sayaendo/interpreting-cnn-for-text.

Motivation & Objective

  • To understand the inner workings of CNNs in text classification, challenging the assumption that filters act as homogeneous n-gram detectors.
  • To investigate the role of global max-pooling in filtering relevant from irrelevant n-grams in text CNNs.
  • To examine whether filters detect semantic families or negative cues, such as negated n-grams.
  • To develop improved model-level and prediction-level interpretability techniques grounded in empirical filter analysis.

Proposed method

  • Analyzes filter responses across multiple text classification datasets to identify activation patterns and semantic clusters of high-scoring n-grams.
  • Applies clustering to high-activation n-grams based on their slot-activation vectors to reveal distinct linguistic patterns per filter.
  • Uses thresholding analysis to determine which n-grams are effectively ignored by max-pooling, showing 40% of pooled n-grams can be removed without performance loss.
  • Introduces a method to decompose filter activations into word-level contributions by maximizing over vocabulary, revealing non-homogeneous filter behavior.
  • Proposes a prediction interpretability method that highlights only n-grams passing the filter threshold and marks negative n-gram patterns via slot-activation analysis.
  • Employs a small CNN model with ten filters to demonstrate interpretability improvements on the Amazon Electronics (Elec) dataset.

Experimental results

Research questions

  • RQ1Do CNN filters in text classification act as homogeneous detectors for a single family of n-grams, or do they respond to multiple semantic classes?
  • RQ2To what extent does global max-pooling induce a thresholding behavior that filters out irrelevant n-grams from the final prediction?
  • RQ3Do filters detect not only positive n-gram patterns but also actively suppress related negative or negated n-grams?
  • RQ4Can we derive a more informative and structured summary for each filter by analyzing its activation patterns and semantic clusters?
  • RQ5Can we improve prediction interpretability by focusing only on n-grams that pass the filter threshold and by identifying negative cues in n-gram composition?

Key findings

  • Max-pooling in text CNNs induces a thresholding behavior, where 40% of pooled n-grams can be removed without affecting model performance, indicating that only a subset of n-grams are functionally relevant.
  • Filters are not homogeneous; a single filter can detect multiple distinct semantic families of n-grams, as revealed by clustering high-activation n-grams by their slot-activation patterns.
  • Filters often assign negative values to specific words to suppress entire n-grams, even when other words in the n-gram are highly activating, demonstrating active negation behavior.
  • Filters are sensitive to naturally occurring n-grams and can be significantly misled by non-natural n-grams, indicating they are trained on real linguistic patterns.
  • By analyzing slot-activation vectors and clustering high-scoring n-grams, filters can be assigned a concrete semantic identity, enabling improved model interpretability.
  • Prediction interpretability is enhanced by focusing only on n-grams that pass the filter threshold and by identifying negative n-gram patterns, resulting in more concise and accurate explanations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.