← Clinical AI & Healthcare Evidence, systems and care.

Grounding an LLM in evidence: faithfulness, citations and hallucinations

🌳 Evergreen
#rag#hallucinations#faithfulness#citations#safety
TL;DR

Retrieval puts the right passages in front of the model, but the model can still drift and state something the passages never said. Grounding is the discipline that fights that: cite every claim, forbid mixing chunks, measure faithfulness. In any high-stakes domain, a confident unsupported answer is the failure to engineer against.

Method note: the evaluation framework and hallucination taxonomy here are cited to their sources. I studied the applied side in the DeepLearning.AI RAG course; nothing proprietary is reproduced. The diagram is my own.

Context

Retrieval solves half the problem. It puts the right passages in front of the model. But the model still writes the answer, and it can quietly say something the passages never supported. In a low-stakes setting that is an annoyance. In anything clinical it is a safety failure, because a fluent, confident, wrong sentence is exactly the kind a reader is least likely to question.

The concept

Hallucinations are not one thing. A small detail can be wrong, which is the hardest kind to catch. A statement can contradict the source. Or the model can fabricate something whole (Ji et al., 2023). The mechanism behind them, in a retrieval system, is that the model can weigh its own prior over the retrieved context and complete a plausible but unsupported sentence.

The defenses are boring and they work. Keep generation temperature low so the model stays close to the evidence. Instruct it to answer only from the retrieved documents and to judge whether each one is even relevant. Require a citation on every claim, so an unsupported sentence has nowhere to hide. Forbid combining separate chunks into a new claim neither of them made. And let it say “the documents do not cover this” instead of inventing.

Hallucination typeWhat it looks likeDefense
Wrong detailA number or qualifier subtly offCitations + low temperature
ContradictionStates the opposite of the sourceAnswer-only-from-context instruction
FabricationInvents a fact or a sourceRequire citations; allow "not covered"
Unsupported synthesisMerges two chunks into a new claimForbid cross-chunk combination

You cannot manage what you do not measure, so grounding has metrics. Faithfulness is the fraction of the answer’s claims that are actually supported by the retrieved chunks, and in a serious system you want it very high. Response relevancy asks whether the answer addresses the question at all. Frameworks like RAGAS estimate these automatically by decomposing an answer into claims and checking each against the context (Es et al., 2023). Citation validity is its own check: every reference must point to a chunk that genuinely says what is claimed.

generated answer claim 1 claim 2 claim 3 supported by a retrieved chunk? ✓ keep ✓ keep ✗ flag / drop faithfulness = supported / total Break the answer into claims, check each against the context, score the fraction supported.
Faithfulness scoring: every claim must trace to a retrieved chunk. My own diagram.

Where this connects

  • Clinical AI. This is the safety layer, and it is the part of my own thinking I care about most. A system that answers over guidelines or papers must never state something the evidence does not carry, and it must show its work so a clinician can verify. Citations turn the model from an oracle into a research assistant you can audit. The honest posture is that a confident wrong answer is worse than “I don’t know”, and every grounding rule exists to make that trade the default.
  • Data science and beyond. Faithfulness is a general evaluation idea for any generative system tied to a source of truth: legal summarization, financial reporting, technical documentation. Decomposing an output into checkable claims and measuring how many are supported is a reusable way to make “the model sounds right” into “the model is grounded”, which are not the same thing.

Nota de método: el marco de evaluación y la taxonomía de alucinaciones están citados a sus fuentes. Estudié el lado aplicado en el curso de RAG de DeepLearning.AI; no se reproduce nada propietario. El diagrama es propio.

Contexto

La recuperación resuelve la mitad del problema. Pone los pasajes correctos frente al modelo. Pero el modelo aún escribe la respuesta, y puede afirmar en silencio algo que los pasajes nunca respaldaron. En un contexto de bajo riesgo es una molestia. En algo clínico es un fallo de seguridad, porque una frase fluida, segura y equivocada es justo la que un lector tiene menos probabilidad de cuestionar.

El concepto

Las alucinaciones no son una sola cosa. Un detalle puede estar mal, que es el tipo más difícil de atrapar. Una afirmación puede contradecir la fuente. O el modelo puede fabricar algo entero (Ji et al., 2023). El mecanismo detrás, en un sistema de recuperación, es que el modelo puede pesar su propio conocimiento previo sobre el contexto recuperado y completar una frase plausible pero sin respaldo.

Las defensas son aburridas y funcionan. Mantén baja la temperatura de generación para que el modelo se quede cerca de la evidencia. Instrúyelo a responder solo desde los documentos recuperados y a juzgar si cada uno es siquiera relevante. Exige una cita en cada afirmación, para que una frase sin respaldo no tenga dónde esconderse. Prohíbe combinar chunks separados en una afirmación nueva que ninguno hizo. Y déjalo decir “los documentos no cubren esto” en vez de inventar.

Tipo de alucinaciónCómo se veDefensa
Detalle equivocadoUn número o matiz sutilmente malCitas + temperatura baja
ContradicciónAfirma lo opuesto a la fuenteInstrucción de responder solo desde el contexto
FabricaciónInventa un hecho o una fuenteExigir citas; permitir "no cubierto"
Síntesis sin respaldoUne dos chunks en una afirmación nuevaProhibir combinar chunks

No puedes gestionar lo que no mides, así que el grounding tiene métricas. La faithfulness es la fracción de las afirmaciones de la respuesta que de verdad están respaldadas por los chunks recuperados, y en un sistema serio la quieres muy alta. La relevancia de la respuesta pregunta si la respuesta siquiera aborda la pregunta. Marcos como RAGAS estiman esto de forma automática descomponiendo una respuesta en afirmaciones y verificando cada una contra el contexto (Es et al., 2023). La validez de las citas es su propio chequeo: cada referencia debe apuntar a un chunk que genuinamente diga lo que se afirma.

respuesta generada afirmación 1 afirmación 2 afirmación 3 ¿respaldada por un chunk recuperado? ✓ conservar ✓ conservar ✗ marcar / quitar faithfulness = respaldadas / total Parte la respuesta en afirmaciones, verifica cada una contra el contexto, puntúa la fracción respaldada.
Puntaje de faithfulness: toda afirmación debe rastrearse a un chunk recuperado. Diagrama propio.

Dónde conecta

  • Clinical AI. Esta es la capa de seguridad, y es la parte de mi propio pensamiento que más me importa. Un sistema que responde sobre guías o papers nunca debe afirmar algo que la evidencia no carga, y debe mostrar su trabajo para que un clínico pueda verificar. Las citas convierten al modelo de oráculo en un asistente de investigación auditable. La postura honesta es que una respuesta segura pero equivocada es peor que un “no sé”, y cada regla de grounding existe para volver ese trato el default.
  • Data science y más allá. La faithfulness es una idea de evaluación general para cualquier sistema generativo atado a una fuente de verdad: resumen legal, reporte financiero, documentación técnica. Descomponer una salida en afirmaciones verificables y medir cuántas están respaldadas es una forma reutilizable de convertir “el modelo suena bien” en “el modelo está fundamentado”, que no son lo mismo.

Sources