Skip to main content
QUICK REVIEW

[Paper Review] What Does a TextCNN Learn?

Linyuan Gong, Ruyi Ji|arXiv (Cornell University)|Jan 19, 2018
Topic ModelingComputer Science3 references4 citations
TL;DR

This paper analyzes what TextCNN learns by examining activation patterns of convolutional kernels on TREC and SST datasets. Using n-gram sensitivity analysis and kernel correlation measurements, it reveals that kernels learn label-specific features, generic grammar/topics, and exhibit strong inter-kernel cooperation—especially in deeper layers—offering interpretability insights into TextCNN's internal representations.

ABSTRACT

TextCNN, the convolutional neural network for text, is a useful deep learning algorithm for sentence classification tasks such as sentiment analysis and question classification. However, neural networks have long been known as black boxes because interpreting them is a challenging task. Researchers have developed several tools to understand a CNN for image classification by deep visualization, but research about deep TextCNNs is still insufficient. In this paper, we are trying to understand what a TextCNN learns on two classical NLP datasets. Our work focuses on functions of different convolutional kernels and correlations between convolutional kernels.

Motivation & Objective

  • To interpret the internal representations of TextCNN, a widely used model for sentence classification.
  • To understand what features individual convolutional kernels learn, especially in relation to text classification labels.
  • To analyze correlations between kernels to uncover functional relationships and potential redundancy.
  • To investigate how kernel functions differ between first and second convolutional layers.
  • To provide a quantitative, interpretable analysis of TextCNN's learned representations beyond black-box performance.

Proposed method

  • Extract all n-grams from training data and feed them into each convolutional kernel to record activation values after batch normalization and ReLU.
  • Label each kernel based on the top-3 activating n-grams: if they belong to the same class, assign that class; otherwise, label as 'other'.
  • Compute pairwise correlation coefficients between kernel activation vectors to measure functional similarity.
  • Visualize kernel correlations using activation graphs sorted by n-gram keywords to validate correlation measurements.
  • Identify 'bridge' kernels that connect otherwise uncorrelated kernels (r < 0.1) but are highly correlated with both (r > 0.4).
  • Apply the method to two datasets: TREC (question classification) and SST (sentiment analysis), using pre-trained Word2Vec embeddings and static weights.

Experimental results

Research questions

  • RQ1What kinds of linguistic features do individual convolutional kernels in a TextCNN learn?
  • RQ2How do kernel functions differ between the first and second convolutional layers in terms of label specificity and generality?
  • RQ3To what extent are kernels correlated, and what does this imply about functional redundancy or cooperation?
  • RQ4Can 'bridge' kernels that connect unrelated kernel pairs reveal shared semantic or syntactic patterns?
  • RQ5How do kernel behaviors reflect the underlying structure of the classification task?

Key findings

  • More than half of the kernels exhibit label-specific behavior, indicating functional specialization and division of labor in the network.
  • The number of kernels per class varies significantly: HUM and NUM require more kernels than ABBR, reflecting differences in recognition difficulty.
  • Kernels in the 'other' class learn generic features such as grammar patterns (e.g., 'is/are an adj. noun') or general topics (e.g., 'drama' or 'nation-related' concepts).
  • Correlation analysis shows stronger kernel correlations in the second layer (e.g., 619 pairs with r > 0.8) than in the first layer, suggesting deeper cooperation.
  • The second layer contains significantly more 'bridge' kernels (1,642) than the first layer (42), indicating stronger inter-kernel collaboration in deeper layers.
  • The presence of 'bridge' kernels connecting unrelated classes (e.g., HUM and NUM) reveals shared syntactic or semantic patterns that are not immediately obvious from labels alone.

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.