Phase 05: NLP: Foundations to Advanced

Question Answering Systems

Three systems shaped modern QA. Extractive found spans. Retrieval-augmented grounded them in documents. Generative produced answers. Every modern AI assistant is a mix of the three. A user types "When did the first iPhone launch?" and expects "June 29, 2007." Not "Apple's history is long and varied." Not "2007" sitting in isolation with no sentence. A direct, grounded, correct answer. Three architectures have dominated QA over the last decade. Extractive QA. Given a question and a passage that is known to contain the answer, find the start and end indices of the answer span in the passage. SQuAD is the canonical benchmark. Open-domain QA. The passage is not given. Retrieve the relevant passage first, then extract or generate an answer. This is the bedrock of every RAG pipeline today. Generative / Closed-book QA. A large language model answers from its parametric memory. No retrieval. Fastest at inference, least reliable on facts. The trend in 2026 is hybrid: retrieve the best few passages, then prompt a generative model to answer grounded in those passages. That is RAG, and lesson 14 covers the retrieval half in depth. This lesson builds the QA half. QA architectures: extractive, retrieval-augmented, generative Extractive. Encode question and passage together with a transformer (BERT family). Train two heads that predict start and end token indices of the answer.…

Question Answering Systems: Three systems shaped modern QA. Extractive found spans. Retrieval-augmented grounded them in documents. Generative produced…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.