Back to the map

Module 08 · Advanced retrieval · Lesson 1 of 6

Graph RAG

Flat chunks cannot join facts across documents; graph RAG extracts entities and relations with an LLM, retrieves by traversal, pays for it in extraction calls and drift, and loses to a plain join when the data is already in tables.

DeepShould-knowSenior 14 min Updated Nov 2026

Why it matters

Flat chunk retrieval answers questions whose evidence sits in one place. Ask "which suppliers of the parts in product X are in the same region as our warehouse" and the evidence is spread across a bill of materials, a supplier register and a facilities list. No chunk contains the answer, and no embedding of the question is close to the chunk about the supplier. Interviewers ask about graph RAG because this failure is common and quiet, and because the fix is the clearest case of "add structure, or add a join". A senior answer knows the technique, its bill, and when a join is the honest answer.

The idea

Why flat chunks miss

A chunk is a span of text with an embedding, scored against the question on its own. Facts in two chunks have no joint score, so a chain (X contains part A, A is made by supplier S, S is in region R) is found only if one chunk states it. Multi-hop questions are recall failures, not ranking failures: a larger top-k rarely helps, because the missing chunk is about a supplier and the question is about a product.

Building the graph

Graph RAG adds structure at ingestion. A model reads each document and extracts entities (products, parts, suppliers, regions) and relations between them (contains, made by, located in), each with a pointer back to its source span. Entities are merged across documents so that "Acme Ltd" and "Acme" become one node. Most implementations then cluster the graph into communities and have the model summarise each, so there is a short description of every neighbourhood as well as every fact.

Retrieval by traversal

At query time the pipeline finds entry entities in the question (product X, the warehouse), walks the edges a few hops outward, collects the connected nodes with their source text, and hands that subgraph to the model. The walk does the joining that embeddings cannot. Each hop can be filtered (only "made by" edges) so the subgraph stays small, and the source spans travel with it, so the answer can cite its documents.

Product XPart 1Part 2Supplier ASupplier BNorthWarehouseSouthcontainsmade byininhop 1: X contains parts; hop 2: parts are made by suppliersfilter on region: Supplier A shares North with the warehouse
A two-hop walk joins what no single chunk states: product to parts, parts to suppliers, then a filter on region. The path is the explanation.

Local and global questions

Local questions start from named entities and want their neighbourhood: traversal plus the attached text. Global questions ask about the corpus as a whole, "what are the main supply risks across our vendors", with no entity as entry point. Those are answered from the community summaries: retrieve them, rank them, let the model synthesise. Flat retrieval fails them for the same reason: no chunk is about the whole.

Hybrid graph and vector

The graph does not replace the vector index. Entity nodes and community summaries get embeddings too, so a fuzzy question can land on the right entry node; traversal expands it; a vector search near the subgraph fills in detail the extractor missed.

What it costs

Extraction is the bill. Every document needs at least one model call to pull entities and relations, several for long documents, and one more per community summary, so indexing 100,000 documents is a few hundred thousand model calls before anyone asks a question. Extraction also errs: missed relations, entities merged that should be separate. And the graph drifts. When a document changes, its entities and edges must be re-extracted, re-merged, and the affected summaries rewritten, which is harder than re-embedding a chunk; the Freshness lesson covers that machinery.

When a join is the honest answer

If the facts already live in tables, the right pipeline is a structured query. Products, parts, suppliers and regions are what a company keeps in a database, and a join across three tables answers the warehouse question exactly, cheaply and without extraction errors. Graph RAG earns its place when the relations are buried in prose: contracts, incident reports, research notes, email threads. A metadata filter on the vector index (region equals North) is the middle option when only one hop needs structure.

 Vector RAGGraph RAGStructured query
Multi-hop questionsMisses chains; more top-k does not helpJoins by traversal; depth is a tuning knobExact joins when the facts are in tables
Build costOne embedding call per chunkSeveral model calls per document plus community summariesSchema and ETL work; no model calls
FreshnessRe-embed the changed chunkRe-extract, re-merge, rewrite summariesLive on every query
ExplainabilityTop chunks and scoresThe path through the graph, with source spansThe query itself
FitsSingle-fact questions over proseRelations buried in proseData someone already structured

Trade-offs

You buy multi-hop recall and explainable paths with a large one-off extraction cost, an ongoing maintenance cost, and a new class of errors that look like facts: a wrong edge becomes a confident wrong answer with a citation. Traversal depth has a cliff on each side; one hop too few misses the chain, one too many floods the context with the whole neighbourhood. And the graph does nothing for questions that were already fine, which is most of them, so measure the share of traffic that is multi-hop before building.

In an interview

Raise it when a question needs facts joined across documents: "Flat chunks score each span alone, so a chain across three documents has no chunk to retrieve. If the data is structured I join it; if the relations are buried in prose I extract a graph and retrieve by traversal." At junior depth, explain why multi-hop fails with chunks. At mid depth, describe extraction, traversal, local versus global questions. At senior depth, put numbers on extraction cost, say how the graph stays fresh, and argue for a join or a metadata filter where it fits. Expect: "How do you know the graph is right?" Sample edges against their source spans; measure recall on a labelled multi-hop set.

Check yourself

A legal team asks questions such as 'which supplier contracts in Germany have a termination clause that references the data processing agreement'. Vector RAG returns chunks that mention Germany or termination, rarely both, and never the referenced agreement. What fits best?

Graph RAG · Backplane