Course contentsShow
← Machine Learning and Deep Learning
Lesson 1302 of 3,53829. Core NLP TasksFree lesson

Unanswerable Questions

Detecting when questions cannot be answered from context, as introduced in SQuAD 2.0.

Unanswerable Questions

What You'll Learn

You'll learn how to detect when a question cannot be answered from the given context, a crucial capability introduced in SQuAD 2.0.

The Problem with Always Answering

Early question answering systems had a critical flaw: they always attempted to extract an answer from the context, even when the passage didn't contain the information needed. Imagine a student who, when asked "What is the capital of Mars?" while reading a passage about Earth's geography, feels forced to guess "London" rather than saying "I don't know."

SQuAD 2.0 addressed this by adding unanswerable questions—questions deliberately designed so that the provided context contains no valid answer. This makes the task more realistic and practical.

How It Works

When fine-tuning models like BERT for extractive QA with unanswerable questions, the system must learn two things:

  1. Is this question answerable? (Classification decision)
  2. If yes, where's the answer span? (Span prediction)

During training, the model learns that some questions map to a special "no answer" token—typically the [CLS] token at the start of the input. When the model predicts this position as both the start and end of the span, it's effectively saying "I cannot answer this from the given context."

The model uses a threshold on prediction confidence: if the best answer span has lower confidence than the no-answer option, it returns "unanswerable" rather than forcing an incorrect extraction.

Real-World Value

This capability prevents hallucination and builds trust. A medical QA system should admit "I don't know" rather than inventing information from unrelated context.

Key Takeaway: Detecting unanswerable questions transforms QA systems from naive extractors into honest systems that know their limits, distinguishing between "the answer is here" and "this context doesn't tell me."