NxPlain: A Web-based Tool for Discovery of Latent Concepts

Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Tamim Jaban, Mus'ab Husaini, Ummar AbbasEACL (System Demonstrations) 2023 · DOI

TL;DR

This paper introduces NxPlain, a web-based tool that helps researchers and practitioners understand what deep learning models, particularly in NLP, have learned by discovering and visualizing "latent concepts." It bridges the gap between understanding what a model knows (representation analysis) and how it uses that knowledge for predictions (attribution analysis), offering a more holistic view for debugging and bias detection.

What Problem Does This Paper Address?

Deep neural networks, especially in Natural Language Processing (NLP), have become incredibly powerful but are often treated as "black boxes." Understanding their internal workings is crucial for trust, fairness, and debugging. Existing interpretation methods fall into two main camps:

  1. Representation Analysis: This tries to figure out what knowledge (linguistic, semantic, etc.) is stored within the model's internal representations. However, it doesn't tell us if the model actually uses this learned knowledge to make a specific prediction.
  2. Attribution Analysis: This focuses on how a model makes a prediction by highlighting important parts of the input or model. The downside is that these explanations are often limited to discrete units (like words) and can miss the more abstract, nuanced concepts the model might be leveraging.

NxPlain aims to bridge this gap by combining these two approaches, providing a more comprehensive understanding of both what a model has learned and how it applies that knowledge to individual predictions.

Methods

NxPlain employs a three-pronged pipeline:

  1. Concept Discovery (Latent Concept Analysis): This is the core of discovering what the model has learned. It involves:
  2. Generating feature vectors (contextualized representations) by passing data through the model.
  3. Clustering these vectors using agglomerative hierarchical clustering. The hypothesis is that these clusters represent meaningful groupings of words or phrases that correspond to "latent concepts" learned by the model. This is based on prior work by Dalvi et al. (2022).
  4. Concept Alignment: To make these discovered concepts more interpretable, NxPlain aligns them with existing human-defined ontologies and task-specific concepts. This includes:
  5. Tagging the input corpus with linguistic information (e.g., Part-of-Speech, semantic tags).
  6. Aligning the discovered latent concepts with these tags. For example, a concept might be aligned with "comparative adjectives" or "months of the year." This is based on work by Sajjad et al. (2022).
  7. Attribution Analysis (Integrated Gradients): To connect learned concepts to specific predictions, NxPlain uses Integrated Gradients (IG).
  8. IG is a powerful method for determining the importance of input features (words) and model components for a given prediction.
  9. The salient input features identified by IG are then mapped to the discovered latent concepts, providing an explanation for why a particular prediction was made. This is based on work by Sundararajan et al. (2017).

The system is built with a Backend for processing, a Rest API for programmatic access, and a user-friendly Frontend (a web application) for visualization and interaction.

Datasets

The paper does not explicitly list specific datasets used for training or evaluation of NxPlain itself. However, it mentions that the system is designed to work with "deep NLP models" and can analyze "a model's prediction using latent concepts learned in a deep NLP model." The examples shown in the figures (e.g., Figure 1, Figure 3, Figure 4, Figure 5) appear to be derived from models trained on common NLP tasks like sentiment analysis (e.g., IMDB movie reviews dataset is mentioned in Figure 3).

Key Insights and Ideas

  • Bridging Representation and Attribution: The most significant insight is the successful integration of representation analysis (discovering latent concepts) with attribution analysis (explaining specific predictions). This provides a much richer understanding than either method alone.
  • Latent Concepts as Explanations: The paper posits that latent concepts discovered through clustering contextualized representations are meaningful and can serve as interpretable building blocks for understanding model behavior.
  • Debugging and Bias Detection: NxPlain is presented as a valuable tool for identifying model biases. For instance, a concept might be clustered with negative terms, revealing a potential bias against certain groups (as shown with the "immigrant" example). It can also help identify spurious correlations, like a model relying on lexical cues that are irrelevant to the task.
  • Hierarchical Understanding: The tool allows users to explore concepts at different levels, from a global model overview to sentence-specific explanations, enabling a nuanced understanding.

Key Results

The paper primarily presents NxPlain as a system demonstration. The "results" are qualitative demonstrations of its capabilities:

  • Visualization of Latent Concepts: Figures 1, 4, and 5 showcase word clouds and concept visualizations, illustrating diverse latent concepts discovered by the system, ranging from lexical (e.g., adjectives ending in "-est") to semantic (e.g., months of the year, names) and syntactic (e.g., hyphenated words).
  • Concept Alignment Examples: The paper demonstrates how concepts can be aligned to linguistic properties (e.g., "comparative adjectives," "Muslim names").
  • Prediction Explanation Example: Figure 5 shows how NxPlain can highlight a salient word ("captures") in a sentence and link it to a discovered latent concept (e.g., "Positive / 3rd Person Singular Verb") that contributed to the prediction.
  • User Interface: The frontend provides interactive views (Overview, Model Explanations, Prediction Explanations) allowing users to browse, sort, and analyze concepts.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that human-defined concepts are not always available or applicable, as models learn very fine-grained hierarchies.
  • While the tool helps discover concepts, the quality and interpretability of these concepts can still vary.
  • Future Work:
    • Human-in-the-loop: The authors plan to enable human feedback to enhance concept alignment, allowing users to refine or correct the system's interpretations.
  • Feedback Integration: Incorporating user feedback directly into the explanation system is another planned enhancement.
  • Broader Applicability: While demonstrated for NLP, the underlying principles could potentially be extended to other domains.

Summary updated

BibTeX
@inproceedings{dalvi2023nxplain,
  author = {Fahim Dalvi and Nadir Durrani and Hassan Sajjad and Tamim Jaban and Mus'ab Husaini and Ummar Abbas},
  title = {{NxPlain: A Web-based Tool for Discovery of Latent Concepts}},
  booktitle = {EACL (System Demonstrations)},
  year = {2023},
  doi = {10.18653/v1/2023.eacl-demo.10},
}
Figure