Question answering (QA) systems respond to questions in natural language. Several designs exist, with different trade-offs.
Extractive QA
The system finds the exact span of text in a document that answers the question. Answers are always grounded in the source, but can only quote what's written.
Generative QA
A language model writes an answer in its own words. Flexible and fluent, but prone to hallucination if it relies only on what it learned in training.
Retrieval-Augmented QA
Combines both ideas: retrieve relevant passages from a document collection, then have a language model answer using them, with citations. This is the standard approach for enterprise knowledge bases.
Structured Data QA
Questions over databases and spreadsheets can be answered by generating a query (such as SQL) from the question, running it, and explaining the result. Validate generated queries and restrict permissions.
Designing a Good QA System
- Define the question types and sources you'll support.
- Show sources with every answer so users can verify.
- Handle "I don't know" gracefully when the information isn't available.
- Keep content current.
Evaluation
Build a set of real questions with correct answers and source passages. Measure answer correctness, groundedness (is it supported by the sources?) and how often it correctly declines to answer.