Extractive Question Answering

This type of question answering (QA) extracts answers directly from the documents by highlighting the span of text that makes up the answer.

How Does It Work?

Extractive QA systems help you find answers to questions within your documents. The documents are processed by a reader model, which identifies and highlights the relevant answers. Unlike generative QA systems, extractive QA systems don't generate new text. Instead, they focus on extracting information from the documents you provide.

Here's an example of what an answer in an extractive QA system may look like:

The query field contains the question: what was the net loss of amazon in 2022? and the search results show a document with the answer -2,722,000,000 dollar highlighted in yellow.

Advantages

Extractive QA systems offer several benefits:

  • Factual accuracy: They provide factual answers that you can easily verify because they're highlighted directly in the source.
  • Efficiency: Extractive QA systems are often more computationally efficient compared to generative QA systems. Extracting an answer is faster than generating it, and the models used in extractive QA are smaller than those used in generative QA.
  • Handling large volumes of text: These systems are well-suited for handling and extracting answers from long documents, such as books or research papers.
  • Ability to fine-tune the model: The models used in extractive QA systems are relatively small, and it's easy to train them on your own data.

Challenges

Extractive QA systems also come with a set of challenges you should be aware of:

  • Out-of-scope questions: Extractive QA systems excel when providing answers that are present verbatim in the text. They struggle with questions that require synthesizing information or generating answers not directly stated in the document text.
  • Document format: Tables may be challenging for extractive QA, as it performs best on textual documents.
  • Quality of source data: The accuracy of an extractive QA system heavily depends on the quality of the documents it runs on, as it can't generate answers on its own.

Extractive QA in deepset Cloud

A basic extractive QA pipeline in deepset Cloud combines a Retriever and a Reader. When given a query, the Retriever scans all your documents and retrieves only the ones relevant to the query. It then passes them on to the Reader, which goes only through the retrieved documents and highlights the correct answers. This combination ensures optimal speed and accuracy.

The query going in to the Retriever that is linked to your documents and then sends a portion of these documents on to the Reader. The reader then produces an answer, which is a highlighted piece of text within a document.

deepset Cloud comes with ready-made templates for creating an extractive QA pipeline. These templates work well out of the box, so the only thing you need to modify is the name. Have a look at an overview of available templates.

Building an Extractive QA System

Follow the Tutorial: Building Your First Question Answering App for step-by-step, complete instructions on how to build an extractive QA system in deepset Cloud.

You may also have a look at the Use Case: A Live QA System to understand when an extractive QA system is the best choice and what data you need.

And if you want to try out an extractive QA pipeline in deepset Cloud, take a look at our demo of 10-K annual reports of the largest companies. Try asking some questions and see how the extractive QA system works.