Los Laboratorios / AI Engineering
AI EngineeringAdvanced~7h
Build a hallucination detector that flags ungrounded claims in LLM answers
A post-generation checker for a RAG pipeline that decomposes an LLM's answer into individual factual claims, then verifies each claim against the retrieved source passages using an entailment check (NLI model or LLM-as-judge with the source text as evidence), labeling each claim as supported, contradicted, or unverifiable. You deliberately inject false claims into a test set of answers and measure the detector's precision and recall at catching them, including at least one adversarial case where a false claim is phrased to sound well-grounded.
Lo que demuestra
La frase que puedes defender en una entrevista.
Línea de currículum
Built a claim-level hallucination detector for a RAG pipeline that decomposes answers into atomic claims and checks each against retrieved context via entailment, catching 85%+ of injected false claims across a 30-example adversarial test set with a measured false-positive rate on true claims.
- Understands that hallucination detection at the answer level is too coarse and claim-level decomposition is what actually works
- Can implement an entailment/grounding check instead of asking the model to grade its own homework with no evidence
- Builds an adversarial eval set on purpose, rather than testing only on easy, obviously-wrong cases
- Reports precision and recall on both directions of error (missed hallucinations and false alarms on true claims)
El resumen
Lo que construyes, paso a paso.
- 01Build or reuse a RAG pipeline that generates answers grounded in retrieved passages, and capture both the answer and the exact source passages used for each generation
- 02Implement claim decomposition: split a generated answer into a list of atomic, independently-checkable factual claims
- 03Implement per-claim grounding verification: for each claim, check it against the retrieved source passages and label it supported, contradicted, or unverifiable (not present in sources)
- 04Build a labeled test set of 30+ answers where you deliberately inject false or unsupported claims into otherwise-grounded answers, tracking which specific sentences are the injected falsehoods
- 05Include at least 5 adversarial cases where the injected false claim is phrased in a confident, source-adjacent style specifically to evade a naive check
- 06Run the detector over the full test set and report precision, recall, and false-positive rate, comparing claim-level detection against a naive whole-answer LLM-judge baseline
La prueba
Está terminado cuando estos pasan.
The detector correctly labels the source-supported claims in a clean, non-adversarial answer as supported, with false-positive rate reported
automated test
The detector catches at least 85% of the deliberately injected false claims across the 30+ example labeled test set, with recall reported
automated test
At least 3 of the 5 adversarial (confidently-phrased) injected false claims are still caught, not just the easy obvious ones
automated test
A report compares claim-level detection precision/recall against a naive whole-answer LLM-judge baseline on the same test set
artifact
Stack
Pythonan LLM APIa RAG retrieval pipeline (existing or built for this lab)an NLI/entailment model or LLM-as-judge grounding check
Método Sage
frame → route → decide → prove
Conservas
A claim-level hallucination detector + adversarial labeled test set + precision/recall report vs a naive baseline