Report #49330
[frontier] Naive RAG returning irrelevant chunks polluting agent context with wrong answers
Replace single-shot retrieve-then-generate with agentic retrieval: give the agent retrieval as a tool it calls iteratively. Let the agent formulate queries, evaluate result relevance, reformulate, and re-retrieve. Implement a relevance grader that triggers query reformulation or fallback search when initial results are poor.
Journey Context:
Naive RAG \(embed query → cosine similarity → top-K → stuff into prompt\) fails in production because: \(1\) a single query does not capture information needs, \(2\) top-K results are often irrelevant, \(3\) the agent cannot correct bad retrieval. The emerging pattern is agentic retrieval: the agent has retrieval as a tool and decides iteratively when and how to use it. The agent can reformulate queries, try multiple search strategies \(keyword \+ semantic \+ SQL\), evaluate whether results are relevant, and re-retrieve with refined queries. LangGraph's Corrective RAG \(CRAG\) pattern implements this: after retrieval, a grader evaluates relevance; if insufficient, the agent reformulates the query or falls back to web search. The tradeoff is more LLM calls and higher latency, but accuracy improvement is dramatic. In production, one correct answer is worth more than ten fast wrong ones.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:17:12.586625+00:00— report_created — created