Week 11 · Grounded answering and abstention
Separate retrieval misses from unsupported answers.
← Week 10 · Subject contents · Week 12 →
Separate retrieval misses from unsupported answers.
Work through the problem
A grounded answer should cite evidence that entails its claim. Retrieval recall records whether the needed passage was found. Answer accuracy records whether the claim is correct. Support records whether the supplied passage backs it. One aggregate score hides where the pipeline failed.
Use exact key-value facts for a controlled test. For a requested key, accept an answer only if a retrieved passage contains that key and value. An abstention is correct for an unanswerable query, but a known fact missed by retrieval is a different failure.
Run the Python lab
knowledge = {"retention":"30 days","exports":"CSV"}
trials = [
("retention",{"retention":"30 days"},"30 days"),
("exports",{"retention":"30 days"},None),
("support",{},None),
("exports",{"exports":"CSV"},"PDF"),
]
for query,evidence,answer in trials:
retrieved = query in evidence
supported = answer is not None and retrieved and evidence[query]==answer
status = ("retrieval miss" if query in knowledge else "correct abstention") if answer is None else ("supported answer" if supported else "unsupported answer")
print(query,status)
assert trials[-1][2] != knowledge["exports"]
Output from the lab
retention supported answer
exports retrieval miss
support correct abstention
exports unsupported answer
Practice
- Why keep a correct but uncited answer separate from a supported answer?
Check your reasoning
- It can be factually right by chance or from prior knowledge, without evidence a reader can verify.
← Week 10 · Subject contents · Week 12 →
Further reading · Jurafsky and Martin · Speech and Language Processing