"What is Relevant in a Text Document?": An Interpretable Machine Learning Approach

Leila Arras, Franziska Horn, Grégoire Montavon, Klaus-Robert Müller, Wojciech Samek · DOI

Abstract

Text documents can be described by a number of abstract concepts such as semantic category, writing style, or sentiment. Machine learning (ML) models have been trained to automatically map documents to these abstract concepts, allowing to annotate very large text collections. Besides predicting the text's category very accurately, it is also highly desirable to understand how and why the categorization process takes place. In this paper, we demonstrate that such understanding can be achieved by tracing the classification decision back to individual words using layer-wise relevance propagation (LRP), a recently developed technique for explaining predictions of complex non-linear classifiers. We train two word-based ML models, a convolutional neural network (CNN) and a bag-of-words SVM classifier, on a topic categorization task and adapt the LRP method to decompose the predictions of these models onto words. Resulting scores indicate how much individual words contribute to the overall classification decision. This enables one to distill relevant information from text documents without an explicit semantic information extraction step. We further use the word-wise relevance scores for generating novel vector-based document representations which capture semantic information. Based on these document vectors, we introduce a measure of model explanatory power and show that, although the SVM and CNN models perform similarly in terms of classification accuracy, the latter exhibits a higher level of explainability which makes it more comprehensible for humans and potentially more useful for other applications.

Introduction

In the field of Natural Language Processing (NLP), high-performing models often function as "black boxes." While they can categorize documents with high accuracy, the underlying reasoning remains opaque. Understanding the "why" behind a prediction is critical for establishing trust, ensuring models do not rely on spurious correlations, and facilitating information extraction without complex semantic parsers. This research addresses the challenge of interpretability by applying Layer-wise Relevance Propagation (LRP) to text classification, allowing researchers to visualize which words drive a model's decision.

Methodology

The study evaluates two primary architectures: a word-embedding-based Convolutional Neural Network (CNN) and a Bag-of-Words (BoW) Support Vector Machine (SVM).

Layer-wise Relevance Propagation (LRP)

The core innovation is the adaptation of LRP for text. Originally designed for computer vision, LRP operates on a "conservation principle." It redistributes the final prediction score backward through the network layers until it reaches the input words. This process assigns a "relevance score" to each word, indicating its specific contribution to the final classification.

Architecture of the CNN and the LRP process for text classification.

As illustrated in Figure 1, the forward pass involves word2vec embeddings followed by convolution and max-pooling. The relevance propagation pass then uses weighted redistribution and winner-take-all strategies (corresponding to the max-pooling layer) to attribute importance back to the original text, creating a heatmap of relevance.

Document Summary Vectors

LRP scores are further utilized to create "Document Summary Vectors." By weighting word embeddings with their respective LRP relevance scores, the authors generate a single vector representing the semantic essence of a document. This approach allows for the distillation of relevant information without an explicit semantic information extraction step.

Experimental Setup

The models were evaluated using the 20Newsgroups dataset, specifically the 20news-bydate version to ensure temporal separation between training and testing. This dataset contains approximately 20,000 posts across 20 categories (e.g., sci.space, sci.med). CNNs were trained using pre-trained word2vec embeddings, while the SVM utilized a standard BoW approach.

Results and Discussion

Classification Accuracy vs. Explainability

The CNN and SVM models achieved nearly identical classification accuracy, both reaching approximately 80%. However, their internal logic differed significantly. LRP heatmaps reveal that CNNs exhibit a "sparsity of intelligence," focusing on semantically dense words (e.g., orbit, weightlessness) while ignoring noise. In contrast, the SVM often attributed relevance to common stop words like the or is.

Word Deletion and Explanatory Power

To validate the accuracy of LRP scores, the authors conducted word deletion experiments. Removing words in order of their LRP-assigned relevance caused the CNN's performance to drop significantly faster than when using Sensitivity Analysis (SA) or random deletion. This confirms that LRP effectively identifies the most critical features for the model's decision-making process.

Furthermore, the Explanatory Power Index (EPI) revealed that the CNN was superior at capturing underlying semantics. PCA projections of LRP-weighted document vectors showed much tighter and more distinct clusters for different topics compared to traditional TF-IDF or uniform weighting methods.

Conclusion

While CNNs and SVMs may appear equally capable based on accuracy alone, LRP reveals that CNNs are more "intelligent" filters of semantic information. By tracing decisions back to the input, LRP provides a robust framework for making deep learning models in NLP more transparent. Future work may extend these techniques to more complex architectures like Transformers or explore the impact of fine-tuning embeddings on interpretability.

Summary updated

BibTeX
@inproceedings{arras2017what,
  author = {Leila Arras and Franziska Horn and Grégoire Montavon and Klaus-Robert Müller and Wojciech Samek},
  title = {{"What is Relevant in a Text Document?": An Interpretable Machine Learning Approach}},
  booktitle = {PLoS},
  year = {2017},
  doi = {10.1371/journal.pone.0181142},
}
Figure