GraphRAG
Entity/relationship graphs that improve multi-hop questions beyond flat chunk retrieval.
In plain words
The system builds a map of who and what is connected to whom, then follows the connections to answer questions that need several pieces of information.
Think of it like…
A detective's evidence board: instead of a pile of separate witness statements (chunks), names and places are pinned and connected with string. To answer "who connects person A to the warehouse?", you follow the string rather than searching for a statement that mentions both.
Where you’ve seen it
An investigations team has 80,000 emails and filings. The question "Which intermediaries connect Company A's directors to the shipping contracts?" returns nothing useful from vector search: no passage mentions all of it. With an extracted graph (entities: people, companies, contracts; relations: director_of, party_to, owns), a two-hop traversal finds three intermediaries, and the answer cites the supporting documents. The extra cost: about 40 hours of LLM extraction for the corpus and a graph database to maintain.
Words you’ll hear
- Knowledge graph
- Nodes (entities) and edges (relationships), often with source passages attached.
- Multi-hop question
- A question needing several linked facts from different documents.
- Community summary
- An LLM-written summary of a cluster of related entities, used for global questions.
- Local vs global search
- Local: start from entities in the question and expand. Global: map-reduce over community summaries.
Visual diagram
Theory & deep dive
What GraphRAG adds over vector RAG
Indexing: split documents into chunks, ask an LLM to extract entities and relationships (with types, descriptions and the source chunk), merge duplicates through entity resolution ("Acme Ltd", "ACME Limited" and "Acme" become one node), and store the graph. Microsoft's GraphRAG then runs community detection (Leiden clustering) to group densely connected entities hierarchically and generates summaries for each community. Querying: local search identifies entities in the question, expands to neighbours and their text units, and gives the LLM those facts and passages; global search has the LLM answer from community summaries in a map-reduce fashion, which is how "what are the main themes?" gets answered across millions of tokens.
Lighter variants exist: build a graph over chunks linked by shared entities, use an existing knowledge graph or database (customers, products, org charts) and let an LLM write graph queries (Text-to-Cypher), or use graph traversal as an extra retriever fused with vector and keyword results.
Question: which suppliers of the delayed Part X also supply Competitor Y? Cypher-style: MATCH (s:Supplier)-[:SUPPLIES]->(:Part {name:"X"}), (s)-[:SUPPLIES]->(:Company {name:"Y"}) RETURN s. Each edge carries source document ids for citation.
Costs, risks and when to use it
Costs and risks: extraction is expensive (many LLM calls per chunk, often 10 to 100 times the cost of embedding alone); extraction errors create wrong or duplicate nodes and edges; schema and entity-resolution choices need design and tuning; graphs go stale as documents change and need incremental updates; and queries add latency. Evaluate against a strong baseline of hybrid search, reranking and parent-child retrieval first, because many apparent multi-hop failures are really retrieval or chunking problems.
Use GraphRAG when questions genuinely require connecting entities across documents, when users ask corpus-wide thematic questions, when relationships are first-class (supply chains, org structures, fraud rings, biomedical interactions) or when explainable reasoning paths matter. Skip it for straightforward lookup, FAQ or documentation questions. Measure with a labelled set that includes multi-hop and global questions, and compare answer quality, latency and indexing cost with the simpler baseline.
Of 200 test questions, 150 are single-fact lookups (hybrid RAG scores 92%), 30 are multi-hop (hybrid 48%, graph-assisted 71%) and 20 are global (hybrid 25%, GraphRAG global 68%). The graph pays off for 25% of questions, so they route only those through it.
How it works, step by step
Step 1 of 41. Check the baseline
Measure hybrid search plus reranking on single-hop, multi-hop and global questions to see what actually fails.
- Decide
- if a graph is worth it
When to use it & trade-offs
What it is
GraphRAG augments retrieval with a knowledge graph: an LLM extracts entities (people, companies, products, policies) and relationships between them from the documents, and queries can then follow links across documents. Microsoft's GraphRAG approach also clusters the graph into communities and writes a summary for each, which lets the system answer global questions ("what are the main themes across these 10,000 reports?") that flat chunk retrieval can't. Flat vector RAG finds passages that look like the question; graph RAG finds connected evidence.
Why it matters: Ordinary RAG is weak on multi-hop questions ("which suppliers of the delayed component also supply our competitor?") because the needed facts sit in different documents and no single chunk resembles the question, and on corpus-wide summaries. GraphRAG can help, but it adds heavy indexing cost, pipeline complexity and failure modes. Knowing when it's worth it, and when hybrid search with good chunking is enough, is the real skill.
When to reach for it
- Investigations, supply-chain and compliance analysis
- Thematic summaries across large collections
- Domains where relationships are the point
When to avoid or be careful
- GraphRAG for simple FAQ or documentation lookup
- Skipping entity resolution
- Adopting it without comparing against hybrid search plus reranking
Retrieval approaches for connected questions
Strengths: Simple, cheap, mature.
Watch out: Weak on multi-hop and corpus-level questions.
Strengths: Connected evidence; theme-level answers.
Watch out: High indexing cost; extraction errors; maintenance.
Strengths: Accurate, no extraction needed.
Watch out: Needs reliable query generation and schema docs.
Interview signals & numbers to know
When this topic comes up
- “Questions need facts from several documents”
- “Summarise the main themes across the whole corpus”
- “Who connects A to B?”
- Knowledge graphs
- Multi-hop QA
Benchmarks & rules of thumb
- 10 – 100×
- extraction cost relative to embedding alone
- 48% → 71%
- multi-hop gain in the example
- 25%
- share of questions the graph helped
Common mistakes & follow-ups
Common interview mistakes
- Building a graph for a corpus where every question is a single-fact lookup.
- Leaving duplicate entities unmerged, fragmenting the graph into unconnected pieces.
- Treating the extracted graph as ground truth without checking error rates.
Likely interviewer follow-ups
- When would you choose GraphRAG over plain RAG?
- What is the difference between local and global search?
- How would you keep a knowledge graph up to date?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply GraphRAG with generative AI interview Q&A and hands-on practice.