Explainability for Large Language Models: A Survey

Haiyan Zhao, Hanjie Chen, Fan Yang, Ninghao Liu, Huiqi Deng, Hengyi Cai, Shuaiqiang Wang, Dawei Yin, Mengnan Du

TL;DR

This survey paper provides a comprehensive taxonomy of explainability techniques for Transformer-based Large Language Models (LLMs). It categorizes the field into traditional fine-tuning and modern prompting paradigms, detailing how researchers extract local and global explanations, evaluate their reliability, and leverage them to debug and improve model performance.

What Problem Does This Paper Address?

As LLMs are increasingly deployed in commercial products, their complex, "black-box" nature poses significant risks, including hallucinations, embedded biases, and the generation of harmful content. Understanding the inner workings of these models is crucial for building user trust and ensuring safety.

However, explaining modern LLMs introduces a massive challenge: traditional feature attribution methods (like gradient-based techniques or SHAP values) require immense computational power when scaled to billions of parameters. Furthermore, emergent abilities like in-context learning and chain-of-thought prompting require entirely new explanatory frameworks. This paper addresses this gap by structuring the fragmented landscape of LLM interpretability research.

Methods

The authors introduce a structured taxonomy that divides LLM explainability into two dominant training paradigms:

  1. Traditional Fine-Tuning Paradigm (e.g., BERT, RoBERTa): Explanations here focus on how self-supervised pre-training captures language fundamentals and how fine-tuning adapts them to downstream tasks. This is split into:
  2. Local Explanations: Feature attribution (perturbation, gradients, surrogate models, decomposition), attention-weight visualizations, example-based explanations (adversarial/counterfactual), and natural language explanations.
  3. Global Explanations: Probing-based classifiers, neuron activation analysis, concept-based explanations (e.g., TCAV), and mechanistic interpretability (mapping circuits).
  4. Prompting Paradigm (e.g., GPT-3.5/4, LLaMA): This focuses on massive models (>1B parameters) and is split by development stage:
  5. Base Models: Explaining how models leverage pre-trained knowledge via in-context learning, chain-of-thought (CoT) prompting, and representation engineering.
  6. Assistant Models: Investigating the role of alignment (instruction tuning and RLHF), analyzing hallucinations, and quantifying model uncertainty.

The overall taxonomy of these methods is illustrated in Figure 1.

Figure 1: We categorize LLM explainability into two major paradigms. Based on this categorization, we sum- marize different kinds of explainability techniques associated with LLMs belonging to these two paradigms. We also discuss evaluations for the generated explanations under the two paradigms.

Datasets

While this is a survey paper and does not introduce a new dataset, it highlights several key benchmarks used across the literature to evaluate explainability:

  • GLUE Benchmark (SST-2, MNLI, QQP): Used extensively to evaluate local explanations in fine-tuned models.
  • ERASER: A benchmark designed to evaluate rationalized NLP models based on human-annotated rationales.
  • IMDB Sensitivity Dataset: Utilized for testing concept-based explanations (like Testing with Concept Activation Vectors, or TCAV).
  • BigBench Hard: Used to benchmark complex zero-shot reasoning capabilities during explanation tuning.

Key Insights and Ideas

  • Pre-training vs. Alignment: Evidence suggests that almost all factual knowledge is acquired during unsupervised pre-training. Supervised fine-tuning and RLHF (the pipeline shown in Figure 2) primarily teach the model the style and format required to interact as an assistant, effectively "activating" pre-existing knowledge.
  • Unfaithful Chain-of-Thought: CoT explanations can be systematically unfaithful. When models are fed biased prompts (e.g., reordering multiple-choice options so the answer is always "A"), they will alter their predictions based on the bias but completely omit this influence from their generated text explanations.
  • The Reversal Curse: LLMs suffer from severe logical deduction limitations. If a model is trained on "A is B," it fails to automatically infer that "B is A," proving that surface-level memorization often overrides robust reasoning.
  • Mechanistic "Induction Heads": In smaller attention-only models, researchers identified specific two-layer circuits called "induction heads" that handle pattern replication, which is hypothesized to be the primary driver behind in-context learning.
Figure 2: LLMs undergo unsupervised pre-training with random initialization to create a base model. The base model can then be fine-tuned through instruction tuning and RLHF to produce the assistant model.

Key Results

  • Performance Gains via Explanations: Aligning machine rationales with human feedback using explanation regularization frameworks (like XMD) improves out-of-distribution (OOD) generalization on text classification tasks by up to 18%.
  • Prompt Compression: Ablation analysis reveals that up to 60% of task instruction tokens can be safely removed (leaving only label-relevant information) without degrading the performance of models like T5-XL.
  • Adversarial Vulnerability: Advanced token-level perturbation frameworks (like SemAttack) can successfully manipulate embedding spaces, dropping BERT's accuracy from 70.6% to 2.4% by changing just 5% of the words.
  • Automated Neuron Labeling: Using GPT-4 to automatically synthesize natural language descriptions for neurons in GPT-2 XL successfully mapped over 1,000 neurons to distinct, high-level concepts (e.g., identifying a specific neuron that activates for movie references).
Figure 3: Local explanation is composed of four subareas. The organization of each subarea and examples for certain individual explanation methodology have been given. (a) Bipartite graph attention representa- tion for attention matrix between sentence A and sentence B at the 6th layer (Vig, 2019); (b) Perturb the question by deleting “did”, the confidence of the answer “Colorado Springs experiments” has even increased for the reduced question while the answer is nonsense for human (Feng et al., 2018); (c) Shapley values for transformer-based language models (Chen et al., 2023c); (d) Provide explanation to the important compo- nents of input text to assist in commonsense reasoning (Rajani et al., 2019); (e) Provide negative examples of input text to test model’s ability in sentiment prediction and can also be used to improve model perfor- mance (Wu et al., 2021); (f) Change the input text in an imperceptible way for humans but the classification is distracted from the original (Jin et al., 2020).

Limitations and Future Work

  • Explanation without Ground Truths: A major bottleneck is the lack of gold-standard benchmark datasets to validate global explanations of individual LLM components, making it difficult to verify if an explanation is truly faithful to the model's internal logic.
  • Attention Redundancy: Multiple studies show massive attention redundancy in both BERT and OPT-66B, meaning many attention heads can be pruned with zero performance loss. This opens up significant opportunities for model compression.
  • Shifting to Temporal Analysis: Most current interpretability research provides a static "snapshot" of fully trained models. The authors emphasize an emerging trend toward temporal analysis—evaluating checkpoints across the training timeline to understand exactly when and how specific capabilities or biases develop.

Summary updated

BibTeX
@article{zhao2024explainability,
  author = {Haiyan Zhao and Hanjie Chen and Fan Yang and Ninghao Liu and Huiqi Deng and Hengyi Cai and Shuaiqiang Wang and Dawei Yin and Mengnan Du},
  title = {{Explainability for Large Language Models: A Survey}},
  journal = {ACM Transactions on Intelligent Systems and Technology},
  year = {2024},
  url = {https://openreview.net/forum?id=s17fANh74J},
}
Figure