Recurrent Neural Network Encoder with Attention for Community Question Answering

Wei-Ning Hsu, Yu Zhang, James R. GlassarXiv 2016

Abstract

We apply a general recurrent neural network (RNN) encoder framework to community question answering (cQA) tasks. Our approach does not rely on any linguistic processing, and can be applied to different languages or domains. Further improvements are observed when we extend the RNN encoders with a neural attention mechanism that encourages reasoning over entire sequences. To deal with practical issues such as data sparsity and imbalanced labels, we apply various techniques such as transfer learning and multitask learning. Our experiments on the SemEval-2016 cQA task show 10% improvement on a MAP score compared to an information retrieval-based approach, and achieve comparable performance to a strong handcrafted feature-based method.

Introduction

Community Question Answering (cQA) forums are valuable repositories of knowledge, yet they are notoriously noisy. Users often post redundant questions, use informal language, or provide irrelevant comments. This research addresses three specific challenges within the SemEval-2016 cQA task: identifying relevant comments for a question (Task A), finding relevant existing questions for a new query (Task B), and determining if comments from related threads apply to the original question (Task C).

Traditional models for these tasks often rely on keyword matching or "feature-rich" systems that require extensive linguistic preprocessing and domain-specific rules. We propose a general framework using Recurrent Neural Networks (RNNs) to learn these representations automatically from raw text.

Methodology

The core of our approach is a Serialized LSTM Encoder with Attention.

Serialized LSTM Architecture

Rather than processing two sentences (e.g., a question and a potential answer) independently, our model uses a sequential approach. The first LSTM reads the question and passes its final internal state to a second LSTM, which then processes the answer. This allows the model to interpret the answer specifically within the context of the question.

Neural Attention Mechanism

To prevent the model from losing information in long sequences, we incorporate a neural attention mechanism. While the second LSTM processes the answer, the attention mechanism allows it to "look back" at specific words in the question, focusing on semantically important terms while ignoring noise.

Architecture of the Sequential LSTM Encoder with Attention mechanism.

Multitask and Transfer Learning

To combat data sparsity, particularly in question-to-question matching, we pre-trained our models on the Stanford Natural Language Inference (SNLI) corpus. We also employed multitask learning to jointly predict relationships across the three tasks, leveraging shared semantic features between original questions, related questions, and comments.

Multitask learning framework for jointly addressing Tasks A, B, and C.

Key Results

Our experiments on the SemEval-2016 dataset demonstrated significant improvements over baseline methods:

  • Task A (Question-Comment): The Attention-based model achieved a Mean Average Precision (MAP) of 0.639, outperforming the IR baseline (0.538) and matching the performance of complex feature-rich systems (0.632).
  • Task C (External Comments): The attention mechanism was crucial for this "needle in a haystack" problem, increasing the F1 score from 0.011 (standard LSTM) to 0.144.
  • Hybrid Systems: By combining our model's scores with traditional IR rankings, we achieved the best overall results (e.g., 0.717 MAP for Task B), proving that neural semantic models and traditional search engines have complementary strengths.

Discussion and Conclusion

Qualitative analysis shows that the attention mechanism successfully ignores stop words and punctuation, focusing instead on "hot words" that define the relationship between text pairs. While cross-domain transfer learning provided benefits, in-domain transfer (using Task A data to initialize Task B) was generally more effective for capturing the specific nuances of forum language.

Future work will explore more granular attention mechanisms and the incorporation of metadata, such as user profiles and timestamps, into the neural framework to further improve relevance ranking in community forums.

Summary updated

BibTeX
@misc{hsu2016recurrent,
  author = {Wei-Ning Hsu and Yu Zhang and James R. Glass},
  title = {{Recurrent Neural Network Encoder with Attention for Community Question Answering}},
  year = {2016},
  eprint = {1603.07044},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1603.07044},
}
Figure