Ask a flat RAG system, “What are the recurring themes across these 400 incident reports?” and it will cheerfully summarize the five chunks that happened to sit closest to the word themes. The answer reads fine. It is also wrong in the way that matters: it describes five paragraphs, not four hundred documents.
GraphRAG explained in one sentence: instead of retrieving isolated passages by similarity, you first have an LLM turn the corpus into a graph of entities and relationships, cluster that graph into communities, summarize each community, and then answer questions by reading those structures. Microsoft’s open-source GraphRAG project popularized the approach, and the accompanying paper, From Local to Global: A Graph RAG Approach to Query-Focused Summarization, is the primary source worth reading before you spend any money on it.
The question flat RAG cannot answer
Vector retrieval is a lookup mechanism. You embed a question, fetch the nearest chunks, and hope the answer lives inside them. That works beautifully for “what is the refund window for annual plans?” because one passage holds the fact. It breaks for questions whose answer is spread across the whole corpus: summarize, compare, trace, find patterns, who is connected to whom.
The failure has a specific shape. Top-k retrieval returns k chunks. If the honest answer needs evidence from 200 documents, no value of k you can afford will cover it, and the model will extrapolate from the sample it was handed. Researchers call these global or query-focused summarization questions, and they are the exact target of the Microsoft paper.
If you are still deciding whether retrieval is even the right tool, start with RAG vs fine-tuning vs agents. If you have already shipped basic retrieval and are hunting for the next upgrade, naive RAG vs advanced RAG lists cheaper moves that usually come first.
What GraphRAG actually builds
The indexing pipeline is the part people underestimate, so here it is stage by stage. The names follow Microsoft’s documentation; other implementations vary in detail.
- Split into text units. Documents are chunked, much like any other RAG pipeline.
- Extract entities and relationships. An LLM reads every text unit and emits things like (Pump A-12, installed_at, Plant Osaka) with a short description. This is the expensive step.
- Build the graph. Duplicate mentions are merged so “Osaka plant” and “Plant Osaka” become one node, with edges weighted by how often they co-occur.
- Detect communities. A clustering algorithm (Microsoft uses Leiden) groups densely connected nodes into hierarchical communities: small neighborhoods that roll up into larger themes.
- Write community reports. An LLM summarizes each community into a short report covering its key entities, claims and relationships.
- Embed what you will search. Text units, entity descriptions and reports get embeddings so retrieval can start from a query.
Notice what changed. A flat index stores raw passages. A graph index stores raw passages plus a machine-written map of the corpus. The map is where global answers come from, and also where new errors can enter, because every edge and every summary is a model’s interpretation.
Local search versus global search
GraphRAG ships two query modes, and confusing them is the most common mistake in first prototypes.
Local search: start at an entity
Local search resembles normal RAG with a graph assist. The system finds entities related to your question, pulls their neighbors, the relationships between them, the text units that mention them, and the relevant community reports, then hands that mixed context to the LLM. Use it for specific questions about a thing: “Which suppliers are linked to the Osaka recall?”
Global search: read the reports
Global search skips individual passages. It maps the question over community reports, asks the model to extract partial answers with relevance scores from each batch, then reduces those partials into one response. This is a map-reduce over summaries. It handles “what are the main risks across all of these audits?” because the reports already compress the corpus.
Global search is also slower and costlier per query than a vector lookup, since it can touch many reports. Route to it deliberately rather than as the default path. A cheap classifier or even a keyword rule (“summarize”, “across”, “themes”, “trends”) is a reasonable first router, and the idea fits naturally inside an agent harness that picks tools per request.
A worked example: 2,000 support tickets
Imagine a hardware company with 2,000 support tickets over two years. Three questions arrive from different teams.
| Question | Better fit | Why |
|---|---|---|
| What does error E-47 mean on the X2 controller? | Flat RAG or hybrid search | One passage holds the answer; exact token matters. |
| Which components are repeatedly mentioned together in tickets about overheating? | GraphRAG local search | The answer lives in relationships between entities. |
| What are the top failure themes this year, and how did they shift after the firmware update? | GraphRAG global search | Needs a corpus-wide view, ideally by time slice. |
The first question is why you should not rip out your existing retrieval. For identifier-heavy lookups, hybrid search for RAG is cheaper and often better. GraphRAG earns its keep on the second and third rows, where a human analyst would otherwise spend a week building a pivot table of tags that nobody trusts.
What it costs you
Be honest about the bill before a stakeholder falls in love with the demo.
- Indexing compute. Entity extraction calls an LLM for every chunk, and community reports add more calls. Microsoft’s own documentation warns that indexing can be expensive and recommends starting with a small sample. Do that.
- Rebuild pain. New documents can shift entity merging and community boundaries. Check how your chosen implementation handles incremental updates before promising freshness.
- Schema drift. Free-form extraction yields entity types you did not plan for. Decide whether to supply entity types up front or accept whatever emerges.
- Auditability. A community report is a summary of a summary. If someone challenges a claim, you need to trace it back to source text units, so store provenance IDs at every stage.
- Access control. A graph node can merge facts from documents with different permissions. A report built from restricted and public sources leaks by construction unless you partition before indexing.
Scorecard: do you need GraphRAG?
Score each line 0 (no) or 1 (yes) for your actual workload, not an imagined one.
- Do at least a fifth of real user questions ask for patterns, comparisons or summaries across many documents?
- Do the documents contain many named entities that recur across files (people, parts, accounts, genes, contracts)?
- Is the corpus stable enough that a full or periodic reindex is acceptable?
- Can you afford the indexing bill on a representative sample first, then the full set?
- Have you already tried better chunking, hybrid retrieval and reranking and still see global questions failing?
- Can you evaluate answers against a labeled set of global questions?
Zero to two: stay with flat retrieval. Three or four: prototype on a slice. Five or six: GraphRAG is a reasonable bet. The fifth question matters most, because teams reach for graphs when the real culprit is bad chunking. Fix the plumbing first.
Lighter alternatives to try first
Graph-shaped thinking does not always need a full pipeline.
- Metadata filters and tags. If tickets already carry product and component fields, a SQL group-by plus RAG on the top bucket answers many “theme” questions for pennies.
- Hierarchical summaries. Summarize each document, then summarize groups of summaries. It is a poor man’s community report with no entity extraction.
- Wider retrieval plus reranking. Pull 100 candidates and apply a reranker before stuffing context. This helps medium-breadth questions.
- A graph database for known relations. If your relationships are structured already (org charts, bill of materials), query them directly instead of asking an LLM to rediscover them from prose.
How to evaluate a graph pipeline
Standard retrieval metrics do not transfer cleanly. “Did the right chunk appear in the top five?” is meaningless for a global question with no single right chunk. Build a small set of 20 to 40 questions in three groups: specific lookups, entity-relationship questions, and corpus-wide questions. For each, write what a good answer must include as a checklist of facts.
Then grade answers on coverage (how many checklist facts appear), faithfulness (are claims supported by source text), and diversity (did it capture the minority themes or only the loud one). The Microsoft paper itself judges global answers on comprehensiveness and diversity with LLM-based comparison, which tells you what the authors consider the point. Tools such as those covered in our RAGAS evaluation guide give you faithfulness-style metrics, but verify a sample by hand because LLM graders are lenient with fluent text.
Failure modes seen in the wild
- Entity soup. Extraction over messy OCR text creates hundreds of near-duplicate nodes. Run a merge pass and inspect the top 50 entities manually before you trust anything downstream.
- Confident themes with no support. A community report can state a pattern that only two documents show. Always carry document counts alongside theme claims.
- Generic reports. If your corpus is homogeneous, communities summarize to platitudes (“customers report various issues”). Smaller communities or a more specific extraction prompt helps.
- Stale graph, fresh question. Users ask about last week; the index is a month old. Surface the build date in the answer.
- Using the wrong mode. Global search on a lookup question burns tokens and blurs the exact answer. Route first.
A sensible rollout
- Pick 200 to 500 representative documents and write 20 labeled questions, including at least eight global ones.
- Run your current retrieval and record the baseline. Do not skip this; it is the only way to know the graph helped.
- Index the sample with GraphRAG, inspect entities and three community reports by hand, and fix the extraction prompt.
- Compare answers, cost and latency per question type.
- If it wins on global questions, add a router so lookups still use the cheap path, and keep the older index as a fallback.
- Store provenance IDs, build date and mode used in your logs from day one.
For vector storage choices that sit underneath the embeddings in this pipeline, see vector databases for AI. If embeddings still feel hand-wavy, what embeddings are is the quick refresher, and prompt engineering matters here more than usual because the extraction and report prompts decide the quality of the entire graph.
Frequently asked questions
What is GraphRAG in simple terms?
It is a retrieval approach where an LLM first builds a knowledge graph of entities and relationships from your documents, groups it into communities with summaries, and then answers questions using that structure instead of only nearest-neighbor text chunks.
How is GraphRAG different from normal RAG?
Normal RAG retrieves a handful of similar passages. GraphRAG adds a pre-built map of the corpus, which lets it answer questions that require connecting facts across many documents, such as themes, trends and relationships.
Is GraphRAG better than vector search?
Not universally. Vector or hybrid search is cheaper and often better for single-fact lookups. GraphRAG tends to help on corpus-wide and relationship-heavy questions, so many teams run both and route by question type.
Why is GraphRAG indexing expensive?
Entity extraction calls an LLM for each text chunk, and community report generation adds more calls. Cost scales with corpus size, so test on a sample before indexing everything.
Do I need a graph database to use GraphRAG?
Not necessarily. Microsoft’s implementation stores the graph in files and tables and does not require a dedicated graph database, although you can export to one if you want graph queries or visualization.
How do I check whether GraphRAG answers are trustworthy?
Keep provenance from every report and relationship back to source text units, then test with a labeled question set that includes global questions. Grade coverage, faithfulness and diversity, and spot-check by hand.
AI Generated Apps AI Code Learning Technology
