Abstract
As Transformer-based models become integral to high-stakes decision-making, the need for reliable and interpretable Explainable AI (XAI) grows. EvalxNLP is a novel Python framework designed to standardize the evaluation of post-hoc feature attribution methods in Natural Language Processing (NLP). By benchmarking eight popular explainers across dimensions of faithfulness, plausibility, and complexity, and integrating Large Language Model (LLM) verbalization, EvalxNLP provides a unified suite for researchers and stakeholders to assess and understand model logic.
Introduction
The rapid adoption of complex deep learning models in industries like medicine and finance has highlighted a critical liability: their "black box" nature. While numerous feature attribution methods exist to identify which input tokens drive a model's prediction, the field lacks a universal consensus on evaluation. Existing frameworks often cater to image or tabular data, leaving NLP researchers with fragmented metrics. Furthermore, the raw outputs of these methods—typically importance scores or heatmaps—remain difficult for non-experts to interpret. EvalxNLP addresses these gaps by providing a reproducible benchmarking workflow specifically tailored for text classification.
The EvalxNLP Framework
EvalxNLP integrates three core components into a single pipeline: explainers, metrics, and verbalization.
1. Feature Attribution Methods
The framework supports eight post-hoc explainers, categorized into:
- Gradient-based methods: Including Saliency, Integrated Gradients, and DeepLIFT, which utilize internal model gradients for efficiency.
- Perturbation-based methods: Including LIME, SHAP, and SHAP-I (which accounts for feature interactions), treating the model as a black box to observe output changes relative to input modifications.
2. Evaluation Metrics
Rather than relying on a single performance score, EvalxNLP evaluates explanations across three critical axes:
- Faithfulness: Measuring how accurately the explanation reflects the model's internal logic using "soft" perturbation metrics.
- Plausibility: Assessing alignment with human intuition using ground-truth rationales from datasets like MovieReviews, HateXplain, and e-SNLI.
- Complexity: Evaluating the conciseness and clarity of the generated explanation.
3. LLM-Powered Verbalization
A unique feature of EvalxNLP is its use of LLMs (such as Llama 3.3-70B) to translate technical scores into plain-English summaries. This bridges the gap between data-heavy heatmaps and human understanding.
Key Insights and Benchmarking Results
A case study using an XLM-RoBERTa model on sentiment analysis revealed that no single explainer excels in every category. DeepLIFT (DL) emerged as the most faithful to the model's internal logic, while Integrated Gradients (IG) produced the least complex explanations. SHAP consistently aligned most closely with human rationales, achieving the highest plausibility scores (Token F1 of 0.316).
The framework also highlights the importance of "soft" perturbations. Traditional methods that delete tokens can disrupt the model's input distribution, leading to misleading results. EvalxNLP advocates for Bernoulli masks to provide a more stable and accurate reflection of model behavior.
Human Evaluation and User Satisfaction
To validate the framework's utility, a study was conducted with 20 participants, including data scientists, researchers, and developers. The results indicated high overall satisfaction, with scores consistently exceeding 3/5 across metrics such as ease of use and interpretability. While experienced NLP researchers provided more critical feedback regarding the depth of benchmarking, the framework was highly praised for its ability to democratize XAI for non-expert stakeholders.
Conclusion and Future Directions
EvalxNLP represents a significant step toward standardizing NLP explainability. While currently focused on text classification and feature attribution, future iterations aim to support sequence-to-sequence tasks and incorporate robustness metrics to ensure explanations remain stable under minor input variations. By combining rigorous quantitative benchmarking with natural language verbalization, EvalxNLP helps move XAI from the research lab into practical, trustworthy applications.
Summary updated