EfficientQA : a RoBERTa Based Phrase-Indexed Question-Answering System

Sofian Chaybouti, Achraf Saghe, Aymen Shabou · OpenReview

Abstract

State-of-the-art extractive question answering models achieve superhuman performances on the SQuAD benchmark. Yet, they are unreasonably heavy and need expensive GPU computing to answer questions in a reasonable time. Thus, they cannot be used for real-world queries on hundreds of thousands of documents in the open-domain question answering paradigm. In this paper, we explore the possibility to transfer the natural language understanding of language models into dense vectors representing questions and answer candidates, in order to make the task of question-answering compatible with a simple nearest neighbor search task. This new model, that we call EfficientQA, takes advantage from the pair of sequences kind of input of BERT-based models to build meaningful dense representations of candidate answers. These latter are extracted from the context in a question-agnostic fashion. Our model achieves state-of-the-art results in Phrase-Indexed Question Answering (PIQA) beating the previous state-of-art by 1.3 points in exact-match and 1.4 points in f1-score. These results show that dense vectors are able to embed very rich semantic representations of sequences, although these ones were built from language models not originally trained for the use-case. Thus, in order to build more resource efficient NLP systems in the future, training language models that are better adapted to build dense representations of phrases is one of the possibilities.

Introduction

Standard extractive Question-Answering (QA) models, such as those optimized for the SQuAD benchmark, rely on complex attention mechanisms that process a question and a document together at inference time. While highly accurate, this joint-processing approach is computationally expensive and slow, making it impractical for open-domain settings where a system must search through millions of documents in real-time.

To address this scalability bottleneck, researchers have turned to the Phrase-Indexed Question Answering (PIQA) paradigm. In PIQA, document phrases are pre-encoded into dense vectors offline. At query time, the question is independently encoded into the same vector space, and the answer is retrieved via a fast nearest-neighbor search.

Overview of the Phrase-Indexed Question Answering (PIQA) paradigm.

Methodology

EfficientQA introduces a streamlined framework for PIQA consisting of two primary components: question-agnostic candidate extraction and Siamese vector representation.

Agnostic Extraction of Answer Candidates

A typical document contains an overwhelming number of possible text spans. To maintain efficiency, EfficientQA trains a RoBERTa-base model to identify the most "answer-like" spans without prior knowledge of the question. A key innovation in this model is the use of a dependent scoring mechanism. Instead of predicting start and end positions independently, the model uses a beam search approach where the probability of a span's end position is conditioned on its start position ($P(s, e) = P(s) \times P(e|s)$).

Architecture for question-agnostic candidate extraction using dependent start and end token scoring.

Siamese Vector Representation

To map questions and answers into a shared embedding space, the system utilizes a Siamese network architecture based on RoBERTa-base:

  • Answer Encoding: The context and the specific candidate span are fed as a pair of sequences. The resulting token embeddings are processed through a dense layer and averaged to create a single vector.
  • Question Encoding: The question is passed through the same network to generate a matching query vector.

The system is trained using a cross-entropy loss that encourages the model to maximize the dot product between a question vector and its corresponding correct answer vector.

Experimental Results

The model was evaluated on the SQuAD v1.1 (English) and FQuAD (French) benchmarks.

EfficientQA achieved state-of-the-art results in the PIQA setting, reaching 74.9 Exact Match (EM) and 83.1 F1-score on SQuAD. This performance surpassed the previous leader, DENSPI, by 1.3 and 1.4 points respectively. Notably, EfficientQA achieved these results using a RoBERTa-base backbone (125M parameters), which is significantly smaller and more efficient than the BERT-large model (340M parameters) used by DENSPI.

On the FQuAD dataset, the model achieved 64.4 EM and 76.0 F1-score, demonstrating that the architecture generalizes effectively to non-English contexts despite having less training data available.

Discussion and Conclusion

A critical finding of this research is that predicting start and end positions dependently is vastly superior to independent prediction. The dependent architecture achieved a 92.3 EM score for candidate extraction, compared to just 65.1 for the classic independent approach. This suggests that the structural method of extracting and representing candidates is more impactful than simply increasing model parameter counts.

While EfficientQA significantly narrows the gap between indexed models and heavy cross-attention models (which score ~83.0 EM on SQuAD), a performance difference remains. Future work will focus on training language models specifically designed for dense phrase representations and scaling the system to index massive, multi-million document corpora.

Summary updated

BibTeX
@misc{chaybouti2021efficientqa,
  author = {Sofian Chaybouti and Achraf Saghe and Aymen Shabou},
  title = {{EfficientQA : a RoBERTa Based Phrase-Indexed Question-Answering System}},
  year = {2021},
  eprint = {2101.02157},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.02157},
}
Figure