Most RAG tutorials focus on retrieval quality: better embeddings, better chunking, better reranking. What they skip is the part that determines whether users trust the output: what happens when the retrieved context doesn't actually answer the question.
When I built a RAG assistant delivered over WhatsApp, backed by vector search over PostgreSQL with pgvector, the retrieval pipeline was the easy part. The hard part was what I'd call the confidence problem: LLMs sound certain even when the retrieved context is thin or missing. A demo tolerates that. A production assistant answering real users doesn't.
The fix was structural, not prompt-based. Instead of asking the model to "only answer based on the provided context," I enforced a structured JSON output where every claim had to carry a citation pointing to a specific retrieved chunk. If the model couldn't populate that field, the response was rejected before reaching the user, and the system fell back to "I don't have enough information to answer that."
This shifts the whole design conversation from optimizing retrieval recall to closing the gap between what was retrieved and what the model is allowed to claim:
Chunking got more conservative, since vague chunks produce unciteable claims.
The system prompt got shorter, since enforcement moved from instructions to schema validation.
Failure became visible instead of silent: a bad retrieval now produces "I don't know," not a confident wrong answer.
Retrieval quality gets you a demo. Citation enforcement gets you something you can put in front of real users without babysitting it.
Top comments (0)