Fact-Checking and Hallucination Prevention
Grounding-based verification: every claim must trace to a retrieved source.
The Hallucination Problem in Research Agents
LLMs can generate plausible-sounding claims with no basis in the retrieved sources. In a research agent, this is especially dangerous because the output looks authoritative and is presented with citations that may not actually support the claim.
Hallucination prevention must be a first-class concern.
Grounding: Every Claim Traces to a Source
The core principle of grounding: every factual claim in the final output must be traceable to at least one retrieved document. Claims that cannot be traced are either hallucinated or unsupported — both are unacceptable in a research report.
def check_grounding(claim: str, retrieved_docs: list[dict]) -> dict:
doc_texts = '\n\n'.join(
f'[DOC {i+1}] ({d["url"]})\n{d["text"][:800]}'
for i, d in enumerate(retrieved_docs[:5])
)
return {
'claim': claim,
'docs': doc_texts,
'grounded': None # to be filled by LLM verifier
}All lessons in this course
- Multi-Step Research Loop Design
- Source Verification and Citation
- Structured Report Generation
- Fact-Checking and Hallucination Prevention