Abstract
While Hierarchical Attention Networks (HANs) have achieved state-of-the-art performance in text classification, their internal decision-making processes remain largely opaque. This paper introduces FEHAN (Framework for Explaining HiErarchical Attention Networks), a modular approach designed to provide faithful, word-level saliency maps. By leveraging Markov Chains to generate semantically coherent neighborhoods and training decision tree surrogates, FEHAN offers explanations that are more consistent and representative of the underlying model's logic than existing model-agnostic tools like LIME.
Introduction
Deep learning models for natural language processing, particularly those utilizing hierarchical attention, are highly effective but function as "black boxes." While the attention mechanism highlights important words and sentences, these raw scores are often ambiguous; they indicate that a segment is important without explaining how it contributes to a specific classification. Existing explainers like LIME attempt to solve this by perturbing inputs through random word deletion. However, this often results in nonsensical documents that fall outside the data distribution, leading to "unfaithful" explanations. FEHAN addresses this by preserving the semantic essence of a document while exploring its local neighborhood.
The FEHAN Framework
FEHAN is structured as a four-step modular pipeline designed to extract meaningful local explanations from a trained HAN classifier.
- Informative Sentence (IS) Extraction: The framework utilizes the HAN’s internal sentence-level attention layer to pinpoint the most influential sentences within a document.
- Neighborhood Generation via Markov Chains: To avoid the pitfalls of random deletion, FEHAN employs a Markov Chain text generator. This creates synthetic sentences that are semantically similar to the original informative ones, ensuring the "vicinity" data remains linguistically plausible.
- Synthetic Document Creation: A neighborhood of new documents is generated by swapping original informative sentences with these synthetic variants. This method keeps the non-essential context intact while varying the critical components the model relies on for classification.
- Interpretable Surrogate Model: These synthetic documents are processed by the black-box HAN to obtain labels. Finally, a Decision Tree is trained on this local neighborhood. The resulting tree paths provide the final word-level saliency map, explaining the model's logic in a human-readable format.
Experimental Evaluation
The framework was evaluated across four diverse sentiment analysis benchmarks: IMDB (movie reviews), Yelp (business reviews), Amazon (product reviews), and U.S. Airline Tweets. The primary metric for success was fidelity—the degree to which the surrogate model accurately mimics the behavior of the black-box HAN.
Results and Discussion
FEHAN demonstrated significant improvements over the baseline LIME explainer in both quantitative and qualitative assessments:
- Superior Fidelity: Across all four datasets, FEHAN’s decision tree surrogate matched the HAN’s predictions more accurately than LIME’s linear model. This suggests that the Markov Chain-based neighborhood is a more effective representation of the local decision boundary.
- Consistency: Box plots of fidelity scores revealed that FEHAN is substantially more stable. While LIME often produces erratic results due to its random perturbation strategy, FEHAN’s semantic approach leads to reduced variance.
- Qualitative Clarity: Saliency maps produced by FEHAN are cleaner and more intuitive. As seen in practical examples, the framework highlights specific sentiment-bearing words (e.g., "great," "love," "reasonable") while ignoring noise that often confuses other explainers.
Conclusion
FEHAN represents a step forward in making hierarchical deep learning models interpretable. By moving away from random perturbations and toward semantically grounded neighborhood generation, the framework provides explanations that are both faithful to the model and clear to the end-user. Future work will explore the integration of more advanced embedding models like BERT and the application of text summarization techniques to further refine the identification of salient sentences.
Summary updated