🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Question Answering: Reading Comprehension and Open-Domain QA

Natural Language ProcessingQuestion Answering: Reading Comprehension and Open-Domain QAđŸŸĸ Free Lesson

Advertisement

Question Answering: Reading Comprehension and Open-Domain QA

Module: Natural Language Processing | Difficulty: Advanced

Extractive QA

Generative QA

Open-Domain QA

SQuAD Metrics

| Metric | Model | Score | |--------|-------|-------| | EM | BERT-large | 84.1 | | F1 | BERT-large | 90.9 | | EM | RoBERTa | 88.5 | | F1 | RoBERTa | 94.6 |

import torch
import torch.nn as nn

class QAModel(nn.Module):
    def __init__(self, bert_model):
        super().__init__()
        self.bert = bert_model
        self.qa_outputs = nn.Linear(768, 2)
    def forward(self, input_ids, attention_mask):
        outputs = self.bert(input_ids, attention_mask=attention_mask)
        logits = self.qa_outputs(outputs.last_hidden_state)
        start_logits, end_logits = logits.split(1, dim=-1)
        return start_logits.squeeze(-1), end_logits.squeeze(-1)

Research Insight: The key challenge in open-domain QA is retrieving relevant documents. Dense retrieval (DPR) outperforms sparse retrieval (BM25) by 15-20% on recall@100, but BM25 is more robust to domain shift.

Need Expert NLP Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement