ConceptX: A Framework for Latent Concept Analysis

Firoj Alam, Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Abdul Rafae Khan, Jia Xu

Introduction

Pre-trained language models (pLMs) like BERT and XLM-RoBERTa have revolutionized natural language processing, yet their internal mechanisms remain largely opaque. Traditional interpretability research often relies on "probing," a technique that tests whether a model's internal representations encode specific, human-defined linguistic features such as part-of-speech tags or syntactic dependencies. However, this approach is inherently limited: it can only confirm the presence of concepts we already know to look for. It fails to capture "latent concepts"—novel groupings or task-specific representations that the model may have developed independently to optimize its performance.

ConceptX is introduced as a human-in-the-loop framework designed to bridge this gap. By combining unsupervised clustering with an interactive annotation interface, ConceptX allows researchers to discover, visualize, and label the hidden conceptual landscape within a model's high-dimensional representational space.

Methodology: The ConceptX Pipeline

The ConceptX framework operates through a multi-stage pipeline that transitions from raw model data to human-understandable labels.

The ConceptX framework pipeline, showing the transition from model feature vectors to human-annotated latent concepts.

1. Concept Discovery

The process begins with a forward pass of a corpus through the target language model. For every word instance, the system extracts its contextualized representation (feature vector) from specific layers. These vectors are then grouped using Agglomerative Hierarchical Clustering. The core hypothesis is that clusters in this space represent coherent concepts—whether they are lexical, syntactic, semantic, or entirely novel task-specific groupings.

2. Annotation Platform

To interpret these clusters, ConceptX provides a graphical user interface (GUI) for human annotators. The platform presents clusters as word clouds, where word size indicates frequency within the cluster. Crucially, the system provides the original sentences for each word instance, acknowledging that context is vital for defining a concept.

To improve efficiency, the framework includes an Auto-labeling module. This module automatically aligns discovered clusters with existing linguistic ontologies (e.g., WordNet, POS tags). If a cluster aligns perfectly with a known category, the human annotator can simply verify the match, allowing them to focus their expertise on more ambiguous or novel latent clusters.

Datasets and Benchmarks

The authors utilized ConceptX to analyze several models and create the BERT ConceptNet (BCN), a new benchmark for interpretability. BCN was built using BERT-base-cased and contains 174 concept labels across nearly one million annotated instances. Additionally, the framework was applied to task-specific models:

  • SST-2 (Stanford Sentiment Treebank): For analyzing sentiment-related representations.
  • HSD (Hate Speech Detection): For investigating how models represent toxic and biased language.

Key Insights and Results

ConceptX reveals that models often organize information in ways that transcend traditional linguistic categories.

Beyond Traditional Linguistics

The framework successfully identifies "non-traditional" concepts, such as clusters grouped by sensitive attributes like religion or gender. This capability is critical for identifying and mitigating algorithmic bias. For instance, in models fine-tuned for hate speech detection (HSD), ConceptX revealed how the model physically segregates toxic concepts in its representational space.

A word cloud representing a "toxic" latent concept discovered by ConceptX in a model fine-tuned for hate speech detection.

Task-Specific Segregation and Hierarchy

In fine-tuned models, the latent space clearly separates clusters based on the target task. For example, in sentiment analysis, the model might group words like "worthless" or "empty" into a negative sentiment cluster. Furthermore, the hierarchical nature of the clustering allows annotators to explore different levels of granularity, seeing how specific sub-concepts (like "city names") roll up into broader categories (like "geographic locations").

Conclusion and Future Work

ConceptX provides a scalable method for mapping the internal world of pLMs. By moving beyond predefined probes, it enables the discovery of the actual "latent ontologies" models use. While the framework significantly reduces manual effort through auto-labeling, it still requires expert human intervention for high-quality annotation.

Future work suggests using these discovered concepts to "debias" models by identifying and pruning clusters that represent harmful stereotypes. Additionally, these latent ontologies could be used to inject human-verified knowledge back into the training process, potentially improving model performance and reliability on downstream tasks.

Summary updated

BibTeX
@inproceedings{alam2023conceptx,
  author = {Firoj Alam and Fahim Dalvi and Nadir Durrani and Hassan Sajjad and Abdul Rafae Khan and Jia Xu},
  title = {{ConceptX: A Framework for Latent Concept Analysis}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i13.27057},
}
Figure