Skip to content

Research · Retrieval · Graphs

How GraphRAG works.

Updated

GraphRAG is retrieval-augmented generation that reads a map of your documents instead of separate passages. Colidal builds a knowledge graph of the suppliers, products, contracts, and events in your documents and how they connect, so the AI can answer questions that span many documents and show the path it followed.

graph = entities + relationships · search = local + global · path = shown

GraphRAG is a form of retrieval-augmented generation that stores knowledge as a graph of entities and the relationships between them, and retrieves connected facts instead of isolated passages.

How it works

Build the map once. Follow it for every question.

Ordinary RAG finds passages that look like the question. GraphRAG first works out what the documents are about and how those things connect, then answers from the connections.

  1. The corpus is split into chunks.
  2. An LLM extracts entities and relationships from every chunk.
  3. They are stored as a knowledge graph.
  4. Related entities are grouped into communities.
  5. An LLM writes a summary of each community, stored with the graph.
  6. A query is mapped to entities in the graph.
  7. The graph is traversed: locally along relationships, or globally across community summaries.
  8. The relevant graph context and the query go to the generative model.
  9. The model answers and the path through the graph can be shown.
How GraphRAG answers: an LLM reads every chunk and builds a knowledge graph of entities and relationships, then groups it into communities and summarizes each one. At runtime the question is mapped onto the graph, the relevant part is retrieved, and the model answers from it.

Indexing

Before any question

  1. 01

    Split the documents into chunks.

    The same first step as ordinary RAG.

  2. 02

    Extract entities and relationships.

    An LLM reads every chunk and lists the things in it (a supplier, a product, a contract) and how they relate.

  3. 03

    Build the knowledge graph.

    Each entity becomes a node. Each relationship becomes an edge. The same supplier in fifty documents becomes one node.

  4. 04

    Detect and summarize communities.

    A clustering algorithm (Leiden) groups closely linked entities. An LLM writes a summary of each group.

Query

When a question arrives

  1. 01

    Find the entities in the question.

    The question is mapped to nodes and edges in the graph.

  2. 02

    Traverse the graph.

    Local search follows relationships outward from those nodes. Global search reads the community summaries for broad questions.

  3. 03

    Assemble the graph context.

    The retrieved subgraph is pruned and ranked so only the relevant facts remain.

  4. 04

    Answer.

    The generative model answers from the question plus the graph context. The path it used can be shown.

Building the graph

How the graph gets built: six stages.

The graph is the hard part of GraphRAG. Most of what makes one system answer well and another answer badly is decided here, before any question is asked.

  1. Design the schema: the entity types and relationship types to look for.
  2. Extract entities, relationships, and claims from every chunk.
  3. Resolve entities: merge duplicates and aliases into one node.
  4. Attach provenance: every node and edge points to the chunks it came from.
  5. Cluster the graph into hierarchical communities.
  6. Summarize each community, from the lowest level up.
  7. New and changed documents re-enter at extraction.
How a knowledge graph is built: the schema is designed, an LLM extracts entities, relationships, and claims, duplicates are merged, every fact is tied to its source, and the graph is clustered into communities that are summarized from the bottom up.

Stages 01 to 03

Find the facts

  1. 01

    Design the schema.

    Decide which kinds of things matter (supplier, product, contract) and which links between them (supplies, covers, replaces). A narrow schema gives a cleaner graph than "extract everything".

  2. 02

    Extract.

    An LLM reads each chunk with the schema and a few worked examples. It returns entities (name, type, description), relationships (from, to, description, strength), and claims: dated facts about an entity. A second pass asks what it missed.

  3. 03

    Resolve entities.

    The same supplier appears under five spellings. Exact and normalized matching merges the easy ones, embedding similarity proposes the rest, and an LLM decides the close calls. Descriptions from many chunks are merged into one.

Stages 04 to 06

Make it usable

  1. 04

    Attach provenance.

    Every node and edge keeps a pointer to the chunks it came from. That is what makes citations possible, and what lets a fact be removed when its source document is.

  2. 05

    Cluster.

    A community detection algorithm (Leiden) groups densely linked entities, at several levels: a few broad communities at the top, many narrow ones underneath.

  3. 06

    Summarize.

    An LLM writes a report for each community at the lowest level. Higher levels are summarized from the reports below them. These reports answer the whole-picture questions.

What extraction produces

Input · one chunk

Supplier A delivers the K-200 valve under contract C-114. Contract C-114 expires in March and is replaced by contract C-131.

The model is told which entity types and relationships to look for, and returns them as structured records, not prose.

Example text, written for illustration.

Output · nodes, edges, a claim

Supplier AsuppliesK-200 valve

Supplier Aparty toContract C-114

Contract C-114coversK-200 valve

Contract C-131replacesContract C-114

Contract C-114claimexpires in March

Four entities, four relationships, one claim, each tied to this chunk. The next chunk that mentions "the K-200" adds to the same node.

Five strategies for building the graph

StrategyHow it worksGood atWeak atCost
Open extractionAn LLM decides for itself what the entities and relationships areA fast start; finding what nobody thought to ask forInconsistent types, more duplicates, more noiseHigh
Schema-guided extractionAn LLM extracts only the agreed entity and relationship typesA clean, consistent graph that can be queried preciselyMisses what the schema did not foresee; needs design up frontHigh
Statistical extractionNo LLM: noun phrases become nodes, and phrases that appear together become edgesVery large document sets on a small budgetEdges say "mentioned together", not how things relateLow
From structured dataRecords in your databases are mapped straight to nodes and edgesExact facts, nothing inventedCovers only what your systems already recordLow
HybridA backbone from structured data, with entities extracted from documents attached to itTying what documents say to the records you trustMore moving parts to keep in stepMedium to high

granularity

How much to extract

Too little and the graph cannot connect anything. Too much and real links drown in noise. Start with the entity types your questions actually mention.

updates

Keeping it current

Only new and changed documents are re-extracted. Provenance removes facts whose source is gone. Communities and their summaries are refreshed on a schedule.

quality

Checking the graph

Sample edges and check them against the source text. Track the duplicate rate. Run multi-step questions with known answers.

storage

Where it lives

A graph database, queried with a graph language such as Cypher, Gremlin, or SPARQL. Many systems keep vector embeddings beside it for hybrid search.

Two ways to search

Specific questions and whole-picture questions.

A graph answers two kinds of question that passage search handles badly.

local search

Follow the connections

"Which contracts cover the supplier behind these late orders?" The answer is three hops away: order, supplier, contract. Local search walks them.

global search

Read the whole picture

"What are the main themes in this year's complaints?" No single passage holds that. Global search combines the community summaries.

hybrid

Graph plus passages

Many systems keep the vector index too. The graph finds what is connected, and passage search supplies the exact wording.

explainability

An answer you can trace

Because retrieval follows named relationships, the system can show which entities and links led to an answer.

The query side, part by part

PartWhat it doesHow
Query processorFinds the entities and relationships named in the question and maps them to nodes and edgesNamed-entity recognition and relation extraction, then a graph query in Cypher, Gremlin, or SPARQL
RetrieverCollects the relevant part of the graphGraph traversal (breadth-first or depth-first), embedding search, and limits on how far from the starting nodes it may go
OrganizerCleans up what was retrievedPrunes irrelevant nodes, reranks the rest, and adds missing context
GeneratorWrites the answerAn LLM, given the question and the organized graph context

Limits

Where GraphRAG goes wrong.

A graph adds reasoning power and adds ways to fail. These are the ones to plan for.

multi-hop

Errors add up

Each hop along the graph is a chance to take a wrong turn. A wrong edge early on carries through every step after it.

scale

Bigger is noisier

A very large graph is harder to store and query, and extra nodes can bury the links that matter. Pruning is part of the design.

privacy

Connections reveal things

Two harmless facts joined by an edge can expose something sensitive. Access rules have to cover the links, not only the documents.

evaluation

Passage scores do not fit

Counting whether the right chunk was retrieved says little about a graph. Test with multi-step questions and check each answer against its sources.

Published results

What the research found.

GraphRAG was introduced in a 2024 paper from Microsoft, tested on whole-picture questions over two document sets of about a million tokens each.

72 to 83%

of comparisons where GraphRAG's answer was judged more comprehensive than vector RAG's

62 to 82%

of comparisons where it was judged to cover more diverse points

over 97%

fewer tokens per question when answering from top-level community summaries instead of the source text

Source: Microsoft, "From Local to Global: A Graph RAG Approach to Query-Focused Summarization" (2024, revised 2025). Podcast transcripts and news articles, about one million tokens each. Answers to whole-corpus questions were compared head to head by an LLM judge. Published figures, not Colidal measurements.

Fit

When GraphRAG fits, and when it doesn't.

Use it when

  • Answers depend on how things connect: who supplies what, which policy covers which product.
  • People ask whole-picture questions across hundreds of documents.
  • The same entities appear again and again under slightly different names.
  • You need to show why an answer is what it is, step by step.

Skip it when

  • Questions are simple lookups. RAG is cheaper and faster for those.
  • The documents change hourly. The graph has to be rebuilt or updated to stay true.
  • The document set is small. An LLM reading every chunk to build a graph will not pay back.
  • Nobody can say which entities matter. The graph is only as good as what it is told to look for.

Compare

RAG, GraphRAG, or agentic RAG?

They are not rivals. Most systems start with RAG, and add a graph or an agent only where the questions need one.

RAGGraphRAGAgentic RAG
What it retrievesPassages that match the questionConnected facts, and summaries of whole topicsWhatever the agent decides the task needs
A question it suitsWhat does the returns policy say about opened items?Which suppliers are linked to the late orders this year?Compare this month's returns with the policy and draft a reply.
Built before any questionChunks, embeddings, a keyword indexAll of that, plus a knowledge graph and community summariesNothing new: it uses the other indexes as tools
Cost to set upLowestHighest: an LLM reads every chunkMedium: tools, checks, and tests
Cost per answerLowest: one search, one model callLow for specific questions, higher for broad onesHighest: several model calls per task
How it shows its workThe passage and page it usedThe path it followed through the graphEvery step, tool call, and source
Start here whenThe answer is written down in one placeThe answer is spread across many connected documentsThe answer takes several steps or several systems

How Colidal builds it

A knowledge graph of your business, kept current.

Colidal builds GraphRAG on top of its RAG engine, for the questions passage search cannot answer. The graph is designed around the entities your business runs on.

  • Designed with you. We agree which entities and relationships matter before anything is extracted.
  • Graph and passages together. The graph finds what is connected. The RAG engine supplies the wording and the page.
  • Kept current. New and changed documents update the graph, so answers do not go stale.
  • Tested on your questions. Multi-step questions with known answers are run before anyone relies on it.
  • In your cloud account. The graph is built from your documents and stays where you control it.

Used in: Your data · Your documents · colidal/rag

FAQ

Common questions.

What is GraphRAG, in one sentence?

GraphRAG is retrieval-augmented generation that stores your documents as a graph of entities and relationships, so an AI model can answer from connected facts.

What is a knowledge graph?

A knowledge graph is a set of things (a supplier, a product, a contract) and the named links between them (supplies, covers, replaced by). It is a map of what your documents say.

Does GraphRAG replace ordinary RAG?

No. It costs more to build, so it is added where questions depend on connections. Most systems run both and pick per question.

Why does GraphRAG cost more to set up?

An LLM has to read every chunk to extract entities and relationships, then summarize each community. Ordinary RAG only has to encode the chunks.

Keep reading

More from Colidal Research.

All research →

Next step

Request a 30-minute call.

Tell us what you need. We reply within one business day with times for a call, and you'll get a short agenda before we talk.

  1. 01

    Request a call

    Thirty minutes, by video. No preparation needed.

  2. 02

    Get times and a short agenda

    Within one business day, so the call is spent on your problem.

  3. 03

    Leave with a next step

    Usually Colidal AI Assessment, or an honest "AI isn't the answer here".