A Unified Understanding of Deep NLP Models

Zhen Li1     Xiting Wang2     Weikai Yang1     Jing Wu3     Zhengyan Zhang1    
Zhiyuan Liu1     Maosong Sun1     Hui Zhang1     Shixia Liu1  

1Tsinghua University       2Microsoft Research Asia       3Cardiff University

Teaser Image
Teaser Image

Fig. 1: DeepNLPVis: (a) corpus-level visualization for identifying samples and words of interest in the context of data distribution and model prediction; (b) sample list; (c) word contribution at different layers; (d) information flow for analyzing a sample by its intra- and inter-word information; (e) word context view for understanding the multiple meanings of a word.


The rapid development of deep natural language processing (NLP) models for text classification has led to an urgent need for a unified understanding of these models proposed individually. Existing methods cannot meet the need for understanding different models in one framework due to the lack of a unified measure for explaining both low-level (e.g., words) and high-level (e.g., phrases) features. We have developed a visual analysis tool, DeepNLPVis, to enable a unified understanding of NLP models for text classification. The key idea is a mutual information-based measure, which provides quantitative explanations on how each layer of a model maintains the information of input words in a sample. We model the intra- and inter-word information at each layer measuring the importance of a word to the final prediction as well as the relationships between words, such as the formation of phrases. A multi-level visualization, which consists of a corpus-level, a sample-level, and a word-level visualization, supports the analysis from the overall training set to individual samples. Two case studies on classification tasks and comparison between models demonstrate that DeepNLPVis can help users effectively identify potential problems caused by samples and model architectures and then make informed improvements.

ieee arxiv pdf video demo bib