All concepts
GraphRAG
Use entities and relationships to retrieve connected evidence, not just nearest chunks.
RAG & Retrieval · Advanced · ~8 min
In plain English
Instead of only retrieving passages, build a graph of the entities and how they relate, so you can answer questions that need connecting several documents.
Why it's worth your time
Standard RAG can't answer 'how are these two things connected' — the answer isn't in any single chunk.
If you remember three things
- Extract entities and relationships at index time
- Retrieval traverses the graph, not just a similarity list
- Indexing cost is much higher than plain RAG
Overview
GraphRAG retrieves over a knowledge graph instead of only nearest chunks. An LLM extracts entities and relationships from documents into nodes and edges with provenance; queries then traverse neighborhoods, paths, and community summaries to gather connected evidence — strong for multi-hop questions whose facts are scattered across sources.
How it works
- Start: Documents Raw documents contain people, companies, concepts, and relationships.
- Documents -> Entity Extraction LLMs or NLP models extract entities, claims, and links.
- Entity Extraction -> Knowledge Graph Entities become nodes and relationships become edges with provenance.
- Knowledge Graph -> Graph Traversal A query can retrieve neighborhoods, paths, summaries, and connected evidence.
- Graph Traversal -> Grounded Answer GraphRAG helps multi-hop questions where relevant evidence is spread across documents.
In an interview
Standard RAG retrieves the top-k chunks nearest a query, which misses answers that require connecting facts across documents. GraphRAG first builds a knowledge graph — entities as nodes, relationships as edges — then traverses it, so multi-hop and 'summarize this whole topic' questions can pull in linked evidence a vector search alone would never surface.
Production defaults
- Use when
- questions are multi-hop or global ('what themes recur across these reports?')
- Cost
- entity extraction over a whole corpus is a real LLM bill. Budget it before committing
- Hybrid
- keep normal vector retrieval alongside — most questions still don't need the graph
What breaks
- Indexing cost is enormous — Extraction runs an LLM over every chunk. Restrict to the subset of documents that genuinely need graph queries.
- The graph is full of duplicate entities — No entity resolution. 'Acme', 'Acme Inc' and 'ACME' need merging or traversal breaks.