Introduction
Natural Language Sentence Matching (NLSM) is a fundamental task in natural language processing, underpinning applications such as paraphrase identification, natural language inference (NLI), and question answering. The challenge lies in effectively capturing the nuanced relationship between two sentences, $P$ and $Q$. Historically, models relied on Siamese Networks, which encode sentences independently, or basic Matching-Aggregation frameworks that often lacked bidirectional depth or varied comparison perspectives.
The Bilateral Multi-Perspective Matching (BiMPM) model addresses these limitations by matching every word in one sentence against the entire context of the other from multiple perspectives and in both directions ($P \to Q$ and $Q \to P$).
Model Architecture
The BiMPM model is structured into five hierarchical layers designed to move from raw word representations to a final classification decision.
- Word Representation Layer: This layer handles the input by combining standard GloVe word embeddings with character-level embeddings processed via a Long Short-Term Memory (LSTM) network. This hybrid approach ensures the model is robust against rare words and typographical errors.
- Context Representation Layer: A BiLSTM is employed to process the word sequences, wrapping each word in its surrounding context to generate "contextual vectors."
- Matching Layer: This is the core innovation of the model. It performs multi-perspective matching between the contextual vectors of the two sentences.
- Aggregation Layer: Another BiLSTM layer aggregates the sequences of matching vectors into a fixed-length representation.
- Prediction Layer: A fully connected network uses the aggregated vector to output the final probability for the specific task (e.g., entailment, neutral, or contradiction in NLI).
Multi-Perspective Matching Strategies
The matching layer utilizes a "multi-perspective cosine similarity" function. Unlike standard cosine similarity, this function incorporates a trainable weight matrix $W$ that allows the model to focus on different semantic dimensions of the vectors. For every word in sentence $P$, the model compares it to sentence $Q$ using four distinct strategies:
- Full-Matching: Compares each word vector of one sentence against the final hidden state (the summary) of the BiLSTM from the other sentence.
- Maxpooling-Matching: Compares each word vector against every word vector in the other sentence, retaining only the maximum similarity score for each dimension.
- Attentive-Matching: Calculates a weighted average of the entire target sentence based on similarity to the current word, then matches the word against this "attentive" representation.
- Max-Attentive-Matching: Identifies the single most similar word in the target sentence and performs a match against that specific vector.
Key Insights and Results
The authors evaluated BiMPM across several benchmarks, demonstrating its state-of-the-art performance at the time of publication:
- Stanford Natural Language Inference (SNLI): The model achieved 86.9% accuracy for a single model and 88.8% for an ensemble, outperforming more complex frameworks.
- Quora Question Pairs: BiMPM reached 88.17% accuracy, significantly surpassing standard Siamese LSTMs and CNNs.
- Bilateral Importance: Ablation studies confirmed that matching in both directions ($P \to Q$ and $Q \to P$) is superior to unidirectional matching. While $P \to Q$ is often more informative in NLI (hypothesis to premise), the combination provides the most robust results.
- Granularity: The inclusion of all four matching strategies was found to be necessary; removing any single strategy resulted in a measurable performance decline, justifying the model's multi-perspective complexity.
Conclusion
BiMPM demonstrates that effective sentence matching requires looking beyond global summaries. By interacting at a granular, word-to-context level and employing multiple "lenses" through multi-perspective similarity, the model captures the intricate dependencies required for high-level natural language understanding. Future work may extend this framework to machine comprehension and more complex document-level matching tasks.
Summary updated