Project Overview
Built a graph-based RAG pipeline that extracts entities and relations from unstructured documents and retrieves context through relationship-aware subgraph search.
Problem Definition & Goals
- Problem: Pure vector retrieval misses relationship structure between people, events, and concepts, especially for multi-hop reasoning.
- Goal 1: Implement Graph RAG core logic natively without relying on external graph framework abstractions.
- Goal 2: Auto-build knowledge graphs and rank query-relevant subgraphs efficiently.
- Goal 3: Improve contextual retrieval quality for relation-heavy questions.
Key Features & Contributions
- Extraction Engine: Implemented LLM-based node/edge extraction into structured JSON.
- Custom Graph Model: Designed in-memory graph classes with JSON persistence support.
- Retrieval & Ranking: Added BFS expansion from seed entities with centrality/relevance scoring.
- Interactive Visualization: Integrated Streamlit and PyVis dashboards for graph inspection and response tracing.
Technical Challenges & Solutions
- API Bottleneck: Sequential chunk processing scaled poorly on long documents.
- Throughput Fix: Added asyncio-based asynchronous batching for faster extraction.
- Entity Duplication: Alias variants generated fragmented nodes and weak graph connectivity.
- ER Fix: Combined rule-based + semantic merging with threshold and relation-conflict guards, reducing duplicate nodes from 50 to 15.
Results & Learnings
- Result: Delivered an end-to-end native Graph RAG implementation from preprocessing to generation.
- Result: Improved graph quality and retrieval accuracy by cutting duplicate entities by about 70%.
- Result: Enabled discovery of hidden cross-document relations that simple text retrieval missed.
- Learning: Confirmed preprocessing quality, especially entity resolution, is a primary determinant of Graph RAG performance.