Abstract
Recently, pre-trained models have been the dominant paradigm in natural language processing. They achieved remarkable state-of-the-art performance across a wide range of related tasks, such as textual entailment, natural language inference, question answering, etc. BERT, proposed by Devlin et al., has achieved a better marked result in GLUE leaderboard with a deep transformer architecture. Despite its soaring popularity, however, BERT has not yet been applied to answer selection. This task is different from others with a few nuances: first, modeling the relevance and correctness of candidates matters compared to semantic relatedness and syntactic structure; second, the length of an answer may be different from other candidates and questions. In this paper, we are the first to explore the performance of fine-tuning BERT for answer selection. We achieved SOTA results across five popular datasets, demonstrating the success of pre-trained models in this task.
Introduction
The paper "BERTSel: Answer Selection with Pre-trained Models" marks a significant milestone in the evolution of Question Answering (QA) systems. It represents the first successful application of BERT (Bidirectional Encoder Representations from Transformers) to the specific task of answer selection. By utilizing a pairwise ranking approach and a hybrid loss function, the authors demonstrate that BERT’s deep contextual embeddings significantly outperform previous architectures built on shallow word embeddings.
Problem Statement
In the field of Natural Language Processing (NLP), Answer Selection is the task of identifying which candidate sentence from a list correctly answers a given question. Before this work, the field relied heavily on "shallow" pre-trained word embeddings (like Word2Vec or GloVe) combined with complex, task-specific neural network architectures. These models often struggled with:
- Relevance vs. Similarity: A candidate might be semantically similar to a question without actually answering it.
- Generalization: Models trained on one dataset often performed poorly on others due to a lack of deep linguistic understanding.
While BERT had revolutionized tasks like sentiment analysis, it hadn't yet been adapted for the specific ranking nuances required for answer selection.
Methodology
The authors propose a fine-tuning strategy for BERT based on a pairwise approach.
For a given question ($q$), the model is presented with a positive answer ($p$) and a sampled negative answer ($n$). These are formatted as triples $(q, p, n)$. The model splits the triple into two pairs: $(q, p)$ and $(q, n)$. Each pair is fed into BERT, using the embedding of the [CLS] token as the representative vector. This vector passes through a fully connected layer and a sigmoid function to produce a final relevance score.
The "secret sauce" of the paper is a Hybrid Loss Function that combines:
- Negative Cross-Entropy: To maximize the probability of the correct answer.
- Hinge Loss: To explicitly ensure that the score of the positive answer is higher than the score of the negative answer by a specific margin ($m$).
Experimental Setup
The model was evaluated on five diverse and popular answer selection benchmarks: TrecQA, WikiQA, YahooQA, and SemEvalcQA-16 & 17. These datasets cover a range of styles, from factoid QA to community-driven forums with informal language.
Results and Discussion
BERTSel achieved state-of-the-art (SOTA) results on all five datasets, often by massive margins. On TrecQA, for example, the model improved the Mean Reciprocal Rank (MRR) by nearly 10% absolute.
Key insights from the experiments include:
- Context is King: BERT’s bidirectional context is far more effective for determining "answerhood" than previous attention-based models.
- Ranking over Classification: The pairwise hinge loss helps the model learn to rank the best answer above the rest, which is the core requirement of the task.
- Scale Matters: Moving from
BERT-basetoBERT-largeprovided significant boosts, particularly on WikiQA, where MRR jumped from 0.770 to 0.875.
Conclusion
This paper effectively closed the "pre-BERT" era of answer selection, proving that deep, pre-trained language models are the new gold standard. While computational costs remain high for large-scale datasets like YahooQA, the performance gains demonstrate that this simple adaptation is a powerful foundation for future QA research.
Summary updated