Abstract
Natural Language Inference (NLI) requires determining the logical relationship between a premise and a hypothesis. Traditional deep learning approaches often suffer from information loss by compressing entire sentences into fixed-length vectors. This paper introduces the match-LSTM (mLSTM), an architecture that performs word-by-word matching to capture granular semantic nuances. By sequentially processing hypothesis-premise alignments, the mLSTM can effectively identify critical mismatches indicative of contradictions. Our model achieves a state-of-the-art accuracy of 86.1% on the Stanford Natural Language Inference (SNLI) corpus.
Introduction
The task of Natural Language Inference (NLI) involves categorizing the relationship between a premise and a hypothesis as entailment, contradiction, or neutral. For instance, "A dog is running" entails "An animal is moving," while "A cat is sleeping" contradicts it.
A significant challenge in NLI is the preservation of subtle word-level details. Previous models typically generated independent embeddings for the premise and hypothesis, then compared these global vectors. However, a single word change—such as "dog" to "cat"—can fundamentally alter the logical relationship. These nuances are often lost during global sentence compression.
The match-LSTM Architecture
To address the limitations of global embeddings, we propose the match-LSTM. This architecture builds upon standard attention mechanisms but introduces a sequential matching layer that maintains a running state of the hypothesis-premise relationship.
The model operates in several stages:
- Contextual Encoding: Standard LSTMs process the premise and hypothesis to generate contextual word representations.
- Word-by-Word Attention: For each word in the hypothesis, the model computes an attention-weighted representation of the premise, effectively aligning hypothesis words with their most relevant counterparts.
- Sequential Matching: A second LSTM (the match-LSTM) "reads" the hypothesis. At each step, it receives a vector representing the local match between the current hypothesis word and its aligned premise context.
- Memory and Gating: The match-LSTM learns to retain critical mismatches in its memory while "forgetting" or down-weighting matches of non-informative words (e.g., "the", "is").
- NULL Alignment: By including a "NULL" token in the premise, the model can align hypothesis words that have no premise counterpart, aiding in the identification of neutral relationships where new information is introduced.
Experimental Setup
We evaluated the mLSTM on the Stanford Natural Language Inference (SNLI) corpus, which consists of approximately 570,000 sentence pairs. This dataset provided the necessary scale to train the complex matching parameters of our architecture. We also conducted preliminary tests on the SICK dataset, though its smaller size proved insufficient for training the model from scratch.
Results
The match-LSTM achieved a state-of-the-art accuracy of 86.1% on the SNLI test set, a significant improvement over previous attention-based baselines.
Our results demonstrate that the sequential matching strategy is robust. Even when using raw word embeddings instead of pre-processed hidden states, the mLSTM architecture outperformed more complex sentence-encoding models. This highlights that the matching process itself is more critical for NLI than the initial feature extraction.
Discussion and Insights
Analysis of the model's internal states reveals several key behaviors:
- Prioritizing Mismatches: The model recognizes that while word overlaps suggest entailment, a single strong mismatch is often the definitive signal for contradiction. The mLSTM is specifically optimized to "remember" these red flags.
- Noise Filtering: Gate visualizations show that the model naturally ignores lexical noise. Input gates for stop words are consistently lower, allowing the network to focus on content-bearing words.
- Granularity: By avoiding global embeddings, the model preserves the structural and granular differences between sentences that are essential for accurate inference.
Conclusion
The match-LSTM provides a powerful framework for NLI by shifting the focus from global sentence encoding to local, sequential matching. While the model is computationally more intensive and requires large-scale datasets like SNLI, its ability to capture fine-grained semantic relationships sets a new benchmark for the task. Future research could explore the integration of external knowledge bases to further enhance the model's semantic understanding.
Summary updated