← Lessons

quiz vs the machine

Gold1380

Machine Learning

The Question Answering Extractive

Finding the exact answer span inside a given passage.

4 min read · core · beat Gold to climb

What extractive QA does

Extractive question answering is given a question and a passage, and returns the span of the passage that answers it. The answer is always a contiguous slice of the provided text.

How the model picks a span

  • Encode the question and passage together with a transformer.
  • Predict two probabilities per token: how likely it is the start of the answer and the end.
  • Choose the start and end pair with the highest combined score, with end not before start.

This turns answering into two classification problems over passage positions.

Handling no answer

Real passages may not contain the answer. Robust systems reserve a special no answer option, so the model can decline rather than force a wrong span.

Evaluation

  • Exact match counts predictions that equal the reference answer exactly.
  • F1 gives partial credit by overlap of predicted and reference tokens, which is fairer when boundaries differ slightly.

Key idea

Extractive QA predicts a start and end position to select the answer span inside a passage, supports a no answer option, and is scored with exact match and token F1.

Check yourself

Answer to earn rating on the learn ladder.

1. How does an extractive QA model represent the answer?

2. Why include a no answer option?