AI & ML

GraphRAG

An advanced RAG approach that uses knowledge graphs to capture entity relationships, enabling multi-hop reasoning over structured data.

GraphRAG extends traditional Retrieval-Augmented Generation by incorporating knowledge graphs into the retrieval pipeline. Instead of relying solely on vector similarity search, GraphRAG leverages entity relationships and graph traversal to find relevant information.

A knowledge graph represents information as nodes (entities) and edges (relationships). When a user asks a question, GraphRAG can traverse these relationships to perform multi-hop reasoning — connecting dots across multiple documents that a simple vector search might miss.

For example, if asked "What technologies does Company X use for their recommendation engine?", GraphRAG can follow relationships from Company X → Engineering Team → Projects → Tech Stack to surface a comprehensive answer.

GraphRAG is particularly valuable for enterprise use cases where data is highly interconnected: organizational knowledge, compliance documentation, and research corpora.

How it works

GraphRAG was introduced by Microsoft Research in 2024. Its paper (Edge et al.) describes using an LLM to build a graph index in two stages: first an entity knowledge graph is derived from the source documents, then community summaries are pre-generated for every group of closely related entities.

Microsoft's announcement framed the problem it targets. Baseline RAG "struggles to connect the dots" when an answer needs information spread across documents, and performs poorly when asked to holistically understand summarised concepts over a large collection. Plain vector retrieval only returns the few chunks that look most like the question.

At query time the community summaries feed the answer. For a broad question, each relevant community summary produces a partial answer, and those partial answers are combined into a final response. In the paper's tests on datasets of around 1 million tokens, this beat a conventional RAG baseline on the comprehensiveness and diversity of answers to global "sensemaking" questions.

The price is indexing work. Building the graph means LLM calls over the whole corpus before any question is asked, whereas baseline RAG only needs embeddings. GraphRAG therefore pays off mainly for questions about themes across a corpus, not for looking up a single fact that one chunk already contains.

Example

How the two approaches handle the same question over a year of support tickets.

Question: "What are the main themes in customer complaints this year?" Baseline RAG embeds the question and retrieves the handful of tickets that sound most like it, so the answer reflects those few tickets rather than the whole year.

GraphRAG has already extracted entities such as products, features and error types, linked them, grouped them into communities (for example, everything connected to billing) and summarised each community. The answer is assembled from those summaries, so a theme that appears in hundreds of tickets is represented even if no single ticket mentions the word "complaint".

Common confusion

Is GraphRAG just RAG with a knowledge graph database?

Not quite. In Microsoft's approach the graph is generated by an LLM from unstructured text, and the key extra step is clustering it into communities with pre-written summaries. Answering broad questions from those summaries is what separates it from simply storing chunks in a graph store.

Does GraphRAG replace vector search?

No. It is aimed at corpus-wide questions that vector retrieval handles poorly. For specific lookups, embedding-based retrieval is cheaper to build and usually sufficient, and the two are often used side by side.

Further reading

Want to learn more?

Explore more developer terms or read in-depth articles on the blog.

Browse all terms