GraphRAG — Knowledge Graph RAG by Microsoft
Build knowledge graphs from documents for smarter RAG. Local and global search over entity relationships. By Microsoft Research. 31K+ stars.
Staging seguro para este activo
Este activo primero queda en staging. El prompt copiado pide inspeccionar los archivos staged antes de activar scripts, config MCP o config global.
npx -y tokrepo@latest install ac77668d-1767-4b86-ac8c-1c050166d21b --target codexPrimero deja archivos en staging; la activación requiere revisar el README y el plan staged.
What it is
GraphRAG is an open-source tool by Microsoft Research that builds knowledge graphs from unstructured documents for smarter retrieval-augmented generation. Unlike traditional RAG that retrieves text chunks, GraphRAG extracts entities and relationships, organizing them into a graph structure that supports both entity-focused local search and holistic global search.
GraphRAG is designed for researchers and developers building RAG systems that need to answer questions requiring synthesis across multiple documents, not just finding a single relevant passage.
How it saves time or tokens
Traditional vector-based RAG struggles with questions that span multiple documents or require understanding relationships between entities. GraphRAG solves this by pre-indexing documents into a knowledge graph during the indexing phase. At query time, the graph structure enables answering questions like 'what are the key themes across all documents' without scanning every chunk. The estimated token cost for this workflow is around 1,783 tokens.
How to use
- Install GraphRAG:
pip install graphrag
- Initialize and index your documents:
graphrag init --root ./my-project
# Place documents in ./my-project/input/
graphrag index --root ./my-project
- Query with local or global search:
# Local search (entity-focused)
graphrag query --root ./my-project --method local \
'What are the main findings about transformer architectures?'
# Global search (holistic summary)
graphrag query --root ./my-project --method global \
'What are the key themes across all documents?'
Example
# Python API usage
from graphrag.query.cli import run_local_search, run_global_search
# After indexing, query programmatically
result = run_local_search(
root_dir='./my-project',
query='Who are the key researchers in attention mechanisms?'
)
print(result.response)
# Global search for cross-document synthesis
result = run_global_search(
root_dir='./my-project',
query='Summarize the evolution of language models'
)
print(result.response)
Related on TokRepo
- RAG tools — retrieval-augmented generation frameworks
- Knowledge graph tools — entity and relationship extraction
Common pitfalls
- Not configuring the LLM provider in settings.yaml before running the indexing step
- Running indexing on very large document sets without estimating the LLM API costs first
- Using local search when the question requires cross-document synthesis (use global search instead)
Preguntas frecuentes
Traditional RAG splits documents into chunks and retrieves the most similar ones. GraphRAG extracts entities and relationships into a knowledge graph, enabling answers that require understanding connections across documents rather than finding a single relevant passage.
Local search finds information about specific entities and their relationships. Global search synthesizes themes and summaries across the entire document collection. Use local for factual lookups and global for high-level analysis.
Indexing cost depends on document volume and the LLM used. GraphRAG calls the LLM to extract entities and relationships from each text chunk. For large collections, costs can be significant. Test with a small subset first.
Yes. Configure the settings.yaml to point to a local model endpoint (e.g., Ollama, vLLM). This eliminates API costs but requires sufficient compute for entity extraction during indexing.
GraphRAG processes plain text and PDF files placed in the input directory. For other formats, convert to text before indexing. The tool handles chunking and entity extraction automatically.
Referencias (3)
- GraphRAG GitHub— GraphRAG by Microsoft Research
- Microsoft Research Blog— Knowledge graph-based retrieval for improved RAG
- Anthropic Documentation— RAG architecture patterns
Relacionados en TokRepo
Fuente y agradecimientos
Created by Microsoft Research. Licensed under MIT.
graphrag — ⭐ 31,900+
Thanks to Microsoft Research for advancing RAG with knowledge graph techniques.
Discusión
Activos relacionados
Graphiti — Temporal AI Knowledge Graph by Zep
Build dynamic knowledge graphs from AI agent conversations. Graphiti tracks entity changes over time, resolves contradictions, and provides temporal-aware queries.
Cherry Studio Knowledge Base — Local RAG with 50+ Formats
Cherry Studio Knowledge Base ingests PDFs, Office docs, Markdown into a local vector index. Query offline, BYOK any LLM. Data stays on your machine.
MemoryGraph — Graph MCP Memory Server (pipx)
MemoryGraph is a graph-based MCP memory server for coding agents; verified 199★ and shows a pipx install + `claude mcp add` setup for Claude Code.
Awesome AI Pedia — Claude Code + MCP Knowledge
Awesome AI Pedia organizes Claude Code, Cursor, MCP, prompts, and skills into one handbook; verified 399 stars with clone-and-run onboarding.