Modeling the relationship between two sentences is a cornerstone of Natural Language Processing (NLP). Whether determining if an answer matches a question, if two sentences are paraphrases, or if one statement logically entails another, a robust method for text comparison is required. Traditionally, researchers either built complex, task-specific features or used neural networks to model each sentence in isolation before comparing them at the very end.
The ABCNN (Attention-Based Convolutional Neural Network) paper, published in TACL in 2016, introduced "mutual influence" to this process. It proposed that a sentence's representation should be shaped by the sentence it is being compared to, bringing the power of attention mechanisms to Convolutional Neural Networks (CNNs).
The Siamese Baseline
Before introducing attention, the authors define a basic Siamese CNN (BCNN). In this architecture, two identical networks process each sentence separately. The resulting vectors are only compared at the final output layer.
This "late fusion" approach ignores the fact that the importance of a word in one sentence often depends entirely on the content of the other. For example, in question answering, the question guides attention toward specific parts of the answer. The authors sought to bridge this gap by integrating attention directly into the convolutional architecture.
The ABCNN Architectures
ABCNN introduces three novel attention schemes that allow CNNs to model sentence pairs interdependently rather than in isolation:
- ABCNN-1 (Attention at the Input): Before convolution, the model computes an "attention matrix" $A$ by calculating the similarity between every word in Sentence 0 and every word in Sentence 1. This matrix generates an "attention feature map" for each sentence, which is stacked with the original word embeddings. This way, the convolution filters are "told" which words are most relevant to the counterpart sentence.
- ABCNN-2 (Attention at the Pooling Layer): Instead of standard average pooling, this version uses the attention matrix to reweight the output of the convolution. It essentially "boosts" the signal of phrases that have strong matches in the other sentence while dampening irrelevant ones.
- ABCNN-3 (The Hybrid): This combines both approaches, applying attention at both the input and the pooling stages.
Because CNNs can be stacked, these attention mechanisms work at multiple levels of granularity. The bottom layers attend to individual word matches, while higher layers attend to matches between increasingly abstract phrases. This allows the model to move from word-level attention to phrase-level attention, which is crucial for understanding complex entailments.
Evaluation and Key Results
The model was evaluated on three distinct tasks: Answer Selection (WikiQA), Paraphrase Identification (MSRP), and Textual Entailment (SICK). The ABCNN models consistently outperformed non-attention baselines and set new state-of-the-art marks at the time of publication:
- Answer Selection (WikiQA): ABCNN-3 achieved a MAP of 0.6921 and an MRR of 0.7108, significantly outperforming the previous state-of-the-art CNN-Cnt (0.6520 MAP).
- Textual Entailment (SICK): The model reached 86.2% accuracy, a 1.6% boost over the previous best system.
- Paraphrase Identification (MSRP): Achieved 78.9% accuracy, proving competitive with heavily engineered systems.
- Ablation: ABCNN-2 (attention at pooling) generally performed slightly better than ABCNN-1 (attention at input), but the combination (ABCNN-3) was the most robust.
Conclusion
ABCNN demonstrated that CNNs benefit significantly from attention mechanisms in discriminative tasks. By creating "counterpart-biased representations," the model moves beyond isolated sentence modeling to a more human-like interdependent comparison. While the authors noted that stacking more than two layers didn't provide consistent gains due to data scarcity in 2016, the architecture proved that there is no single "best" representation for a sentence; it must be contextualized by the sentence it is being compared to.
Summary updated