HKUDS /LightRAG
[EMNLP2025] LightRAG: Simple and Fast Retrieval-Augmented Generation
★ 40,707⑂ 5,779👁 287⑃ 2,582● 1,684▤ 84
+14
日增长
+86
周增长
40,707
stars
5,779
forks
287
watchers
2,582
prs
1,684
issues
84
releases
README
🚀 LightRAG: 简单且快速的检索增强生成(RAG)框架
&32;&32;
---
🎉 新闻
- [2026.07]🎯[新功能]: 添加 Word 文档 智能章节标题 识别功能。
- [2026.05]🎯[新功能]:将 RagAnything 合并至 LightRAG🎉。支持通过 MinerU / Docling 服务进行多模态内容解析与提取。
- [2026.05]🎯[新功能]:引入四种可选的文本分块策略:Fix(固定)、Recursive(递归)、Vector(向量)和 Paragraph(段落语义)。
- [2026.05]🎯[新功能]:支持按角色配置 LLM,提供四个独立角色:EXTRACT、QUERY、KEYWORDS 和 VLM,每个角色拥有独立的 LLM 设置。
- [2026.03]🎯[新功能]: 集成了 OpenSearch 作为统一存储后端,为 LightRAG 的全部四种存储类型提供全面支持。
- [2026.03]🎯[新功能]: 推出交互式安装向导,支持通过 Docker 在本地部署 Embedding、Reranking 及存储后端服务。
- [2025.11]🎯[新功能]: 集成了 RAGAS 评估和 Langfuse 追踪。更新了 API 以在查询结果中返回召回上下文,支持上下文精度指标。
- [2025.10]🎯[可扩展性增强]: 消除了处理瓶颈,以高效支持大规模数据集。
- [2025.09]🎯[新功能]: 显著提升了 Qwen3-30B-A3B 等开源 LLM 的知识图谱提取准确性。
- [2025.08]🎯[新功能]: 现已支持 Reranker,显著提升混合查询性能(已设为默认查询模式)。
- [2025.08]🎯[新功能]: 添加了文档删除功能,并支持自动重新生成知识图谱,以确保最佳查询性能。
- [2025.06]🎯[新发布]: 我们的团队发布了 RAG-Anything —— 一个用于无缝处理文本、图像、表格和方程式的全功能多模态 RAG 系统。
- [2025.06]🎯[新功能]: LightRAG 现已集成 RAG-Anything,支持全面的多模态数据处理,实现对 PDF、图像、Office 文档、表格和公式等多种格式的无缝文档解析和 RAG 能力。详见多模态文档处理部分。
- [2025.03]🎯[新功能]: LightRAG 现已支持引用功能,实现了准确的源归因和增强的文档可追溯性。
- [2025.02]🎯[新功能]: 现在您可以使用 MongoDB 作为一体化存储解决方案,实现统一的数据管理。
- [2025.02]🎯[新发布]: 我们的团队发布了 VideoRAG —— 一个用于理解超长上下文视频的 RAG 系统。
- [2025.01]🎯[新发布]: 我们的团队发布了 MiniRAG,使用小型模型简化 RAG。
- [2025.01]🎯现在您可以使用 PostgreSQL 作为一体化存储解决方案进行数据管理。
- [2024.11]🎯[新资源]: LightRAG 的综合指南现已在 LearnOpenCV 上发布 —— 探索深入的教程和最佳实践。非常感谢博客作者的杰出贡献!
- [2024.11]🎯[新功能]: 推出 LightRAG WebUI —— 一个允许您通过直观的 Web 界面插入、查询和可视化 LightRAG 知识的仪表板。
- [2024.11]🎯[新功能]: 现在您可以使用 Neo4J 进行存储 —— 开启图数据库支持。
- [2024.10]🎯[新功能]: 我们添加了 LightRAG 介绍视频 的链接 —— 演示 LightRAG 的各项功能。感谢作者的杰出贡献!
- [2024.10]🎯[新频道]: 我们创建了一个 Discord 频道!💬 欢迎加入我们的社区进行分享、讨论和协作! 🎉🎉
算法流程图
!LightRAG索引流程图
图1:LightRAG索引流程图 - 图片来源:Source
!LightRAG检索和查询流程图
图2:LightRAG检索和查询流程图 - 图片来源:Source
安装
💡 使用 uv 进行包管理: 本项目使用 uv 进行快速可靠的 Python 包管理。首先安装 uv: curl -LsSf https://astral.sh/uv/install.sh | sh (Unix/macOS) 或 powershell -c "irm https://astral.sh/uv/install.ps1 | iex" (Windows)
注意:如果您愿意,也可以使用 pip,但为了获得更好的性能和更可靠的依赖管理,建议使用 uv。
📦 离线部署: 对于离线或隔离环境,请参阅离线部署指南,了解预安装所有依赖项和缓存文件的说明。
[!WARNING]
在共享网络上启动服务前,请先做好访问保护。 lightrag-server 默认监听所有网卡(HOST=0.0.0.0),且默认不开启认证。在云服务器上,这意味着所有接口都对公网开放,任何人都能调用并消耗你的 LLM 额度。首次启动前,请二选一:在 .env 中绑定到私有地址(HOST=127.0.0.1,或 VPN / 隧道地址);或者配置认证:LIGHTRAG_API_KEY,或 AUTH_ACCOUNTS 加 TOKEN_SECRET(可用 openssl rand -hex 32 生成)。设置 LIGHTRAG_API_KEY 后,Ollama 兼容的 /api/ 路由也要求该 key(Ollama 客户端以 Authorization: Bearer 发送);未设置 key 时,为兼容客户端,这些路由保持开放。以下所有安装方式均适用。
从 PyPI 安装
PyPI 包已内置构建好的 WebUI,无需构建前端。
bash
使用 uv 将 LightRAG 服务器安装为工具(推荐)
uv tool install "lightrag-hku[api]"
或在虚拟环境中使用 pip
python -m venv .venv
source .venv/bin/activate Windows: .venv\Scripts\activate
pip install "lightrag-hku[api]"
获取配置模板并编辑(参见下文"最少需要修改的 .env 配置")
curl -O https://raw.githubusercontent.com/HKUDS/LightRAG/main/env.example
cp env.example .env
lightrag-server
从源码Top issues
#1323[Feature Request]: Automatic merging of the same entity under different names35 comments · 2025-04-09#2133[Question]:How to implement multi tenant solutions?14 comments · 2025-09-22#3631[Design Review]: Server-side Multi-Workspace Phase 113 comments · 2026-08-11#1985[Question]:How to add custom metadata columns for document management?13 comments · 2025-08-20#3664RFC: Add C strategy for Server-injected custom chunking callbacks12 comments · 2026-08-18#2285Can we temporarily enable/disable documents in RAG?11 comments · 2025-10-30#2138[Bug]: 🐛 Bug Report: QueryParam ids parameter not working in API Server Describe the bug11 comments · 2025-09-23#2642Guidance on Adding Multimodal Support to LightRAG: Wrap with RAG‑Anything or Extend (modify) LightRAGs lightrag‑server?10 comments · 2026-01-27
Discussions
#4403Chopper: a small open model that cuts only the needed sentences out of retrieved text0 comments · 2026-11-14#4301v1.5.6: supported chunk-selection diagnostics and applicability of #3887/#39042 comments · 2026-11-05#4150Putting a dollar cap on one LightRAG indexing job0 comments · 2026-10-03#3933Replaying a LightRAG run offline: exact with a local embedder, and exactly where it stops with openai_embed0 comments · 2026-09-13#3840We wired LightRAG into a full-duplex voice runtime — ask your knowledge base questions by voice0 comments · 2026-09-06#3388Feature Idea: Metadata filtering for retrieval (pre-filter chunks/entities by tags, file path, etc.)0 comments · 2026-07-10#3342LightRAG Upload Fails with "NanoVectorDBStorage[entities] index flush failed: 404 page not found"3 comments · 2026-06-28#3341File Upload Fails in LightRAG with "llama.cpp terminated unexpectedly" Error0 comments · 2026-06-28
Latest release
v1.5.8rc1 v1.5.8rc1 2026-11-15Important Notes v1.5.8rc1 is a release candidate. Please test it on a copy of your data before upgrading production. Highlights 1. Configuration storage: LightRAG now remembers which embedding model built your vectors In earlier releases, changing EMBEDDING_MODEL or EMBEDDING_DIM on an existing deployment failed silently. Depending on the backend, LightRAG either kept the old vectors and returned wrong neighbours, or opened a new, empty vector container (Milvus / Qdrant / PostgreSQL) and served a knowledge graph with no vectors at all. v1.5.8 adds a configuration storage. It i