Introduction
Large language models (LLMs) have achieved remarkable performance across various tasks, yet they remain largely "black boxes." Their internal reasoning processes are often opaque, making it difficult for users to trust their outputs, especially in high-stakes domains like healthcare or education. Standard interpretability methods often rely on abstract visualizations that lack semantic meaning for non-experts. Furthermore, LLMs are prone to "hallucinations," where they generate plausible but factually incorrect justifications.
LMExplainer addresses these challenges by grounding LM reasoning in structured external knowledge. By anchoring an LM's internal logic to verifiable facts from Knowledge Graphs (KGs), the framework produces human-readable, contrastive explanations that enhance transparency and user trust.
The LMExplainer Framework
LMExplainer operates through a sophisticated three-step pipeline designed to extract, interpret, and explain the reasoning behind a model's prediction.
- Key Element Extraction and Building: The system retrieves a relevant subgraph from ConceptNet, a massive common-sense knowledge graph, based on the input context. This graph is pruned to retain only the top-$K$ nodes most relevant to the LM's internal state.
- Element-Graph Interpretation: A Graph Attention Network (GAT) identifies "reason-elements"—specific nodes and relationships within the subgraph that most significantly influenced the LM's decision.
- Explanation Generation and Debugging:
- Two-Stage Generation: The system generates a contrastive explanation. Stage 1 ("why-choose") justifies the predicted answer using the identified reason-elements. Stage 2 ("why-not-choose") explains why alternative options were rejected.
- LM Debugger: A high-performing LLM (e.g., GPT-4) evaluates the explanation's faithfulness, completeness, minimality, and accuracy, providing actionable advice for model improvement.
Experimental Setup and Results
The researchers evaluated LMExplainer on two major benchmarks: CommonsenseQA (common-sense reasoning) and OpenBookQA (elementary science).
The framework demonstrated significant performance gains over existing state-of-the-art models. On CommonsenseQA, LMExplainer using RoBERTa-large achieved 77.31% accuracy, outperforming GreaseLM by 4.71%. When integrated with Llama-2-7B, it reached 79.40% on OpenBookQA, showing that structured knowledge benefits even the largest models.
Beyond accuracy, human evaluation scores for "Understandability" and "Completeness" exceeded 0.95/1.0. Notably, the LM Debugger achieved 100% accuracy in identifying reliable predictions based on explanation quality.
Key Insights: Grounding and Contrastive Reasoning
A core innovation of LMExplainer is its use of "contrastive explanations." By explaining why other options were not chosen, the model aligns more closely with human reasoning patterns.
This grounding serves as an antidote to hallucinations. By forcing the explanation to rely on verifiable KG nodes, the model is less likely to invent spurious logic. Furthermore, the "LM Debugger" transforms interpretability into a developmental tool, helping researchers identify where training data may be lacking or where the model's logic is flawed.
Limitations and Future Work
While effective, LMExplainer's performance is inherently tied to the quality and coverage of the underlying Knowledge Graph. If the required knowledge is missing from ConceptNet, the explanation quality may suffer. Additionally, the subgraph processing adds computational overhead compared to standard inference. Future research will focus on expanding the framework to open-ended reasoning tasks and integrating more diverse knowledge sources.
Summary updated