GraphRAG Explained: Retrieval With Knowledge Graphs for Better Answers

GraphRAG adds a knowledge graph to retrieval, so it can answer questions that span a whole document set. Here is how the pipeline works and when to use it.

By Galactic News Editorial · Published 2026-11-20T19:39:24+00:00 · Updated 2026-11-20T19:39:24+00:00

GraphRAG explained: knowledge graph retrieval with entities, relationships, and community summaries

GraphRAG Explained: Retrieval With Knowledge Graphs for Better Answers

GraphRAG is retrieval-augmented generation that uses a knowledge graph as its source of context. Standard RAG retrieves text passages that look similar to a question. GraphRAG retrieves the connected facts behind the answer: entities, their relationships, and the structure that explains them. That difference matters most for questions that span a whole document set. This explainer covers how GraphRAG works, when it beats standard RAG, and how to build one.

GraphRAG Explained: The Problem With Standard RAG

Standard RAG splits documents into chunks, embeds them, and retrieves the chunks nearest to a question. That works for fact lookup. It fails for synthesis questions. Ask what the main themes are across a thousand reports, and no single chunk holds the answer. The answer is scattered across the corpus. Vector similarity cannot assemble it.

Microsoft Research introduced GraphRAG to close that gap. The idea is simple. Use a language model to extract a knowledge graph from the documents first. Then use the graph, not just the chunks, to answer questions. The graph stores entities and relationships. It also stores summaries of densely connected groups of entities, called communities. Those summaries let the system answer broad questions about the whole dataset.

How the GraphRAG Indexing Pipeline Works

GraphRAG builds its index in four stages. First, documents are split into text units, chunks of about 1,200 tokens by default. Second, a language model reads each chunk and extracts entities and relationships, with a short description for each. The same entity usually appears in many chunks. The pipeline merges duplicates by matching entity titles and relationship pairs. A summarization pass condenses the merged descriptions into one statement per node and edge.

Third, the pipeline detects communities. It applies the Hierarchical Leiden algorithm, a graph-clustering method, recursively until clusters fall under a size limit. The result is a hierarchy of communities, from high-level themes down to fine-grained topics. Fourth, a language model writes a summary report for every community at every level. These reports describe the community's key entities, relationships, and claims. A final embedding pass vectorizes entity descriptions, text units, and community reports. The whole structure becomes the queryable index.

Indexing is the expensive part. Every chunk calls the language model for extraction. Every community calls it again for a summary. Costs scale with corpus size and with the model provider configured, whether Azure OpenAI, OpenAI, or another endpoint. GraphRAG is open source under the MIT license. It is a pipeline, not a hosted product. There is no GraphRAG pricing page. Cost is a function of the model calls it makes.

Local Search vs Global Search

GraphRAG answers questions in two modes. Local search handles entity-focused questions. It embeds the question, retrieves the most relevant entities, and expands to connected chunks, relationships, and community descriptions. The ranked context goes to the language model with prompts that discourage speculation. Local search is the right mode for questions such as who did what, or what connects two companies.

Global search handles broad, thematic questions. It uses a map-reduce pattern. Community reports are grouped up to the context window size. The question is mapped across each group to produce community answers. Those answers are then reduced into one final answer. Because the community summaries already cover the whole corpus, global search can answer questions that no single chunk could support.

Microsoft's evaluation compared GraphRAG against naive RAG and hierarchical summarization on podcast transcripts and news articles. Community summaries outperformed naive RAG on comprehensiveness and diversity, with a win rate around 70 to 80 percent. The gap was largest on global questions. On narrow fact lookup, standard RAG stays competitive and much cheaper.

FeatureStandard RAGGraphRAG
Retrieval unitText chunks by vector similarityEntities, relationships, community summaries
Best question typeFact lookupSynthesis across a corpus
Indexing costEmbeddings onlyLLM extraction plus community summaries
TraceabilityChunk citationsGraph paths and community reports
Failure modeMisses scattered answersExtraction errors corrupt the graph

Building a GraphRAG Pipeline

Two paths exist. The first is Microsoft's GraphRAG package on GitHub, under microsoft/graphrag. It implements the full pipeline: extraction, community detection, summarization, and both search modes. The second is the Neo4j GraphRAG Python package. It builds a knowledge graph from unstructured documents and supports retrieval patterns that combine vector search, full-text search, and graph traversal. Neo4j's SimpleKGPipeline builds the graph in a few lines of code. Its GraphRAG class pairs a retriever with a language model. It supports OpenAI, Azure OpenAI, Vertex AI, Anthropic, Mistral, Cohere, and local models through Ollama.

A practical build follows five steps.

  1. Pick a corpus with real structure. Research papers, support tickets, contracts, or news archives work well. Random web pages do not.
  2. Choose the extraction model and entity types. Define the entity types that matter for the domain, such as Person, Company, or Product.
  3. Index a small sample first. Check the extracted entities by hand. Fix prompt issues before indexing the full corpus.
  4. Wire both search modes. Route narrow questions to local search and broad questions to global search.
  5. Monitor quality. Extraction errors propagate into the graph and degrade answers silently. Sample answers regularly and trace them back to the graph.

Bottom line

GraphRAG adds structure to retrieval. Standard RAG finds passages that resemble a question. GraphRAG finds the connected facts that answer it, and it can synthesize across a whole corpus. The price is indexing cost, a second system to operate, and new failure modes when extraction goes wrong. Use it when the questions are broad and the corpus has real structure. For simple fact lookup, standard RAG is cheaper and just as good. Start small, verify the extracted graph by hand, and let the question type choose the search mode.