← Lessons

quiz vs the machine

Platinum1880

Machine Learning

The Graph RAG

Retrieve over a knowledge graph of entities to answer connected questions.

6 min read · advanced · beat Platinum to climb

When chunks are not enough

Plain vector RAG retrieves isolated passages, which struggles when an answer depends on relationships spread across many documents. A question like how are these two people connected needs links, not just similar text. Graph RAG builds a knowledge graph of entities and relations, then retrieves over that structure.

Building the graph

  • An extraction step reads the corpus and pulls out entities such as people, places, and concepts as nodes.
  • It records relations between them, like works at or located in, as edges.
  • Overlapping entities across documents merge, weaving separate sources into one connected web.

Retrieving over structure

Given a question, the system finds entry node entities, then traverses edges to gather a connected neighborhood of facts. This multi hop traversal assembles evidence that no single passage contained, following a chain of relations to reach the answer.

Community summaries

Some graph RAG systems cluster the graph into communities and pre summarize each, so broad questions about themes can be answered from summaries instead of scanning every node.

Costs

Extraction is expensive and imperfect, and the graph must be rebuilt or updated as the corpus changes. In return graph RAG excels at global and relational questions where flat retrieval scatters the evidence.

Key idea

Graph RAG builds a knowledge graph of entities and relations and retrieves by traversing edges, assembling multi hop relational evidence that flat passage retrieval cannot connect.

Check yourself

Answer to earn rating on the learn ladder.

1. What does graph RAG retrieve over?

2. What kind of question is graph RAG especially good at?

3. What is a notable cost of graph RAG?