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.
Introduction
While Convolutional Neural Networks (CNNs) have revolutionized NLP tasks like sentence classification, they are notoriously difficult to interpret. In computer vision, researchers can visualize what a filter "sees" (like edges or textures), but in text, the relationship between a convolutional kernel and the underlying language is less intuitive. This paper addresses this interpretability gap by revealing that convolutional kernels in TextCNNs are not random feature extractors—they specialize. By analyzing n-gram activations, we show that kernels learn specific semantic labels, grammatical structures, and even act as "bridges" that connect disparate concepts.
Methodology
We utilized a two-layer TextCNN architecture and employed three primary techniques to interrogate the model's internal logic:
- Kernel Labeling: We tracked which n-grams triggered the highest activations for each kernel. If a kernel’s top-3 favorite n-grams belonged to the same class (e.g., "Human" type questions in the TREC dataset), the kernel was labeled with that class.
- Correlation Analysis: We calculated the correlation coefficient ($r$) between the activation vectors of different kernels to determine if they were extracting redundant information.
- Bridge Identification: We defined a "bridge" as a kernel that correlates strongly with two other kernels, even if those two other kernels have almost no correlation with each other. This identifies kernels that synthesize information from different semantic domains.
Our experiments were conducted on two classic NLP benchmarks: the TREC question classification dataset and the SST (Stanford Sentiment Treebank) movie review dataset.
Kernel Specialization and the Division of Labor
Our analysis reveals that more than half of the kernels in the model develop a clear preference for a specific semantic label. This proves that the network naturally decomposes a complex classification task into specialized sub-tasks. For instance, in the TREC dataset, the "Human" (HUM) and "Numeric" (NUM) classes required the most kernels to identify, suggesting these categories are more complex for the model to distinguish than others like "Abbreviations" (ABBR).
Kernels that did not map to a specific label (labeled as "Other") were not merely noise. Instead, they often learned grammatical patterns—such as identifying "is/an + adjective + noun" structures—or general topics that appear across multiple classes.
Layer Redundancy and Correlation
A significant finding is the massive spike in correlation between kernels as the network deepens. In the TREC model, we identified only 39 pairs of highly correlated kernels ($r > 0.8$) in the first layer, but this number jumped to 619 pairs in the second layer. This suggests that the second layer is much more redundant than the first, indicating potential for model compression through pruning without losing performance.
Conceptual Bridges
The discovery of "bridge" kernels is perhaps the most fascinating insight into the model's logic. These kernels act as functional links between distinct categories. For example, we found a kernel that responded to both "Who" (human) and "How many" (numeric) patterns. The second layer contained significantly more bridges (1,642) than the first layer (42), indicating that deeper layers are where the model performs the heavy lifting of merging disparate features into a cohesive representation.
Conclusion
By moving beyond simple accuracy metrics, we have shown that TextCNNs develop a sophisticated internal hierarchy of specialized kernels and conceptual bridges. While many kernel functions were successfully identified, a significant number of "Other" kernels still have functions that remain unknown to humans. Future work will focus on refining the boundary between kernels that learn grammar versus those that learn general topics, and applying this correlation analysis to other deep learning architectures.
Summary updated