Ground an answer and evaluate its evidence
Build a small learning assistant whose claims can be checked against approved material.
What you’ll learn
- Separate retrieval quality from answer quality
- Design a task-specific evaluation with unsupported questions
- Treat retrieved text as evidence rather than instructions
Define a narrow useful task
Start with an assistant that answers questions about a small approved set of course notes. The contract is concrete: explain concepts using those notes, identify the supporting sections, and say when the collection does not contain enough evidence. This is easier to evaluate than an assistant advertised as knowing everything. A fluent answer can still contain an incorrect statement, so the interface and tests must reward supported explanations rather than confidence or length. Keep a manual path to the original lesson visible.
Trace retrieval before generation
A learner asks why a Python generator stops after one complete pass. The retrieval step should find the note about iterator exhaustion, not merely a paragraph mentioning Python. The generation step then receives the question and selected evidence and produces an explanation linked to that evidence. If retrieval returns unrelated text, changing the wording of the answer prompt may not repair the root cause. Inspect the retrieved passages and their identifiers separately from the final answer so both stages remain understandable.
Design a small evaluation set
Create questions covering a direct fact, an explanation, a comparison, an ambiguous request, and a question absent from the collection. For each, write what a useful answer must include and which claims would be unacceptable. The absent question is especially important: an assistant that invents a lesson policy should fail even if its prose sounds helpful. Evaluate citations for actual support, not just the presence of a link. Keep some examples separate from the examples used while adjusting the prompts.
Treat source text as untrusted content
A contributed note might contain a sentence asking the assistant to ignore prior rules or reveal private data. That sentence is content to analyze, not permission to change the application’s instructions. Keep tool permissions narrow and enforce authorization outside the model. Retrieval should respect the learner’s access before sending documents into a response. For a public learning library, avoid collecting private learner data merely to personalize a simple explanation. A useful prototype can work with approved public notes and no privileged tools.
Measure changes and acknowledge limits
Record the model configuration, prompt revision, collection revision, evaluation examples, and observed failures for each experiment. Repeat important cases because generated output can vary. A change that improves one demonstration can weaken refusal on unsupported questions or increase latency and cost. Choose an explicit improvement target, compare like with like, and review examples a numeric score misses. Grounding reduces some failure modes by providing evidence, but it does not guarantee that every generated claim is correct or faithfully supported.
Try it yourself
An assistant cites a page about lists when answering a question about generator exhaustion. Its explanation happens to be correct. Should the citation check pass? Add one missing-evidence test.
Show a possible solution
The citation check should fail because the cited passage does not support the claim, even if the claim is independently true. Add a question about a policy absent from the collection and require the assistant to state the limitation instead of inventing a policy.
Check your understanding
Try 11 questions across generative ai. Read each explanation and revisit anything that needs another pass.
Practise this subjectGo to the source
Use these primary references to check details and explore the topic further.
Saved in this browser. Signed-in progress syncs to your account.