all projects

// RAG

arXiv Self-Correcting RAG

Multi-agent research synthesis with LangGraph

RAGMulti-AgentLangGraphPythonLLMs

Overview

Standard RAG breaks down on academic search — papers are long, citations matter, and the question often requires synthesis across multiple papers. This system adds two missing pieces: adaptive retrieval and self-correction.

How it works

  • Query routing — the orchestrator decides whether to retrieve, search the web, ask for clarification, or answer from prior context
  • Adaptive retrieval — initial vector search; if relevance is low, the agent reformulates the query and tries again
  • Document scoring — each retrieved chunk is scored for relevance to the question; low-scoring chunks are discarded before generation
  • Self-correction loop — after generating an answer, an evaluator agent checks for hallucinations and missing citations; if the check fails, it goes back to retrieval with feedback
  • Citation enforcement — every claim in the final answer must point to a specific arXiv ID and section

Built on LangGraph

The state machine is the point. LangGraph lets you express "if eval fails, go back to retrieve" cleanly without manual loop management — and the graph is inspectable for debugging.

Result

Substantially fewer hallucinations on academic queries compared to a single-pass RAG baseline, at the cost of higher latency. Worth it for a research assistant.