Source-linked AI summary

A Compare-Aggregate Model for Matching Text Sequences

Shuohang Wang, Jing Jiang

arXiv:1611.01747v1cs.CLcs.AI

TL;DR

Sequence matching tasks need methods that compare important units across sequences rather than relying only on whole-sequence representations. This paper applies a compare-aggregate model with word-level matching and CNN aggregation, systematically tests six comparison functions across four datasets, and finds that simple element-wise operations perform best overall. The results support the effectiveness of a shared compare-aggregate structure across varied sequence-matching tasks.

  • Problem

    Sequence-matching models often rely on whole-sequence vectors, while prior studies provided limited evidence across tasks and limited analysis of small-unit comparison functions.

  • Method

    The paper uses a compare-aggregate model that compares word-level representations, aggregates the comparisons with CNNs, and evaluates six comparison functions on four datasets.

  • Results

    Element-wise subtraction and multiplication work best overall across the four datasets, and simple comparison functions can outperform neural network and neural tensor network functions.

  • Takeaways & Limitations

    Many different sequence-matching tasks can share the same compare-aggregate structure, and element-wise comparison functions are useful candidates for future research.

  • Takeaways & Limitations

    EUCCOS produces only a 2-dimensional comparison vector and may lose useful information, while NN and NTN may be too general to focus on similarity.

Abstract

from arXiv · show

Many NLP tasks including machine comprehension, answer selection and text entailment require the comparison between sequences. Matching the important units between sequences is a key to solve these problems. In this paper, we present a general "compare-aggregate" framework that performs word-level matching followed by aggregation using Convolutional Neural Networks. We particularly focus on the different comparison functions we can use to match two vectors. We use four different datasets to evaluate the model. We find that some simple comparison functions based on element-wise operations can work better than standard neural network and neural tensor network.

1 INTRODUCTION

Sequence matching tasks require comparing sequences to make decisions, but encoding each sequence as one vector may miss important information. The paper motivates a compare-aggregate approach that compares smaller units, aggregates their interactions, and evaluates comparison functions across four datasets.

  • Motivation: Textual entailment, machine comprehension, and answer selection all require matching sequences to make a decision.Examples include matching a hypothesis with a premise or a question with passages and candidate answers.
  • Motivation: Encoding each sequence as a single vector can fail to capture all important information.Attention mechanisms and memory networks were developed to address this limitation.
  • Compare-Aggregate Framework: Compare-aggregate models compare smaller units such as words before aggregating comparison results for final prediction.Prior systems used attention-weighted comparisons and aggregation through LSTMs, CNNs, or feed-forward networks.
  • Research Gap: Earlier studies tested the framework on only one or two tasks and paid limited attention to the comparison function used for small textual units.The paper identifies these as two limitations motivating broader empirical evaluation.
  • Paper Approach: The proposed model evaluates six comparison functions on MovieQA, InsuranceQA, WikiQA, and SNLI, finding element-wise subtraction and multiplication best overall.The datasets cover question answering and textual entailment, while Table 1 illustrates machine comprehension and answer selection examples.

2 METHOD

The model matches contextual word representations through attention, compares each aligned pair with one of six functions, and aggregates the comparison sequence with a CNN. It evaluates element-wise comparison functions as a compromise between overly restrictive similarity measures and overly general neural functions.

  • Model overview: The task is supervised sequence matching: given embedding matrices Q and A, the model predicts a label y for each pair.Columns represent word embeddings, while Q and A denote sequences whose lengths and embedding dimensionality determine the matrix shapes.
  • Model overview: The compare-aggregate model preprocesses both sequences, computes attention from each A word to Q, compares aligned vectors, and aggregates the results for classification.A recurrent preprocessing layer adds contextual information; attention produces h_j for each a_j, comparison produces t_j, and a CNN aggregates the t_j sequence.
  • Model overview: The model differs from a related compare-aggregate system by using CNN aggregation, one-directional attention, and systematic evaluation across four datasets.The datasets represent three question-answering tasks and one textual-entailment task.
  • Comparison functions: Element-wise SUB and MULT are presented as a compromise between restrictive similarity functions and highly flexible neural comparison functions.The paper motivates these functions as retaining information from the original vectors while still reflecting similarity or relatedness.
  • Comparison functions: SUB preserves dimension-specific information related to Euclidean distance, while MULT preserves information related to cosine similarity.SUB uses element-wise squared differences, and MULT uses element-wise multiplication; neither immediately collapses the result into a scalar similarity.
  • Comparison functions: The model compares six functions: NN, NTN, EUCCOS, SUB, MULT, and SUBMULT+NN.The study emphasizes comparison functions because previous sequence-matching models received limited attention to this word-level design choice.

3 EXPERIMENTS

The experiments evaluate a compare-aggregate model across four datasets spanning question answering and textual entailment, with multiple task-specific setups and baselines. Results show strong overall performance and highlight the effectiveness of simple element-wise comparison functions.

  • Experimental Setup: The model is evaluated on four datasets: MovieQA, InsuranceQA, WikiQA, and SNLI, covering question answering and textual entailment.The first three datasets are question answering tasks, while SNLI is textual entailment.
  • Task-Specific Model Structures: For InsuranceQA and WikiQA, the model processes multiple candidate answers and uses their resulting representations to select or rank candidates.InsuranceQA selects the correct answer from a candidate pool, while WikiQA ranks candidate answers.
  • Baselines: The experiments compare the model against previously reported baselines for MovieQA, InsuranceQA, WikiQA, and SNLI.The baselines include attention, recurrent, convolutional, and other compare-aggregate models.
  • Analysis of Results: The compare-aggregate structure achieves the best performance on MovieQA, InsuranceQA, and WikiQA, and competitive performance on SNLI.On InsuranceQA, every tested comparison function outperforms all previous models.
  • Analysis of Results: SUBMULT+NN is the best comparison method in general, while simple element-wise functions are especially strong on MovieQA and WikiQA.EUCCOS is nearly the best on MovieQA, and parameter-free element-wise functions achieve the best performance on WikiQA.
  • Further Analyses: CNN visualizations suggest that matched words receive greater attention and that continuous matching between candidate answers and questions is associated with likely correct answers.The visualization examples come from MovieQA with CNN window size 5 and InsuranceQA with CNN window size 3.

4 RELATED WORK

Related work organizes sequence-matching models into Siamese, attentive, and compare-aggregate networks. This paper belongs to the compare-aggregate family while systematically analyzing word-level comparison functions across tasks.

  • Siamese network: Siamese networks encode the two sequences separately with shared structures and then combine their representations for classification.Combination methods include cosine similarity, element-wise operations, and neural-network-based functions.
  • Attentive network: Attentive networks use soft attention to form sequence representations from weighted sums of hidden states rather than relying only on final recurrent states.This approach has been used in machine comprehension, textual entailment, and question answering.
  • Compare-Aggregate network: Compare-aggregate networks perform word-level matching before aggregating the resulting comparisons.The present work uses this framework, applies it across different tasks, and analyzes comparison functions separately.

5 CONCLUSIONS

Across four datasets and different tasks, the study finds that compare-aggregate models can share a common effective structure, with some element-wise comparison functions outperforming others.

  • The study analyzes compare-aggregate models across four datasets representing different tasks.
  • Some element-wise comparison functions outperform other comparison functions in the experiments.
  • The results suggest that many different tasks can share the same compare-aggregate structure.
  • Future work will test the framework's effectiveness in multi-task learning.

A APPENDIX

The appendix specifies the model's fixed word-embedding initialization and principal optimization settings, including hidden-layer size, optimizer, batch size, and learning rate.

  • Word embeddings are initialized from GloVe and kept fixed during training.Words absent from GloVe are initialized with zero vectors.
  • The hidden-layer dimensionality is 150, with ADAMAX optimization using β1 = 0.9 and β2 = 0.999.
  • Training uses batch size 30, learning rate 0.002, no L2-regularization, and tuned embedding-layer dropout.WikiQA additionally tunes learning rate and batch size.
Loading 1611.01747v1…