Pattern · Retrieval and RAG
Graph RAG
Extract entities and relationships into a knowledge graph so questions about connections and themes can be answered.
Say it in the interview
I would only reach for graph RAG when questions are about relationships or the whole corpus. Plain RAG handles lookups more cheaply, so I would show on the golden set which questions plain RAG fails before paying for a graph.
When to use it
- Questions about relationships across many documents ("which contractors are on delayed projects?")
- Global questions ("what are the main themes?")
How it works
- Documents → Extract entities and relations
- Extract entities and relations → Knowledge graph
- Knowledge graph → Community summaries
- Question → about specific things → Local search: entities + neighbours + source chunks
- Question → about the whole corpus → Global search: map over summaries, then reduce
Trade-offs
- Answers questions plain RAG cannot
- Costly to build and to keep up to date
- Extraction errors become wrong edges
Pitfalls interviewers probe
- Using it when plain RAG would do
- No plan to update the graph as documents change