Module 4 of 4
Answers, citations and evaluation
Turning passages into a defensible answer.
Four lessonsAbout 15 minutes
Pipeline stageOne part of the chain
Self-checkedAnswers are in the text
Lesson 1
Building context
Put the question first, then the passages with source labels. Keep instructions separate from retrieved text.
More context is not better: irrelevant passages increase confusion and cost.
- Label every passage.
- Keep the top few, not the top twenty.
- Repeat the question after long context.
Check yourself. Why keep retrieved text separate from instructions?
Lesson 2
Citations and abstention
A citation should let a reader open the source and find the sentence. If no passage supports an answer, the system should say so.
Abstention is a feature. A confident guess is worse than a clear gap.
- Cite the passage, not the document only.
- Allow 'not found in the corpus'.
- Never cite a document the user cannot open.
Check yourself. What should the system do when the corpus is silent?
Lesson 3
Evaluation
Measure retrieval separately from answering: did the right passage appear, and did the answer use it faithfully?
Use labelled questions, a small human review and a fixed rubric. Track changes after every index or model update.
- Precision and recall for retrieval.
- Faithfulness and citation accuracy for answers.
- Regression tests on every release.
Check yourself. Which two things must be measured separately?
Lesson 4
Security
Retrieved text is untrusted input. A document can contain instructions aimed at the model.
Keep write tools away from the answering path, and require approval for any action the answer proposes.
- Treat documents as data.
- No tool calls from retrieved text.
- Log the sources and the answer.
Check yourself. Why is a poisoned document a security risk?