0
0
NLPml~20 mins

Extractive QA concept in NLP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Extractive QA Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main goal of extractive question answering?
In extractive question answering, what is the system primarily designed to do?
AGenerate a completely new answer not present in the text
BClassify the question into predefined categories
CSummarize the entire passage into a short paragraph
DSelect a span of text from the given passage as the answer
Attempts:
2 left
💡 Hint
Think about whether the answer is created or taken directly from the text.
Predict Output
intermediate
1:30remaining
Output of extractive QA model span prediction
Given a passage and a question, an extractive QA model outputs start and end indices of the answer span. If the passage is "The sky is blue and clear today." and the model predicts start index 3 and end index 5, what is the extracted answer?
NLP
passage = "The sky is blue and clear today."
start_idx = 3
end_idx = 5
words = passage.split()
answer = ' '.join(words[start_idx:end_idx+1])
print(answer)
A"and clear today."
B"is blue and"
C"blue and clear"
D"sky is blue"
Attempts:
2 left
💡 Hint
Check the words between indices 3 and 5 inclusive.
Model Choice
advanced
2:00remaining
Best model architecture for extractive QA
Which model architecture is most suitable for extractive question answering tasks?
APretrained Transformer model fine-tuned to predict start and end token positions
BSequence-to-sequence model trained for translation tasks
CGenerative Transformer model like GPT that generates answers from scratch
DConvolutional Neural Network for image classification
Attempts:
2 left
💡 Hint
Extractive QA requires locating answer spans, not generating new text.
Metrics
advanced
1:30remaining
Which metric best evaluates extractive QA performance?
For extractive question answering, which metric is commonly used to measure how well the predicted answer matches the true answer span?
ABLEU score measuring n-gram overlap
BExact Match (EM) score checking exact span match
CMean Squared Error between predicted and true spans
DAccuracy of classifying question types
Attempts:
2 left
💡 Hint
Think about a metric that checks if the predicted answer exactly matches the true answer.
🔧 Debug
expert
2:30remaining
Why does this extractive QA model fail to find the answer span?
A fine-tuned extractive QA model always predicts the start and end indices as 0, regardless of input. What is the most likely cause?
NLP
def predict_span(model, input_ids):
    start_scores, end_scores = model(input_ids)
    start_index = start_scores.argmax()
    end_index = end_scores.argmax()
    return start_index, end_index

# Model always returns start_index=0 and end_index=0
AThe model was not fine-tuned and outputs default scores favoring index 0
BThe input_ids are empty, so model cannot predict spans
CThe argmax function is used incorrectly causing wrong indices
DThe model architecture is incompatible with extractive QA
Attempts:
2 left
💡 Hint
Consider what happens if the model is not trained on the task.