Variational Language Concepts for Interpreting Foundation Language Models

Hengyi Wang, Shiwei Tan, Zhiqing Hong, Desheng Zhang, Hao Wang

Abstract

Foundation Language Models (FLMs) such as BERT and its variants have achieved remarkable success in natural language processing. To date, the interpretability of FLMs has primarily relied on the attention weights in their self-attention layers. However, these attention weights only provide word-level interpretations, failing to capture higher-level structures, and are therefore lacking in readability and intuitiveness. To address this challenge, we first provide a formal definition of conceptual interpretation and then propose a variational Bayesian framework, dubbed VAriational Language Concept (VALC), to go beyond word-level interpretations and provide concept-level interpretations. Our theoretical analysis shows that our VALC finds the optimal language concepts to interpret FLM predictions. Empirical results on several real-world datasets show that our method can successfully provide conceptual interpretation for FLMs.

Introduction

Foundation Language Models (FLMs) have revolutionized NLP, yet they remain largely "black boxes." Current interpretability methods rely heavily on attention weights to explain model behavior. While useful, these weights provide only word-level insights, which are often noisy, unstable, and fail to capture the high-level semantic structures humans use to understand text. For instance, a model might highlight the word "Senate," but it does not explicitly communicate that its prediction is driven by the broader concept of "Politics."

The VALC Framework

To bridge this gap, we introduce the VAriational Language Concept (VALC) framework. VALC moves beyond word-level scores to provide human-readable "concept-level" explanations. It treats an FLM's contextual word embeddings and attention weights as observed variables within a variational Bayesian generative model.

A key innovation in VALC is treating attention weights as "virtual word counts." Unlike traditional topic models like Latent Dirichlet Allocation (LDA) that rely on discrete counts, VALC leverages the continuous attention signals from the FLM. This allows the framework to naturally prioritize words the model deems important while ignoring "stop words" (like "the" or "a") that typically receive low attention.

The three-level hierarchy of VALC: Dataset-level concepts, Document-level proportions, and Word-level mappings.

As illustrated in Figure 1, VALC operates across a three-level hierarchy:

  1. Dataset-Level: Concepts are modeled as Gaussian distributions in the embedding space.
  2. Document-Level: Represents a document's relationship to various concepts (topic proportions).
  3. Word-Level: Maps individual words to specific concepts.

Theoretical and Practical Advantages

VALC is designed to be multi-level, normalized, and additive. The additivity property is particularly powerful; it allows for "concept editing," where users can add or subtract a concept vector from a word embedding to observe the resulting change in the FLM's prediction. This provides a rigorous test of whether the identified concepts are truly the drivers of the model's logic.

Furthermore, VALC leverages contextual embeddings. Unlike static embeddings used in older topic models, VALC can distinguish between different meanings of the same word based on its surroundings (e.g., "soft" in a software context versus a textile context). The authors prove that maximizing the Evidence Lower Bound (ELBO) in this framework is mathematically equivalent to finding an optimal conceptual interpretation that maximizes mutual information between concepts and internal representations.

Experimental Results

We evaluated VALC on several benchmarks, including 20 Newsgroups, M10 (scientific papers), and BBC News, as well as NLU tasks from the GLUE benchmark.

Performance comparison of VALC against baselines in terms of accuracy and accuracy gain across three datasets.

As detailed in Figure 6, VALC consistently outperforms or matches state-of-the-art baselines like SHAP/LIME, BERTopic, and CETopic in identifying the true drivers of model predictions. In "faithfulness" evaluations—measuring how accurately explanations reflect the model's actual decision logic—VALC achieved 99.5% faithfulness on the M10 dataset, significantly higher than BERTopic’s 87.6%. Qualitative analysis further revealed that VALC can diagnose misclassifications, such as identifying when a biology paper is mislabeled due to the presence of "economics" related concepts.

Conclusion

VALC provides a robust, theoretically grounded framework for interpreting FLMs at a conceptual level. While it requires access to the model's internal layers—limiting its use for closed-API models—it offers unprecedented clarity for researchers working with open-weight foundation models. Future work will explore extending VALC to more complex tasks like Named Entity Recognition and Question Answering.

Summary updated

BibTeX
@inproceedings{wang2024variational,
  author = {Hengyi Wang and Shiwei Tan and Zhiqing Hong and Desheng Zhang and Hao Wang},
  title = {{Variational Language Concepts for Interpreting Foundation Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=099xdxZ5pd},
}
Figure