Towards Explainable NLP: A Generative Explanation Framework for Text Classification

Hui Liu, Qingyu Yin, William Yang Wang

Abstract

Building explainable systems is a critical problem in the field of Natural Language Processing (NLP), since most machine learning models provide no explanations for the predictions. Existing approaches for explainable machine learning systems tend to focus on interpreting the outputs or the connections between inputs and outputs. However, the fine-grained information is often ignored, and the systems do not explicitly generate the human-readable explanations. To better alleviate this problem, we propose a novel generative explanation framework that learns to make classification decisions and generate fine-grained explanations at the same time. More specifically, we introduce the explainable factor and the minimum risk training approach that learn to generate more reasonable explanations. We construct two new datasets that contain summaries, rating scores, and fine-grained reasons. We conduct experiments on both datasets, comparing with several strong neural network baseline systems. Experimental results show that our method surpasses all baselines on both datasets, and is able to generate concise explanations at the same time.

Introduction

Deep learning models have achieved state-of-the-art performance in various NLP tasks, such as sentiment analysis and automated grading. However, these models are often "black boxes," providing little to no rationale for their decisions. This lack of transparency is a significant barrier to user trust. For example, a student receiving an automated grade on an essay is likely to demand specific feedback rather than just a numerical score.

Existing explainability methods typically rely on post-hoc interpretations, such as saliency maps that highlight influential words. While useful, these methods fail to provide the structured, human-readable, fine-grained information that people naturally use to justify judgments. This paper addresses this gap by proposing a system that explicitly captures and generates fine-grained explanations during the classification process.

Methodology: The Generative Explanation Framework (GEF)

The proposed Generative Explanation Framework (GEF) is a hybrid generative-discriminative model designed to produce both a classification label and a supporting rationale. The architecture consists of three primary components:

  1. Encoder-Predictor: This module encodes the input text into a latent representation vector ($v_e$), which is then used to predict the final category label.
  2. Generator: An abstractive module, often implemented as a Conditional Variational Autoencoder (CVAE), that takes the representation vector and generates fine-grained explanations, such as short summaries of product pros and cons.
  3. The Explainable Factor (EF): This is the framework's core innovation. It measures the semantic distance between the generated explanations and ground-truth ("golden") explanations, ensuring the rationales are relevant to the original text and consistent with the predicted label.
The architecture of the Generative Explanation Framework (GEF)

To optimize the system, the authors employ Minimum Risk Training (MRT). A pre-trained "Oracle" classifier—trained on ground-truth explanations—acts as a judge to evaluate how well the generated explanations support the predicted label. This objective encourages the model to learn representations that are not only effective for classification but also rich enough to produce valid, human-like rationales.

Datasets

The framework was evaluated on two newly constructed datasets designed to test both textual and numerical explanations:

  • PCMag Review Dataset: This dataset includes long product reviews paired with three short summaries (positive, negative, and neutral perspectives) and an overall rating score.
  • Skytrax User Reviews Dataset: An airline review dataset containing raw text, overall ratings, and five numerical sub-field scores (e.g., seat comfort, cabin staff) that serve as fine-grained explanations.

Experimental Results

The GEF framework consistently outperformed baseline models across both datasets, demonstrating that generating explanations can actually enhance classification performance.

Classification Accuracy

On the PCMag dataset, the CVAE+GEF model achieved a classification accuracy of 43.67%, a notable improvement over the base CVAE model's 42.58%. This suggests that the fine-grained information required for explanation generation provides "strong guidance" for the text encoder, leading to better overall representations. Notably, the "Oracle" model—which uses ground-truth explanations as input—achieves even higher accuracy (46.73%), confirming that structured attributes are a more reliable signal for final judgment than unstructured prose.

Classification accuracy on the PCMag Review Dataset

Explanation Quality

  • Textual Quality: GEF-enhanced models achieved significantly higher BLEU scores for generated explanations compared to standard CVAE baselines.
  • Human Evaluation: In blind tests, human judges preferred GEF-generated explanations over baseline outputs in 51.37% of cases, citing better coherence and relevance.
  • Numerical Precision: On the Skytrax dataset, GEF improved the accuracy of predicting specific sub-field scores (like "seat comfort") across both LSTM and CNN architectures.

Conclusion and Future Work

The Generative Explanation Framework represents a significant step toward transparent NLP systems. By bridging the gap between classification and explanation, GEF ensures that models provide rationales that are semantically aligned with their decisions.

Future research will focus on addressing current limitations, such as the brevity of generated explanations and the handling of rare, domain-specific words. The authors suggest that incorporating reinforcement learning or copy mechanisms could further enhance the informativeness and technical accuracy of the generated text. Additionally, exploring GEF's applicability to other tasks like automated summarization remains a promising direction.

Summary updated

BibTeX
@inproceedings{liu2019towards,
  author = {Hui Liu and Qingyu Yin and William Yang Wang},
  title = {{Towards Explainable NLP: A Generative Explanation Framework for Text Classification}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  url = {https://openreview.net/forum?id=Wli-sv5HDw},
}
Figure