Dominar la ingeniería RAG6 / 10
Prompting the Generator — Grounding & Citations
Great retrieval is wasted if the model ignores it or can't point to its sources. Grounding is a prompt-design discipline, not an afterthought.

You retrieved the right chunks. Now the model has to use them — and only them. Grounding is the prompt discipline that turns retrieved context into a trustworthy answer.
The three rules of a grounded prompt
- Answer only from context. State it explicitly: "Use only the provided sources. If they don't contain the answer, say so."
- Cite by id. Give each chunk an id and require inline citations like
[3]. Citations make answers auditable and build user trust. - Permit "I don't know." An honest gap beats a confident fabrication. Reward abstention in the instruction.
Structure the context
SOURCES:
[1] (title, url) … chunk text …
[2] (title, url) … chunk text …
QUESTION: …
Answer using only the sources above. Cite as [n]. If the sources
do not answer the question, say you don't know.
Order matters: put the strongest re-ranked chunks first, and keep the source block visually distinct from the instruction.
Serie — Dominar la ingeniería RAG
- Parte 01Por qué el RAG Ingenuo Falla en ProducciónLa demostración de búsqueda vectorial de 50 líneas que impresiona en un notebook se desmorona en el momento en que usuarios reales hacen preguntas reales. Aquí te mostramos por qué — y el mapa para salir.
- Parte 02Chunking — The Decision That Sets Your CeilingYou can't retrieve what you chunked badly. Chunking is the most under-rated lever in RAG — and the cheapest to get right.
- Parte 03Embeddings & Vector Stores 101Un embedding convierte significado en geometría. Un vector store hace esa geometría buscable en milisegundos. Acertar en ambos hace que la recuperación sea sencilla.
- Parte 04Búsqueda Híbrida — Palabra clave + VectorLa búsqueda vectorial entiende significado pero falla con términos exactos, IDs y palabras raras. La búsqueda por palabra clave los domina y pierde la paráfrasis. Usa ambas.
- Parte 05Re-Ranking — The Cheap Quality WinLa recuperación te obtiene 30 fragmentos plausibles. Un re-ranker los lee contra la pregunta actual y eleva los verdaderamente relevantes a la cima.
- Parte 06Prompting the Generator — Grounding & Citations — estás aquíGreat retrieval is wasted if the model ignores it or can't point to its sources. Grounding is a prompt-design discipline, not an afterthought.
- Parte 07Evaluación — No puedes mejorar lo que no midesSin un conjunto de evaluación, cada cambio en RAG es una corazonada. Con uno, ajustas chunking, retrieval y prompts con un número que te dice si ayudaste o perjudicaste.
- Parte 08Handling Hallucinations & GuardrailsWhen retrieval comes up empty, a helpful model invents. Guardrails turn 'confidently wrong' into 'honestly unsure' — the difference users actually trust.
- Parte 09Disciplina de Costo y LatenciaUna consulta RAG toca embeddings, una base de datos vectorial, un re-ranker y un LLM. Cada uno suma milisegundos y centavos. A escala, la disciplina aquí es la diferencia entre un margen y un incendio.
- Parte 10La arquitectura de referencia RAG para producciónCada pieza, ensamblada: ingesta, recuperación híbrida, re-ranking, generación fundamentada, guardarraíles, evaluación y caché — el plano que puedes desplegar.