Learning Natural Language Inference with LSTM

Shuohang Wang, Jing Jiang

Introduction

Natural Language Inference (NLI) is a fundamental task in natural language processing that involves determining the logical relationship between a "premise" sentence and a "hypothesis" sentence. The goal is to classify the relationship as entailment (the hypothesis is true given the premise), contradiction (the hypothesis is false), or neutral (the truth value cannot be determined).

Traditional deep learning approaches often relied on encoding both sentences into separate, fixed-length vectors—often called "thought vectors"—and then comparing these embeddings. However, this method frequently loses fine-grained details. For instance, a single word difference (e.g., "dog" vs. "cat") can change an entailment into a contradiction, but global sentence embeddings might treat these semantically similar words as nearly identical, leading to classification errors.

The Match-LSTM (mLSTM) Architecture

To address these limitations, researchers from Singapore Management University proposed the match-LSTM (mLSTM). Instead of a static comparison of global vectors, the mLSTM performs a dynamic, word-by-word matching process.

  1. Preprocessing: The premise and hypothesis are first processed by standard LSTMs to generate context-aware hidden states for each word.
  2. Word-by-Word Attention: As the model iterates through the hypothesis, it uses a neural attention mechanism to identify the most relevant parts of the premise for each specific hypothesis word.
  3. Matching Layer: The core of the model is the mLSTM layer. It takes the current hypothesis word representation concatenated with the attention-weighted premise vector. This allows the model to build a sequential representation of how well the hypothesis "matches" the premise over time.
  4. Memory and Gating: The mLSTM uses its internal gates to selectively remember critical mismatches (like "cat" vs. "dog") while ignoring less informative words like "the" or "a."

Key Insights: Visualizing the Inference Process

One of the most significant findings of this research is that the model learns to focus on specific word-level conflicts. By visualizing the attention weights and LSTM gate activations, the researchers demonstrated how the model identifies contradictions and filters noise.

Visualizing attention and gate activations across different inference labels.

The visualizations reveal that the model naturally assigns lower input gate values to stop words and higher values to content-heavy nouns and verbs. Furthermore, the model is particularly effective at "remembering" mismatches. Even if most words in a sentence pair match, a single critical contradiction is carried through the hidden state to ensure the final classification is correct.

Experimental Results

The mLSTM was evaluated on the Stanford Natural Language Inference (SNLI) corpus, a massive dataset of approximately 570,000 sentence pairs.

Comparison of mLSTM performance against baseline and previous state-of-the-art models on the SNLI dataset.

As shown in the results table, the model achieved a state-of-the-art accuracy of 86.1% on the SNLI test set, significantly outperforming previous attention-based models. Ablation studies showed that even a simplified version using raw word embeddings (without LSTM preprocessing) reached 85.3% accuracy, confirming that the sequential matching architecture itself is the primary driver of performance.

Limitations and Future Directions

Despite its success, the mLSTM has some limitations. Due to its high parameter count, the model requires large-scale datasets like SNLI to train effectively and does not perform as well on smaller datasets like SICK. Additionally, the model currently lacks access to external semantic resources (e.g., WordNet), which could improve its handling of complex paraphrases. Future work involves integrating external knowledge bases and optimizing the architecture for better computational efficiency.

Summary updated

BibTeX
@inproceedings{wang2016learning,
  author = {Shuohang Wang and Jing Jiang},
  title = {{Learning Natural Language Inference with LSTM}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2016},
  doi = {10.18653/v1/n16-1170},
}
Figure