# What Is GraphRAG?

> How GraphRAG builds a knowledge graph and community summaries, when it beats plain RAG, and what it costs, explained simply for your AI interview.

**In short:** GraphRAG is a form of RAG where an AI model first builds a knowledge graph of the people, places and things in your documents, then writes summaries of groups within it. It handles big-picture questions over a whole collection, at a higher cost to build.

AI and LLM interview question Q136, Retrieval-augmented generation (RAG). Advanced, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-graphrag

## Say it in 30 seconds

GraphRAG is retrieval-augmented generation with an extra build step. An AI model reads my documents once and builds a knowledge graph of the entities and how they link, then writes a summary for each group of linked entities. For a plain lookup, I'd use ordinary RAG. For a question about the whole collection, like the main complaint themes across 40,000 claim notes, GraphRAG answers from the summaries. The cost is the build, and the graph has to be updated when documents change.

## Say it in 2 minutes

Plain RAG finds passages that match a question and hands them to a model. That works when the answer sits in one place. It struggles when someone asks about the whole collection, such as the main themes across thousands of files, because no single passage holds that picture. In 2024, Microsoft Research created GraphRAG to fix this.

GraphRAG adds a build step. The model reads the documents and lists the entities, like people, companies and products, along with the links between them. Those links form a knowledge graph. The graph is split into communities of closely linked entities, and the model writes a summary for each one, working up from small groups to larger ones.

At question time, the model reads each summary, writes a partial answer from it, and merges the partial answers into one reply. In Microsoft's tests on two corpora of about a million tokens each (a token is a small piece of text), this beat plain RAG on how complete the answers were, and on variety more clearly on the paper's Podcast set than on its News set. Those tests cover a narrow set of questions, so I would test on our own data before trusting the gain.

The trade-off is cost and upkeep. Building the graph takes many model calls, and changed documents mean updating the graph and its summaries. So I would start with plain RAG, measure it on real questions, and add GraphRAG only for the big-picture questions that fail.

## What is GraphRAG, in plain words?

RAG, short for retrieval-augmented generation, means searching your documents for passages that match a question, then giving those passages to an AI model to write the answer. Plain RAG does exactly that.

GraphRAG adds a step first. An AI model reads the documents and builds a knowledge graph: a map of the entities in them, such as people, companies and products, and the links between them. It then writes a short summary for each group of closely linked entities. When a big question comes in, the answer is built from those summaries.

Think of a quality manager at a hospital group who has read every complaint letter this year. She keeps a summary for each ward. Asked for the recurring problems across the group, she reads the ward summaries first, then the few letters that mention delay. The AI version: a claims team with 40,000 notes asks which complaints keep coming back across every region.

- **Entity:** A thing the map tracks, such as a hospital, a drug or a policy.
- **Relationship:** How two entities connect, such as one hospital supplying another.
- **Knowledge graph:** Entities as dots, with relationships as lines between them.
- **Community:** A group of entities that link to each other closely.
- **Community summary:** A short written overview of one community, written once by the model.

## Why does plain RAG struggle with some questions?

Plain RAG is good at finding the passage that answers a narrow question. It is weak when the answer needs pieces scattered across many files, or a view of the whole collection.

- **Narrow question: One fact, one place.** Who approved the refund on claim 1182? A matching passage holds the answer, so plain RAG does well.
- **Whole-collection question: The picture across files.** What complaint themes keep coming back across all 40,000 notes? No single passage holds that, so plain RAG grabs a few matches and misses the pattern.

> "Baseline RAG struggles to connect the dots." (Microsoft Research, February 2024)
>
> "RAG fails on global questions directed at an entire text corpus" (Edge and colleagues, 2024 paper)

## How does GraphRAG build its index?

The index is the saved graph and summaries that answers are built from. It is built before questions are asked, and updated when documents change.

1. **Read and extract:** The model reads each document in chunks (short pieces of text, cut to a set length) and lists the entities and the links between them.
2. **Build the graph:** The lists join into one knowledge graph. The graph is then split into communities of closely linked entities.
3. **Summarise each community:** The model writes a summary for each community, working up from small groups to bigger ones that cover them.
4. **Answer big questions:** For a whole-collection question, the model uses each summary to write a partial answer, then merges them into one reply.

*Diagram, How GraphRAG builds its index: The model reads the documents and builds a graph of entities and links. Linked entities form communities, and each one gets a summary. For a big question, the summaries feed partial answers that are merged into one reply.*
1. The model reads your documents in chunks.
2. It lists the entities and the links between them.
3. Linked entities form groups, and each group gets a summary.
4. Each summary feeds a partial answer at question time.
5. The partial answers are merged into one reply.

Worked example (made-up numbers): an insurer holds 40,000 claim notes. Plain RAG answers a question about one claim quickly. For the complaint themes across all the notes, the build pass reads everything, so question time runs over the summaries, which are far fewer than the 40,000 notes. The paper's own build is a real case: its Podcast dataset, one of two test corpora of about 1 million tokens each (a token is a small piece of text), became a graph of 8,564 nodes and 20,691 edges.

## What does GraphRAG cost, and when is it worth it?

The build is the big cost. Every chunk goes through the model, so indexing means many model calls before the first question is answered. The paper notes that longer chunks need fewer calls for that step, which lowers the cost, but the model misses more details that sit near the start of a chunk.

Upkeep is the second cost. When documents change, the graph and its summaries have to be updated, or answers drift out of date.

The evidence is narrow. The paper's tests cover two corpora of about 1 million tokens each, on big-picture questions. A gain there may not hold for your data.

- **Use GraphRAG when:** Questions span a whole collection, and people ask them often enough to pay for the build.
- **Use plain RAG when:** The answer sits in one passage, or the documents change so often that rebuilding is costly.
- **Measure first:** Test both on real questions from your users before you pay for a graph.

> **Tip:** Asked about cost? Name the build pass and the upkeep, and say when each one happens.

### How would you decide between GraphRAG and plain RAG?

1. **Look at the questions:** Collect real questions from users and sort them: single facts in one place, or whole-collection themes.
2. **Price the build:** Estimate the model calls to build the graph, and how often the documents change.
3. **Test both:** Run the same questions through plain RAG and GraphRAG, and have real reviewers score completeness and accuracy.
4. **Ship the smaller one:** Start with plain RAG. Add a graph only for the question types that plain RAG fails on.

*Diagram, Which tool fits which question: Two kinds of question, two tools. Plain RAG is quick for a fact in one place. GraphRAG is for questions about the whole collection, at a higher build cost.*
1. A single fact goes to plain RAG, which finds the matching passage.
2. A whole-collection question goes to GraphRAG, which reads the summaries.
3. Plain RAG gives a quick answer from one passage.
4. GraphRAG gives a picture built from every summary.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: a graph of entities and links, plus summaries of groups of them.
- [ ] The problem it fixes: plain RAG misses questions about a whole collection.
- [ ] How it is built: the model extracts entities, groups them, and summarises each group.
- [ ] The cost: many model calls to build, and updates when documents change.
- [ ] When not to use it: simple lookups, where plain RAG is enough.
- [ ] Honest evidence: the 2024 results come from specific test sets.

**Common traps**

- Trap: "GraphRAG is always better than RAG." Better: It wins on big-picture questions in the tests. For a single fact, plain RAG is cheaper and simpler.
- Trap: "It's just a graph database." Better: An AI model builds the graph from text. The community summaries are what answer the big questions.
- Trap: "Build it once and forget it." Better: Documents change. The graph and summaries need updating, which costs time and model calls.

## Can you pick the right tool?

**Spot the mismatch:** A claims help desk of 12 people uses a bot that answers one-policy lookups all day. Which plan is the weakest?

A. Plain RAG over the policy documents, filtered by policy number, with each answer citing its source.
B. GraphRAG over all 40,000 claim notes, rebuilt every night, to answer one-policy lookups.
C. Plain RAG with a chunk size tested on the 50 most common lookups.
D. Plain RAG plus a check that every answer quotes the policy clause it used.

**Answer:** B. One-policy lookups are narrow questions, where plain RAG is fast and cheap. Rebuilding a graph of 40,000 notes every night adds model calls and upkeep for no gain.

**Quick check:** Which question suits GraphRAG best?

A. What is the refund window on policy P-2291?
B. What are the main complaint themes across all 40,000 claim notes?
C. Which phone number does a customer call to report a claim?
D. Who signed the 2019 renewal form for policy P-2291?

**Answer:** B. It is a big-picture question over a whole collection, the kind plain RAG misses. The other three each have one answer in one place.

## Can you answer these from memory?

**Flash cards**

- **What is GraphRAG?** RAG that first builds a knowledge graph and community summaries from documents.
- **What problem does it solve?** Big-picture questions over a whole collection, which plain RAG misses.
- **What is a community summary?** A short model-written overview of a group of linked entities.
- **What is the cost?** Many model calls to build the graph, and updates when documents change.
- **Plain RAG or GraphRAG for one fact?** Plain RAG. It is simpler and cheaper for single lookups.
- **Where is the proof?** Microsoft's 2024 tests on two corpora of about 1 million tokens each.

## Likely follow-up questions

- Q137 What is agentic RAG? https://designervenkat.online/interview/ai/what-is-agentic-rag
- Q138 RAG vs long context: which to use? https://designervenkat.online/interview/ai/rag-vs-long-context
- Q139 How do you keep the index fresh? https://designervenkat.online/interview/ai/how-do-you-keep-the-index-fresh
- Q141 What is contextual retrieval? (full answer coming)
- Q133 What are common RAG failure modes? https://designervenkat.online/interview/ai/common-rag-failure-modes

## Learn it in depth

- [Retrieval-augmented generation](https://designervenkat.online/learn/ai-engineering/rags)
- [Where RAG fits, and where not](https://designervenkat.online/learn/ai-engineering/rag-usecases)
