Building with AI

GraphRAG

4 min readintermediateUpdated 28 Sept 2026
1 · In one line

GraphRAG turns your documents into a map of people, places and links, groups and summarises it, then answers questions from that map.

1 · What it is

Plain RAG answers a question by finding the few passages that best match it. That works for “what does page 12 say”. It struggles when the answer is spread across hundreds of files. It also struggles when you ask about the whole pile at once, such as its main themes.

GraphRAG, from Microsoft Research, prepares the documents first. A language model (the kind of AI behind chatbots) reads them. It lists the entities, meaning people, places or organisations, and how they are linked. Together these form a knowledge graph: a map of dots joined by lines. The graph is then split into communities, which are groups of closely linked entities. Each community gets a short written summary.

Picture a journalist with a pile of podcast transcripts who asks which episodes deal mainly with tech policy. No single passage says that. So GraphRAG uses global search, which reads the summaries instead of the raw text. Each community summary gives a partial answer, and each point in it gets a score. The strongest points are then combined into one reply. A narrow question about one named thing works differently. Local search starts at that entity and follows its links.

For engineers: Microsoft’s paper builds the index in two stages, an entity graph and then community summaries. Communities come from the Leiden algorithm, a method that guarantees each community is connected. The evaluation used two corpora (document collections) of about one million tokens each. The code is a demo that Microsoft does not officially support.

2 · Why it exists

Plain RAG finds matching passages, which is not always enough.

Misses the big pictureQuestions about a whole collection, like its main themes, have no single passage that holds the answer.
Cannot join the dotsSome answers need facts spread across many documents and linked through shared names.
Search has no targetA question about overall themes gives the similarity search nothing specific to match.
3 · How it works

Build the map once, then ask a whole-collection question.

Indexing happens once. Global search then answers from the community summaries instead of from single passages.
  1. 1 · sliceThe documents are cut into small pieces called text units.
  2. 2 · extractA language model pulls out the entities, their relationships and key claims, which form a knowledge graph.
  3. 3 · groupThe graph is split into communities of closely linked entities, nested from broad to detailed.
  4. 4 · summariseA summary is written for each community, from the bottom level up.
  5. 5 · answerAt question time, those summaries and graph pieces are handed to the model as context.

GraphRAG reads the summaries, not just the closest passages.

4 · Where it's used
WhoWhat they askWhat it works with
Journalist“Which podcast episodes deal mainly with tech policy?”Community summaries built from the transcripts
Teacher“What health topics in the news could go into a lesson?”Summaries of a large news archive
Researcher“What are the main themes across these reports?”Top-level community summaries
Analyst“What do the documents say about this company and who it works with?”The company entity, its neighbours and linked text units
5 · What it solves, and what it doesn't
solves
  • It can answer questions about a whole collection, such as its main themes.
  • In tests on two collections of about a million tokens, its answers were more complete and varied than plain RAG.
  • Local search can answer about one entity by following its links to neighbours.
  • Text units give fine-grained references back to the original documents.
doesn't solve
  • Building the index can be expensive, so the project advises starting small.
  • Results out of the box may be weak; the makers recommend tuning the prompts.
  • It was tested on only two collections, so how well it works elsewhere is still open.
  • Microsoft's project is in maintenance mode and takes no new features.
6 · Go deeper

Sources used

This explainer is written in original language. The links below support its factual claims.

  1. paperFrom Local to Global: A Graph RAG Approach to Query-Focused Summarization, Edge et al., Microsoft Research · read 28 Sept 2026
  2. docsWelcome to GraphRAG, Microsoft · read 28 Sept 2026
  3. docsGlobal Search, Microsoft · read 28 Sept 2026
  4. docsLocal Search, Microsoft · read 28 Sept 2026
  5. repomicrosoft/graphrag, Microsoft on GitHub · read 28 Sept 2026
  6. paperFrom Louvain to Leiden: guaranteeing well-connected communities, Traag, Waltman and van Eck · read 28 Sept 2026