A LangGraph-powered multi-agent system with Self-RAG reflection, three-layer indexing, and knowledge graph reasoning — demonstrating the full evolution from naive RAG to production-grade agentic RAG.
This project is not a "plug data into LangChain" demo. It traces the full RAG evolution path.
LangGraph state machine coordinates 6 specialized agents through a Supervisor pattern.
Every component is deliberately chosen and production-hardened.
Supervisor orchestrates Retrieval (with Self-RAG reflection), Concept, Calculation, Exam, and Critic agents — each specialized for its task.
Retrieval agent evaluates result sufficiency and rewrites queries for re-retrieval — inspired by Self-RAG (Asai et al., 2023) and Corrective RAG (Yan et al., 2024).
Dense vectors (BGE-M3) + Sparse keywords (BM25) + Knowledge Graph (NetworkX, 79 nodes, 269 edges) for structured concept-formula-exam traversal.
BGE-M3 multilingual embeddings handle English lectures and Chinese study notes in one unified semantic space — no translation needed.
RAGAS metrics (faithfulness, context precision/recall, answer relevancy) with A/B strategy comparison — data-driven, not gut-feel.
FastAPI + SSE streaming + Docker Compose one-command deployment + LangSmith observability — not a notebook, a deployable system.
Source-aware chunking strategy — the most critical hyperparameter for retrieval quality.
| Source | Documents | Chunks | Strategy | Metadata |
|---|---|---|---|---|
| Lecture Slides | 21 PDFs · 582 pages | 200 | 3-slide merged windows | lecture_number, slide_range, topic_tags |
| Exam Papers | 9 years (2014–2025) | 25 | Question-boundary split | year, question_number, marks, content_type |
| Answer Keys | 3 years (2022–2025) | 15 | Sub-question paired chunks | year, question_number, sub_question |
| Seminar Solutions | 4 Tutorials | 23 | Tutorial → Question hierarchical | tutorial_number, language |
| Chinese Study Notes | 12 Markdown files | 475 | Markdown header-aware | file_topic, breadcrumb, language |
| Total | 738 | Each chunk carries rich metadata for filtered/scoped retrieval | ||
No defaults-for-defaults'-sake. Each component selected via deliberate trade-off analysis.
Each iteration builds on the last, deliberately growing complexity.
Document processing, 738 chunks, three-layer indexing (dense+sparse+KG placeholder), hybrid retrieval with RRF fusion, CLI with Rich
LangGraph state graph, Supervisor agent with planning+routing, Retrieval agent with Self-RAG reflection loop, Concept & Calc specialist agents
79-node, 269-edge knowledge graph (Concept↔Formula↔Lecture↔Exam), graph-traversal enhanced search, Exam Agent (generate + grade), Critic Agent (hallucination check)
FastAPI backend with SSE streaming, Docker Compose deployment, RAGAS evaluation framework with 5 ground-truth cases, A/B strategy comparison
Gradio Web UI, comprehensive testing, bilingual README (Chinese+English), project website