GraphRAG builds a graph of entities and relations from your corpus, then retrieves connected subgraphs and their linked text to answer questions that span multiple documents.

Entity extraction and graph traversal

GraphRAG / Knowledge Graphs for RetrievalDiagram with these labels, in reading order: Extract Entities; & Relationships; Build Knowledge; Graph; Query for; Matched Entities; Traverse Edges; to Gather Facts; Return; Structured Neighborhood.Extract Entities& RelationshipsBuild KnowledgeGraphQuery forMatched EntitiesTraverse Edgesto Gather FactsReturnStructured Neighborhood
GraphRAG Retrieval Process
  1. An extraction pass, using an LLM, identifies entities and relationships in the corpus. In Microsoft's version, a clustering step then groups related entities into communities and the LLM writes a summary of each.
  2. Entities become nodes and relationships become edges, which builds the knowledge graph.
  3. A query is matched to entities in the graph.
  4. The system traverses edges from those entities to gather related facts, forming a connected subgraph.
  5. That neighborhood, with supporting passages, goes to a generator model that writes the answer.

Microsoft's GraphRAG adds pre-summarized clusters of related entities, which helps with global questions that need broad context. Because the graph carries community summaries and relationships, the generator receives context that connects the facts, grounded in the corpus instead of the model's training alone.

Multi-hop questions that vector RAG cannot answer

Plain vector RAG retrieves chunks independently by semantic similarity. That works for simple lookups. It struggles with a question like "Which vendors did we onboard that also failed the security review, and who approved them?" The answer is spread over several documents and no single chunk holds it. Vector RAG treats chunks in isolation and cannot follow relationships between them.

A graph makes the relationships first-class, so the system can hop from vendors to their security reviews and approvals. A regulatory compliance question that draws on several documents is another fit. The traversal path also explains how the answer was derived.

The graph is a join inferred from prose

Building the graph resembles a foreign-key JOIN across normalized tables: entities are rows and edges are the relationships. The difference is the source. A database schema enforces integrity, while this graph is inferred from unstructured prose, so edges can be imperfect or incomplete. A query can therefore return unexpected results where the extraction missed or misread a link.

Extraction cost Graph extraction takes significant resources, and the graph must be maintained and updated. Check that the use case justifies it.

GraphRAG or vector RAG

  • Choose a knowledge graph when the domain has connected entities and multi-hop questions, such as compliance investigations or organizational knowledge.
  • Choose vector RAG for lookup-style Q and A where the answer sits in one place. It is cheaper and quicker to deploy.
  • Be wary of a graph when the underlying data changes often, because graph maintenance may outweigh the benefit.

Example scenario: graph retrieval accuracy falls from 85% to 65%

Suppose retrieval accuracy falls from 85% to 65%. The figures are illustrative. The usual cause is incomplete or wrongly linked entities: missing entities, or relationships that are poorly defined.

GraphRAG / Knowledge Graphs for RetrievalDiagram with these labels, in reading order: check for linking issues; check for relation gaps; fix linking model; fix relation extraction; ensure graph integrity; Low Retrieval Accuracy; Entity Linking Failures; Missing Relations in Graph; Update Entity Extraction; Model; Expand Relation Extraction; Rules; Verify Graph Structure.check for linking issuescheck for relation gapsfix linking modelfix relation extractionensure graph integrityensure graph integrityLow Retrieval AccuracyEntity Linking FailuresMissing Relations in GraphUpdate Entity ExtractionModelExpand Relation ExtractionRulesVerify Graph Structure
Debugging Graph Retrieval Issues
  • Check the graph for entity completeness.
  • Review the relationship definitions between entities.
  • Read query logs for common failure points.

Improve entity linking and extend coverage of the corpus. Graph updates will take longer. Monitor query accuracy and how often entities are updated.

Primary source. GraphRAG: Unlocking LLM discovery on narrative private data, Microsoft Research Blog, by Jonathan Larson and Steven Truitt, 13 February 2024.

Back to the knowledge baseRequest an assessment