José González Oliva
Contact
Case Study

Evidence-first document RAG

A document retrieval flow designed to check whether evidence exists before asking the model to answer.

Problem

An LLM can generate confident text even when the available documents do not support the answer. This is a hallucination risk: the answer may sound correct but lack evidence.

What RAG means here

RAG means Retrieval-Augmented Generation. Before asking the model to answer, the system retrieves relevant information from a controlled document base. The model is then expected to answer using that retrieved evidence.

RAG is not described here as making the AI smarter. It is an engineering pattern for grounding answers in available documents and making the evidence path easier to inspect.

Critical-information nuance

In sensitive or critical environments, RAG may retrieve controlled operational information. That makes access control, source tracking, logging, document boundaries and evidence status part of the engineering problem.

The real corpus is not published. This portfolio uses synthetic examples to show behavior without exposing private or confidential material.

Architectural decision

Make retrieval status explicit. If the system finds relevant evidence, the state is EVIDENCE_FOUND. If the system does not have enough evidence, the state is NO_EVIDENCE and the response should not invent missing details.

Simplified flow

Question -> document search -> chunk selection -> evidence status -> answer with evidence or no-evidence response.

Synthetic example

{
  "query": "Which components are involved in a traceable execution?",
  "retrieval_status": "EVIDENCE_FOUND",
  "chunks": [
    {
      "chunk_id": 101,
      "source": "public-demo/runtime-overview.md",
      "score": 4
    }
  ],
  "published_corpus": "synthetic_demo_only"
}

What it demonstrates

Engineering focus on reducing and evaluating hallucination risk through evidence retrieval, explicit states, traces, contracts and output checks. It does not claim hallucinations are fully eliminated.

Stack

Python FastAPI Document Chunks Retrieval Metadata JSON Records Synthetic Evidence

Current status

Experimental. Useful as a local architecture and behavior validation flow, not as a published production RAG platform.