Skip to main content

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

  1. Documents → Extract entities and relations
  2. Extract entities and relations → Knowledge graph
  3. Knowledge graph → Community summaries
  4. Question → about specific things → Local search: entities + neighbours + source chunks
  5. 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

Practise it on these questions

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.