← Lab
Experiment·RAG, Graph RAG & Retrieval·5 min read

Agentic RAG Service

Plain retrieval answers the question you asked. Agentic retrieval checks whether it actually found the answer before writing one.

Agentic RAG Service

The difference between RAG that demos well and RAG that survives real questions is what happens when retrieval comes back thin. A basic pipeline generates anyway. An agentic one notices and goes back.

The pipeline, stage by stage

01RewriteResolve vague pronouns and expand domain synonyms into several sub-queries. Cheap, and it fixes a large share of retrieval misses.
02RetrieveHybrid dense plus keyword search, unioned and deduped by document section. Neither method alone covers both paraphrase and exact-term matching.
03RerankA cross-encoder scores each candidate against the original question. Embedding similarity finds topically close passages; the reranker finds correct ones.
04VerifyCheck whether the kept context actually covers the question. A gap triggers one more targeted query rather than a confident guess.
05AnswerEvery claim carries a citation, or it does not get written.

Evaluate retrieval separately from generation

The single most useful habit in this area: score the two halves independently. A bad answer from good context is a generation problem; a good answer from bad context got lucky. Faithfulness, context recall, context precision and answer relevance each tell you which half to fix.

Track unanswerable questions too. A system that confidently answers something its corpus does not cover is worse than one that says it does not know, and only a dedicated eval slice catches it.

What to take away
  • Rewrite queries before retrieving; it fixes many misses cheaply.
  • Hybrid retrieval covers what dense or keyword alone will not.
  • A verification step turns a confident wrong answer into a re-query.
  • Score retrieval and generation separately or you cannot fix either.

Field notes on building production AI systems — collected, verified and written up so they are useful to anyone working on the same problems.

smoke
“Innovation distinguishes between a leader and a follower.”

Need an AI system that holds up in production? Tell me what breaks today and I'll tell you what I'd build.

Call Me now !

mail

abdelmajidzaddi088@gmail.com

address

Mohammedia, Morocco

phone

+212 695 557 631