Towards Explainable NLP: A Generative Explanation Framework for Text Classification

Hui Liu, Qingyu Yin, William Yang Wang

Abstract: Hui Liu, Qingyu Yin, William Yang Wang. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.

2019.

Introduction

Deep learning models have achieved state-of-the-art results in Natural Language Processing (NLP), yet they remain largely "black boxes." For critical applications, users need to understand the rationale behind a model's decision—for instance, why a product received a 1-star rating. While post-hoc visualizations like heatmaps offer some insight, they lack the structured, fine-grained reasoning humans use. This paper introduces the Generative Explanation Framework (GEF), a multi-task learning approach that requires models to explain their reasoning in human-readable terms, such as natural language or fine-grained sub-scores, while simultaneously performing classification.

The Generative Explanation Framework (GEF)

The GEF architecture is designed to ensure that generated rationales are not merely side-outputs but are logically grounded in the final prediction. The framework consists of four primary components:

  1. Encoder ($E$): Maps the input text into a latent representation $v_e$.
  2. Predictor ($P$): Derives the final category prediction (e.g., a star rating) from $v_e$.
  3. Generator ($G$): Produces fine-grained explanations ($e_c$), which can be textual summaries or numerical sub-scores.
  4. Classifier ($C$): A pre-trained, fixed component that predicts the final label using only ground-truth explanations. During training, it evaluates the generated explanations to ensure they support the intended label.
The GEF architecture showing the interaction between the Encoder, Generator, Predictor, and the pre-trained Classifier.

The Explainable Factor (EF) and Minimum Risk Training

A core innovation of GEF is the Explainable Factor (EF). This metric measures the consistency between the prediction based on the raw text, the prediction based on the generated explanation, and the prediction based on the "golden" (human-provided) explanation. By employing Minimum Risk Training (MRT), the model is optimized to minimize the risk that its generated rationales lead to a different conclusion than the raw text or the ground truth, creating a tight coupling between the label and its explanation.

Datasets and Experimental Setup

The researchers evaluated GEF using two distinct datasets to test both textual and numerical explanation capabilities:

  • PCMag Review Dataset: Features long product reviews with overall ratings (1-5) and three short textual comments (Positive, Negative, and Neutral) serving as fine-grained explanations.
  • Skytrax User Reviews: Contains flight reviews with overall ratings (1-10) and five numerical sub-scores (e.g., seat comfort, cabin staff, food quality) as explanations.

Key Results

Improved Classification Accuracy

Integrating explanation generation actually improved primary task performance. On the PCMag dataset, classification accuracy rose from 42.58% (baseline CVAE) to 43.67%. Similarly, on the Skytrax dataset, accuracy increased from 38.06% (LSTM) to 39.20%. This suggests that explanations act as a "distilled" logic that helps the model learn more robust representations.

Higher Quality Explanations

The quality of generated text saw significant improvements over baselines. As shown in the table below, BLEU scores for generated explanations across all sentiments (Positive, Negative, Neutral) improved when the GEF framework was applied.

Comparison of BLEU scores between the baseline CVAE and the CVAE+GEF model across different sentiment categories.

Human Evaluation and Sub-field Accuracy

In crowdsourced evaluations, humans preferred GEF-generated explanations over baseline outputs in 51.37% of cases. Furthermore, the model demonstrated superior accuracy in predicting specific numerical sub-scores (like "food quality") compared to standard multi-task baselines, indicating a better grasp of fine-grained details.

Conclusion and Future Work

The GEF framework demonstrates that generating explanations can mutually reinforce classification accuracy. However, challenges remain: generated explanations are often shorter than human ones, and the model occasionally struggles with domain-specific rare words. Future research may involve incorporating "copy-mechanisms" to handle jargon or applying the framework to Transformer-based architectures to further enhance performance and generalizability.

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