Need help with Visualizing-and-Understanding-Neural-Models-in-NLP?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

213 Stars 57 Forks 10 Commits 2 Opened issues

Services available


Need anything else?

Contributors list

No Data

Visualizing and Understanding Neural Models in NLP

Implementations of saliency models described in "Visualizing and Understanding Neural Models in NLP" by Jiwei Li, Xinlei Chen, Eduard Hovy and Dan Jurafsky.



Torch (nn,cutorch,cunn,nngraph)

python matplotlib library (only for matrix plotting purposes)

download data

Run the models:

Run the first-derivative saliency model:


The saliency matrix will be stored in the file "matrix".

Run the variance saliency model:


The saliency matrix will be stored in the file "matrix".

Alt Text

Folders and Files

input.txt: the input sentence.

sentimentbidi: training bi-directional lstms on the Stanford Sentiment Treebank. You can either download a pretrained model (sentimentbidi/model) or train it yourself by running sentiment_bidi/main.lua

sentiment_uni: training uni-directional standard recurrent models.

data/dict.txt: word dictionary. Current models only support tokens found in the dictionary. Will fix it soon.

For any pertinent questions, feel free to contact [email protected]


Yoon Kim's seq2seq-attn repo

Wojciech Zaremba's lstm repo

Socher et al.,'s Stanford Sentiment Treebank dataset

    title={Visualizing and understanding neural models in NLP},
    author={Li, Jiwei and Chen, Xinlei and Hovy, Eduard and Jurafsky, Dan},
    journal={arXiv preprint arXiv:1506.01066},

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.