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 type | What it looks like | Defense |
|---|---|---|
| Wrong detail | A number or qualifier subtly off | Citations + low temperature |
| Contradiction | States the opposite of the source | Answer-only-from-context instruction |
| Fabrication | Invents a fact or a source | Require citations; allow "not covered" |
| Unsupported synthesis | Merges two chunks into a new claim | Forbid 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.
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ón | Cómo se ve | Defensa |
|---|---|---|
| Detalle equivocado | Un número o matiz sutilmente mal | Citas + temperatura baja |
| Contradicción | Afirma lo opuesto a la fuente | Instrucción de responder solo desde el contexto |
| Fabricación | Inventa un hecho o una fuente | Exigir citas; permitir "no cubierto" |
| Síntesis sin respaldo | Une dos chunks en una afirmación nueva | Prohibir 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.
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.