Favicon of GraphRAG

GraphRAG

Microsoft's GraphRAG is a Python data pipeline that builds knowledge graphs from text to improve LLM retrieval over private, narrative datasets.

GraphRAG website screenshot
GraphRAG GitHub repository preview

GraphRAG is a data pipeline and transformation suite from Microsoft Research that extracts structured entities, relationships, and communities from unstructured text using LLMs, then organizes that data into a knowledge graph. The graph structure is used to improve retrieval-augmented generation (RAG), letting an LLM answer questions that require connecting facts scattered across many documents rather than pulling a single relevant chunk. It's built for developers and researchers who work with private text corpora (reports, transcripts, articles, internal docs) and need an LLM to reason across the whole dataset, not just retrieve isolated snippets.

The project ships as a Python package with a CLI for indexing and querying. It's positioned as a research artifact with an accompanying paper (GraphRAG Arxiv) and a Microsoft Research blog post explaining the motivation: standard vector-search RAG struggles with questions that need synthesis across a whole corpus, and a graph-based intermediate representation helps close that gap.

Key features

  • Graph-based indexing: extracts entities, relationships, and hierarchical communities from raw text using an LLM, producing a structured knowledge graph instead of flat text chunks.
  • Global and local query modes: supports different retrieval strategies depending on whether a question needs a corpus-wide summary or a narrow, entity-focused answer.
  • Prompt tuning support: includes a dedicated Prompt Tuning Guide and tooling because default prompts often underperform on domain-specific data.
  • CLI-driven workflow: graphrag init, indexing, and query commands drive the pipeline, so it can be scripted or automated.
  • Config migration tooling: a migration notebook and graphrag init --root [path] --force command help move configs and prompts forward across version bumps.
  • MIT licensed: source is open and can be inspected, modified, or embedded in other tools.

Ideal use cases

GraphRAG fits well when you have a body of unstructured private text (research corpora, internal knowledge bases, narrative documents, meeting transcripts) and need an LLM to answer questions that span multiple documents or require summarizing themes across the whole set. It's a good match for exploratory question answering, thematic summarization, and building internal search/QA tools on top of proprietary content where standard chunk-based RAG returns fragmented or shallow answers.

It is not a good fit if you need cheap, low-latency retrieval: indexing runs multiple LLM calls per document to extract entities and relationships, and the README explicitly warns that indexing can be expensive. For small datasets, simple FAQ-style lookups, or cases where a single relevant passage usually answers the question, a conventional vector-store RAG setup is simpler and cheaper. It's also described as a research demonstration rather than an officially supported Microsoft product, so teams needing enterprise support or SLAs should evaluate that tradeoff. Read the documentation and start with a small dataset before scaling up, since costs grow with corpus size and LLM usage.

Installation

GraphRAG is distributed as a PyPI package and driven through a CLI. Install it with pip:

pip install graphrag

Initialize a project in a working directory to generate the base configuration and prompt files:

graphrag init --root [path] --force

From there, follow the command line quickstart in the official documentation to configure your LLM provider, add input text, run indexing, and issue queries. The quickstart walks through the full workflow in detail; the README itself points to it rather than embedding every step, since configuration (model choice, API keys, chunking settings) varies by setup.

Before indexing a real dataset, read the Prompt Tuning Guide, since default prompts often need adjustment for domain-specific text to get useful results. Also budget for LLM API costs: indexing involves multiple calls per document to extract entities, relationships, and community structures, and the project explicitly warns this can get expensive at scale. When upgrading between minor versions, re-run graphrag init --root [path] --force to pick up the latest config format (this overwrites existing config and prompts, so back them up first). For major version upgrades, a migration notebook is provided to avoid full re-indexing of prior datasets.

Frequently asked questions

Share:

Stars
35.7K
Forks
3.8K
Last commit
3 days ago
Repository age
2 years
License
MIT
Self-hosted
No
Activity score
85/100
View Repository
Ad
Favicon

 

  
 

Similar to GraphRAG

Favicon

 

  
 
Favicon

 

  
 
Favicon