LightRAG
HKUDS / LightRAG
轻量 GraphRAG 实现:把文档抽成实体关系图,再做向量+图检索,成本比全文 GraphRAG 低。A lightweight GraphRAG implementation: extract entities and relations, then combine vector and graph retrieval at lower cost than full GraphRAG.
为什么选Why choose it
- 构图与检索链路完整,代码量小,容易改。Complete graph construction and retrieval pipeline in a small codebase, easy to modify.
- 支持增量更新,不用每次重建全图。Supports incremental updates without rebuilding the whole graph.
- 提供多种检索模式与 Web UI。Multiple retrieval modes and a web UI.
不适合Not for
只需要朴素向量检索,直接用向量库更简单。If plain vector search is enough, a vector database is simpler.
实体抽取质量依赖 LLM,噪声多时要人工清洗。Entity extraction depends on the LLM; noisy graphs need human cleanup.
最小上手Minimum setup
- 用 20–50 篇文档跑一次构图,检查实体与关系是否合理。Build a graph from 20–50 documents and inspect entities and relations.
- 对比纯向量检索与图检索在同一组问题上的召回。Compare plain vector retrieval with graph retrieval on the same question set.
- 把抽取模型与存储后端固定下来,再扩文档量。Freeze the extraction model and storage backend before scaling document volume.
依赖与成本Dependencies and cost
Python + LLM API/本地模型;需要向量库与图存储;构图成本随文档量上升。Python + LLM API/local model; needs a vector store and graph storage; graph construction cost grows with documents.
许可与使用边界License and usage boundaries
代码 MIT;模型与数据另有许可。Code is MIT; models and data carry their own licenses.
开源不等于可商用: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
- RAGFlow — 先试这个Start here,带文档解析、切分、检索与引用的 RAG 平台,适合把一套知识库跑起来。A RAG platform with document parsing, chunking, retrieval and citations, built to get a knowledge base running.
- 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