Ask a standard RAG system "what does section 4.2 say about liability?" and chunk retrieval works fine — that's a localized question with an answer in one place. Ask it "what are the recurring risk themes across these 200 contracts?" and it structurally can't answer well, because no single retrieved chunk contains a corpus-wide synthesis. That's the gap GraphRAG is built to close.
How the pipeline actually works
1. Extract a knowledge graph from the raw text. An LLM pass identifies entities (people, organizations, concepts) and the relationships between them across your documents, building a graph rather than a flat chunk list.
2. Detect communities and summarize each one. The graph gets partitioned into clusters of densely-related entities, and an LLM generates a summary for each community — this is what makes corpus-wide themes queryable later.
3. Query with the mode that matches your question. Global search reasons over community summaries for holistic questions; local search fans out from a specific entity for narrower questions; basic search falls back to standard vector retrieval when that's genuinely what's needed.
# Microsoft GraphRAG: index a corpus, then query it in two different modes
# 1. Index the corpus - extracts entities/relationships, builds community summaries
python -m graphrag index --root ./ragtest
# 2. Global search - reasons over community summaries (holistic questions)
python -m graphrag query \
--root ./ragtest \
--method global \
--query "What are the main themes across all documents?"
# 3. Local search - fans out from a specific entity (narrower questions)
python -m graphrag query \
--root ./ragtest \
--method local \
--query "What is Acme Corp's relationship with Beta Industries?"
| Query type | Best approach |
|---|---|
| "What does page 12 say about X?" (localized) | Standard chunk-based RAG |
| "What are the recurring themes across the whole corpus?" (holistic) | GraphRAG global search over community summaries |
The tradeoff is real: GraphRAG's indexing step costs meaningfully more in LLM calls than embedding chunks for vector search. It's worth that cost specifically when your actual use case involves corpus-wide reasoning — for purely localized lookup questions, standard RAG remains the simpler, cheaper choice.
Practical Challenge
Take a small set of related documents (5-10 articles on one topic) and write one "localized" question and one "holistic, corpus-wide" question about them. Identify which one standard chunk-based RAG would answer well, and which one it would likely struggle with.
Concept Check
Sources & Further Reading
- Microsoft GraphRAG (GitHub) — the open-source project referenced throughout this article, including the CLI commands shown above.
- GraphRAG Documentation — official docs covering global/local/DRIFT/basic search modes.
AI