Introduction
Large language models (LLMs) cannot update their knowledge without costly retraining or fine-tuning, and their context window limits how much text they can read at once.
Retrieval-augmented generation (RAG; Lewis et al., 2020) was introduced to feed models with relevant context. This technique retrieves from a text corpus the chunks of text that most resemble the query, so that the model can use them to answer.
Because they retrieve only the chunks most similar to the query, RAG systems struggle to answer questions that need several pieces of information, called multi-hop questions, or questions about information distributed across the whole corpus, called global questions. Global questions like who the main character in a novel is or what topics are covered in a podcast are the target of query-focused summarization (QFS).
In 2024, researchers at Microsoft published a paper (Edge et al., 2024a) proposing GraphRAG, a QFS technique that builds a graph-based index and scales to large corpora: it links entities in the corpus through their relationships, groups them into communities, and generates a summary for each community. These pre-generated community summaries allow the system to answer global questions. Several variants of GraphRAG have since appeared, each addressing one or more of its limitations.
This article walks you through how GraphRAG works, its variants, and the limitations they address.
How GraphRAG works
Building the index
Let's say a friend of yours has just read the latest detective novel by your favorite writer. She tells you that the main character, Tom Hale, sets out to find who poisoned his friend Anna at his own birthday party.
You start reading the novel and don't want to miss a thing, so you write down how everything is connected:
- Tom Hale lived in Ohio and moved to New York last year.
- Tom is a friend of Anna Ruiz.
- Mr. Kessler is Tom's neighbor. He went to the birthday party and brought the cake, which was served there.
- The party was for Tom's birthday & took place at his new home.
- Anna went to the party and raised a glass of champagne.
- Cyanide was found in the glass.
- Anna was poisoned with cyanide, and Tom investigates her death.
All these notes relate characters to other characters, places, objects, and events. That is the kind of information a knowledge graph (KG) structures: related items become entities, the connections between them are relationships, and in the graph, entities are nodes and relationships are edges. In GraphRAG, an LLM takes notes like yours: it reads the chunks of text one at a time and writes down their entities and relationships, each with a short description. A relationship found in more than one passage becomes a single edge in the graph.
To draw the graph, you write down the entities and draw an arrow from source to target for each relationship; GraphRAG merges repeated mentions of an entity into a single node and summarizes their descriptions. The structure alone shows what matters in the story: in the figure below, six arrows arrive at and leave Tom's node, more than at any other character's, so even without your friend's summary you could tell he is the main character.
The next step is to group the entities into communities: sets of entities that are more connected to each other than to the rest of the graph. GraphRAG finds them with the Leiden algorithm (Traag et al., 2019), which looks for the split with the highest modularity, a score that rewards communities whose members share more relationships than would be expected by chance. Leiden is not deterministic, but it guarantees that no community falls apart into disconnected pieces. In our graph, Leiden found the following split:

In a larger graph, GraphRAG recursively applies Leiden to each community so that, by default, each one has no more than 10 entities.
In our graph, all three communities are already smaller than that, so the community hierarchy has only one level. Each of the three communities found by the algorithm tells part of the story through the relationships between its entities. So the next step is to gather the information in each community to write a summary of it. The LLM starts with the communities at the lowest level and works its way up. For each community, it combines the descriptions of the entities and relationships the LLM wrote during extraction to write a summary, rate the community's importance, and list its key findings. If the descriptions do not fit in the model's context window, GraphRAG adds them in order of prominence, starting with the relationships whose two entities have the most connections, so details about the least connected entities may be left out of the summary. At higher levels, a community contains sub-communities that already have their own summaries; if its descriptions do not fit, GraphRAG replaces the longest ones with the summaries of the corresponding sub-communities, which are shorter.
For our graph, the three summaries may look like this:

All of this happens before you ask the first question, and it takes many calls to the LLM: one or more per chunk to extract entities and relationships, more to summarize their descriptions, and one per community to write its summary. Reducing that cost is the goal of several of the variants below.
Answering questions
GraphRAG answers questions in two ways: for global questions it uses global search, and for specific questions, those about particular entities, it uses local search.
Once the index is built, you can ask GraphRAG 'What is the novel about?' and get a proper response, similar to the one your friend gave you after reading the novel. This question calls for global search.

Standard RAG returns a top-n list of chunks ranked from most to least relevant. For a global question, GraphRAG instead works on one level of the community hierarchy, in three steps (figure above): it prepares the community summaries, maps them to partial answers, and reduces those to a global answer.
The preparation consists of shuffling the community summaries of that level and packing them into batches. Next, the LLM writes a partial answer from each batch, together with a score from 0 to 100 for how helpful it is in answering the question; answers that score 0 are discarded. Finally, the partial answers are sorted by helpfulness and added to a final context until it is full; the LLM then writes the global answer from that context.
Let's see global search in our novel: the model reads the community summaries, which together cover the whole corpus.
What is the novel about? Tom Hale moved from Ohio to New York last year and held a birthday party at his new home, where Mr Kessler brought the cake. Anna Ruiz was poisoned with cyanide, most likely from the champagne glass she raised.
Local search generates answers using the relevant entities, relationships, community summaries, and chunks as context (Microsoft, n.d.).
Now let's try local search on our novel:
Where was Anna poisoned? At Tom's birthday party, held at his new home, most likely in New York: the cyanide was in the champagne served there.
Evidence: p. 113: 'Traces of cyanide were found in Anna's champagne glass.'; p. 85: 'The champagne was served in tall glasses as the guests arrived.'; p. 85: 'The party was held at his new home.'; p. 12: 'Tom had left Ohio for New York the year before.'
GraphRAG limitations and variants
GraphRAG variants replace parts of the pipeline, others adapt it to a specific domain, and most address one or more known limitations of the original design.
Limitations
Indexing cost: Building the graph and the community summaries takes many LLM calls before the first question is asked: indexing a single novel of about 56,000 tokens used some 655,000 tokens with GraphRAG (Xiang et al., 2025).
Query cost: Global search sends whole community summaries to the LLM, which makes each answer expensive, slow, and noisy. Microsoft developed dynamic community selection, which keeps the same index but lets the LLM rate summaries from the top of the hierarchy down and discard irrelevant branches before the map-reduce step. On 50 global questions over a dataset of AP News articles, it cost 77% less on average than static global search at community level 1, with no significant loss in quality (Li et al., 2024).
Specific questions: The GraphRAG design targets global questions; on specific questions, standard RAG matches or beats it. On fact retrieval over novels, GraphRAG local search scores 49.3% against 58.8% for standard RAG and 60.9% for RAG with reranking (Xiang et al., 2025).
Changing corpora: The original design rebuilds the index when documents are added. The GraphRAG library now offers an incremental update (Evans et al., 2024) that merges new content into the existing index, but new content can change the community structure enough that much of the index has to be recomputed.
No notion of time: A fact that stopped being true stays in the graph next to the one that replaced it, and nothing tells the model which of the two is current.
Domain dependence: The default schema and prompts are generic, and descriptions are written by the LLM rather than tied to authoritative sources. Accuracy varies with the domain: Xiang et al. (2025) built their medical corpus from guidelines with explicit hierarchies; on that corpus, some graph methods beat RAG with reranking on complex reasoning while default GraphRAG fell behind on every task.
Variants
The first variant is made by the same team, LazyGraphRAG is Microsoft's own answer to the indexing and query costs (Edge et al., 2024b) by an LLM creates entities and relationships, it extracts noun phrases and their co-occurrences with standard NLP tools, and builds the community hierarchy from graph statistics. All LLM use is deferred to query time, when an LLM tests the relevance of the text chunks of the communities that best match the question and stops when no relevant communities remain. Indexing costs the same as standard RAG's and 0.1% of GraphRAG's.
The relevance test budget caps how many of those tests the LLM can run per question, and so trades off cost against quality. On 5,590 AP News articles, with answers judged by an LLM, Microsoft reports that LazyGraphRAG beats competing methods on specific questions at a query cost similar to that of standard RAG, and that the same configuration matches GraphRAG global search on global questions at more than 700 times lower query cost.
LightRAG (Guo et al., 2024) tackles the query cost and changing corpora. It keeps the LLM extraction of entities and relationships but drops communities and their summaries. At query time, the LLM gathers two sets of keywords from the question: low-level keywords, matched against entities to answer specific questions, and high-level keywords, matched against relationships to cover broader themes. Its authors report that retrieval takes fewer than 100 tokens and a single API call, whereas GraphRAG global search read 610 community summaries of about 1,000 tokens each in their experiment. With no communities to recompute, new documents go through the same extraction, and their entities and relationships are merged into the existing graph. The trade-off shows on summary questions over novels, where LightRAG trails GraphRAG local search (48.9% vs 64.4%), although it leads on medical guidelines (63.1% vs 41.9%; Xiang et al., 2025).
HippoRAG 2 (Gutiérrez et al., 2025) reduces indexing and query costs, can handle changing corpora, and does well on specific and multi-hop questions. It avoids community summaries altogether. Indexing the same novel of about 56,000 tokens used some 330,000 tokens, half of GraphRAG's 655,000 (Xiang et al., 2025). It builds a KG from triples extracted from the text: subjects and objects become nodes, joined by relation edges, and each source passage is also a node, linked to the entities it contains. At query time, the question is embedded and matched against the triples; an LLM filters the best matches. Their entities, together with every passage weighted by its similarity to the question, seed a Personalized PageRank walk that ranks the passages. The top five go to the LLM that writes the answer. As a result, HippoRAG 2 sends about 1,000 tokens per question, against 38,707 for GraphRAG local search and 331,375 for global search, and still comes within 0.3 percentage points of GraphRAG local search on summary questions over novels (64.1% vs 64.4% accuracy; Xiang et al., 2025). On novels, HippoRAG 2 reaches 60.1% on fact retrieval, close to RAG with reranking, and 53.4% on complex reasoning, ahead of both GraphRAG local search 50.9% and RAG with reranking 42.9% (Xiang et al., 2025). Its authors present it as a form of continual learning: new passages are added to the graph as nodes, with no community summaries to rewrite.
Graphiti, the engine behind Zep, addresses the missing notion of time. It is built for agent memory, where the corpus is a conversation that keeps growing and facts change over time (Rasmussen et al., 2025). It stores when each fact was true and when it was recorded. When a new fact contradicts an older one, the older edge is marked invalid from the date the new fact became true, so the graph keeps the history and still answers with the current state.
New data arrives in units called episodes, such as chat messages, and each one is merged into the graph as it comes in. For communities, Graphiti uses label propagation instead of Leiden, because a new node can simply join the community of most of its neighbours; since the communities drift from what a full run would find, they are refreshed from time to time. On agent-memory benchmarks, Zep scores 94.8% on Deep Memory Retrieval, against 93.4% for MemGPT (Rasmussen et al., 2025).
MedGraphRAG addresses domain dependence with a well-documented adaptation to medicine (Wu et al., 2025). Its Triple Graph has three tiers: the user's documents (patient records, for example), medical papers and textbooks, and the Unified Medical Language System. Each entity is linked to a source and a standard definition. Its retrieval method, U-Retrieval, replaces Leiden communities with a hierarchy of tag summaries (symptoms, medication, patient history): it searches top-down to find the relevant subgraph, and then refines the answer bottom-up, layer by layer. With GPT-4 it reaches 91.3% on MedQA against 88.9% for GraphRAG and 88.1% for standard RAG.
Conclusion
GraphRAG gives LLMs the context they need to answer questions about large and complex corpora by mapping the relationships between entities. Its variants cut costs by dropping parts of the pipeline, track facts that change over time, or tie the graph to a field's sources.
GraphRAG does not replace standard RAG; it works better for global and multi-hop questions. In medicine, where guidelines and vocabularies such as UMLS give concepts a well-defined hierarchy, graph methods can beat standard RAG once the generic pipeline is adapted to the field. Other technical domains with formal vocabularies may benefit for the same reason.
References
Edge, D., Trinh, H., Cheng, N., Bradley, J., Chao, A., Mody, A., Truitt, S., Metropolitansky, D., Ness, R. O., and Larson, J. (2024a), 'From Local to Global: A Graph RAG Approach to Query-Focused Summarization', arXiv preprint arXiv:2404.16130, https://arxiv.org/abs/2404.16130.
Edge, D., Trinh, H., and Larson, J. (2024b), 'LazyGraphRAG: Setting a New Standard for Quality and Cost', Microsoft Research Blog, 25 November, https://www.microsoft.com/en-us/research/blog/lazygraphrag/.
Evans, N., Guevara Fernández, A., and Bradley, J. (2024), 'Moving to GraphRAG 1.0 – Streamlining Ergonomics for Developers and Users', Microsoft Research Blog, 16 December, https://www.microsoft.com/en-us/research/blog/moving-to-graphrag-1-0-streamlining-ergonomics-for-developers-and-users/.
Guo, Z., Xia, L., Yu, Y., Ao, T., and Huang, C. (2024), 'LightRAG: Simple and Fast Retrieval-Augmented Generation', arXiv preprint arXiv:2410.05779, https://arxiv.org/abs/2410.05779.
Gutiérrez, B. J., Shu, Y., Qi, W., Zhou, S., and Su, Y. (2025), 'From RAG to Memory: Non-Parametric Continual Learning for Large Language Models', ICML 2025, arXiv preprint arXiv:2502.14802, https://arxiv.org/abs/2502.14802.
Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W., Rocktäschel, T., Riedel, S., and Kiela, D. (2020), 'Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks', Advances in Neural Information Processing Systems 33 (NeurIPS 2020), 9459–74, https://arxiv.org/abs/2005.11401.
Li, B., Trinh, H., Edge, D., and Larson, J. (2024), 'GraphRAG: Improving Global Search via Dynamic Community Selection', Microsoft Research Blog, 15 November, https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/.
Microsoft (n.d.), 'Local Search', GraphRAG Documentation, https://microsoft.github.io/graphrag/query/local_search/.
Rasmussen, P., Paliychuk, P., Beauvais, T., Ryan, J., and Chalef, D. (2025), 'Zep: A Temporal Knowledge Graph Architecture for Agent Memory', arXiv preprint arXiv:2501.13956, https://arxiv.org/abs/2501.13956.
Traag, V. A., Waltman, L., and van Eck, N. J. (2019), 'From Louvain to Leiden: Guaranteeing Well-Connected Communities', Scientific Reports, 9, 5233, https://doi.org/10.1038/s41598-019-41695-z.
Wu, J., Zhu, J., Qi, Y., Chen, J., Xu, M., Menolascina, F., Jin, Y., and Grau, V. (2025), 'Medical Graph RAG: Evidence-Based Medical Large Language Model via Graph Retrieval-Augmented Generation', in Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 28443–67, https://aclanthology.org/2025.acl-long.1381.
Xiang, Z., Wu, C., Zhang, Q., Chen, S., Hong, Z., Huang, X., and Su, J. (2025), 'When to Use Graphs in RAG: A Comprehensive Analysis for Graph Retrieval-Augmented Generation', arXiv preprint arXiv:2506.05690, https://arxiv.org/abs/2506.05690.



.jpg)
