Collect and format data
Use an extractive QA dataset such as SQuAD or NaturalQuestions and store examples as {context, question, answer_span} records with provenance.
Answer questions from text. Assess exact-match and token-F1.
Question answering (QA) maps a question and a context passage to an answer span or generated text. Common error modes include missing context, ambiguous questions, annotation noise, and models that copy plausible but incorrect spans. Evaluation typically uses exact-match and token-level F1 for span tasks, and human review for generation tasks.
Learning concept · Not a validated service
Question answering (QA) maps a question and a context passage to an answer span or generated text. Common error modes include missing context, ambiguous questions, annotation noise, and models that copy plausible but incorrect spans. Evaluation typically uses exact-match and token-level F1 for span tasks, and human review for generation tasks.
A proposed application: an internal document search assistant that highlights answer spans from policy documents and shows confidence scores for a human reviewer to confirm before use. This extension is not implemented in the supplied starter code.
Use an extractive QA dataset such as SQuAD or NaturalQuestions and store examples as {context, question, answer_span} records with provenance.
Apply a transformer tokenizer and convert answer character spans to token indices; handle cases where spans map to multiple tokens or are out of bounds.
Fine-tune a pretrained transformer (BERT/DistilBERT) to predict start and end token positions, tracking exact-match and token-F1 on validation data.
Serve predictions with answer span highlighting and confidence thresholds, and route low-confidence or high-risk queries to a human reviewer.
The supplied starter creates a synthetic tabular classification dataset (sklearn.datasets.make_classification), builds a scikit-learn Pipeline with StandardScaler and RandomForestClassifier, fits the model and prints a classification report. It does not process text, use tokenisers or fine-tune any QA model.
model = Pipeline(
steps=[
("scale", StandardScaler()),
("classifier", RandomForestClassifier(n_estimators=250, random_state=RANDOM_STATE)),
]
)
model.fit(X_train, y_train)
predictions = model.predict(X_test)The code contains no QA-specific components: it uses numeric synthetic features rather than context+question pairs, has no tokenizer, no span prediction or generation model, and does not use QA datasets such as SQuAD or NaturalQuestions.
Proposed extension: fine-tune a pretrained transformer on an extractive QA dataset (for example SQuAD v2), expose answers with highlighted spans and confidence, and collect human feedback to improve high-risk queries.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.