跳到主要内容Skip to main content
RAG 与知识库RAG & Knowledge Bases规模 / 性能Scale / performance

GraphRAG

microsoft / graphrag

微软的 GraphRAG 实现:从文本抽实体和关系建图,生成社区摘要,支持 global/local 等查询模式。Microsoft’s GraphRAG implementation: extract entities and relations from text, build communities, generate summaries and support global and local queries.

36.7k stars 3887 forks Python 语言Language MIT 许可License 最近推送Last push 2026-11-19

为什么选Why choose it

  • 跨文档总结和关系推理是普通 top-k 检索的短板,GraphRAG 提供了完整的图索引与查询参考。Global questions can use community summaries rather than top-k chunks.
  • 社区摘要让“这批文档整体在讲什么”可回答,而不是只返回相似段落。Entity and relation extraction is part of the pipeline.
  • 开源实现可拆开看实体抽取、聚类、摘要和查询各自的成本。A reference implementation for graph-based RAG.

不适合Not for

低延迟、频繁更新的小知识库;建图索引贵,增量更新麻烦。You need a low-cost index for a small corpus.
只需要精确关键词检索或单文档问答的场景。You cannot afford the extraction and summarisation calls.

最小上手Minimum setup

  1. pip install graphrag,准备一个文档目录和模型端点。Index a small document set and inspect the graph.
  2. graphrag init 后跑索引,观察实体/关系抽取与社区报告。Ask one global and one local question.
  3. 用 20–50 个跨文档问题比较 global 与 local 查询的质量和成本。Record token cost before scaling the corpus.

依赖与成本Dependencies and cost

Python 3.10+;LLM API;建图需要大量 token 与磁盘。Check runtime, model weights and external service dependencies in the README.

许可与使用边界License and usage boundaries

代码 MIT;模型与数据另计。Code is MIT; model weights, training data and generated content may have separate terms — check each before commercial use.

开源不等于可商用:GPL / AGPL 有传染性;代码许可、模型许可、生成内容许可要分开看。上线前读仓库 LICENSE 与模型卡,必要时让法务确认。Open source is not automatically commercial-use friendly: GPL / AGPL are copyleft; code, model and output licenses are separate. Read the LICENSE and model card before launch, and involve legal when needed.

替代与相邻Alternatives and neighbors

  • LightRAG — 轻量Lightweight,轻量 GraphRAG 实现:把文档抽成实体关系图,再做向量+图检索,成本比全文 GraphRAG 低。A lightweight GraphRAG implementation: extract entities and relations, then combine vector and graph retrieval at lower cost than full GraphRAG.
  • R2R — 生产可用Production,生产化 RAG 服务:文档摄入、混合检索、知识图谱、agentic RAG、用户与租户管理,带 REST API 和 Web UI。A production-oriented RAG service: document ingestion, hybrid retrieval, knowledge graphs, agentic RAG, users and tenants, with a REST API and web UI.
  • LlamaIndex — 生产可用Production,面向 RAG 与应用层的数据框架:连接器、索引、检索、查询引擎、agent。A data framework for RAG and application layers: connectors, indexes, retrieval, query engines and agents.

下一步Next steps

  • 打开 GitHub,先读 README、LICENSE、最近 release 与 issue。Open GitHub and read the README, LICENSE, latest release and issues first.
  • 按“部署依赖 / 显存 / 数据 / 网络 / 权限”列一张上手清单。Make an onboarding checklist for deployment dependencies, VRAM, data, network and permissions.
  • 用一个小样本跑通,再决定是否进生产;不要直接上生产数据。Run a small sample first, then decide on production; never start with production data.

GitHub 仓库 ↗GitHub repository ↗ 文档 ↗Docs ↗ 加入对比Add to compare

快照口径:stars / forks / language / license / pushed_at 来自 GitHub API 2026-11-20 快照;之后的变化没有回写。标签与“适合 / 不适合”是编辑判断,不是 GitHub 元数据。Snapshot: stars / forks / language / license / pushed_at come from the GitHub API snapshot on 2026-11-20; later changes are not written back. Tags and “fit / not fit” are editorial judgments, not GitHub metadata.
不背书:本站只做索引与风险提示,不审计代码、不保证安全、不替你做许可判断。仓库脚本与模型权重请自行审查。No endorsement: this site only indexes and flags risks; it does not audit code, guarantee security or make license decisions for you. Review repository scripts and model weights yourself.