LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation
by HKU Data Intelligence Lab (HKUDS)
Knowledge-graph RAG that indexes incrementally instead of rebuilding — the practical answer to GraphRAG's cost.
Overview
LightRAG comes out of the HKU Data Intelligence Lab and was published at EMNLP 2025 (arXiv 2410.05779, latest revision April 2025) by Zirui Guo, Lianghao Xia, Yanhua Yu, Tu Ao and Chao Huang. The core idea is a dual-layer retrieval paradigm: graph-based text indexing extracts entities and relationships during ingestion, and queries can be answered at a low level (entity-specific detail) or a high level (conceptual, cross-document themes), with vector similarity available alongside. Five query modes are exposed — local, global, hybrid, naive and mix — so the same index can be A/B tested against ordinary vector RAG without maintaining two pipelines. The repository documents four chunking strategies (fixed, recursive, vector semantic and paragraph semantic) and a pluggable storage layer split into KV, vector, graph and document-status stores, with backends for PostgreSQL, MongoDB, Neo4j, Milvus and in-memory operation. The headline practical advantage over Microsoft GraphRAG is an incremental update algorithm: new documents extend the existing graph rather than triggering a full rebuild, which is what makes graph retrieval affordable on a corpus that changes. Multimodal ingestion arrives through the companion RAG-Anything integration, which routes images, tables and equations via MinerU or Docling. Installation is `uv tool install "lightrag-hku[api]"` or from source, configuration lives in a `.env` file naming LLM and embedding endpoints (OpenAI-compatible or Ollama), and `lightrag-server` starts an API plus web UI; Docker Compose deployment is documented. The project sits at roughly 39k GitHub stars and 5.5k forks with active issue and PR traffic.
At a Glance
- Topic
- RAG
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~3-4 hours to install, index a corpus and compare the five retrieval modes
- Provider
- HKU Data Intelligence Lab (HKUDS)
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Build a dual-layer index pairing an entity knowledge graph with vector embeddings
- ✓Choose between local, global, hybrid, naive and mix retrieval modes per query
- ✓Add documents incrementally without rebuilding the entire knowledge graph from scratch
- ✓Configure KV, vector, graph and doc-status stores across Postgres, Neo4j, Milvus or MongoDB
- ✓Compare fixed, recursive, vector-semantic and paragraph-semantic chunking on your own corpus
- ✓Ingest images, tables and equations through RAG-Anything with MinerU or Docling
- ✓Run the lightrag-server API and web UI locally via uv or Docker Compose
Highlights
- •Roughly 39k GitHub stars plus an EMNLP 2025 paper — research pedigree with a maintained server
- •Positioned explicitly against Microsoft GraphRAG's indexing cost, and the incremental update is the reason
- •Five query modes let you benchmark graph retrieval against plain vector RAG in one index
- •Ships a server, web UI, Ollama support and Docker Compose — deployable, not just a demo notebook
- •Storage layer is genuinely pluggable across Postgres, Neo4j, Milvus, MongoDB and in-memory
Who It’s For
Best For
- ✓RAG engineers hitting the limits of flat chunk-and-embed retrieval
- ✓Teams evaluating GraphRAG-style retrieval on a corpus that changes frequently
- ✓Researchers who want a reproducible graph-RAG baseline with a published paper behind it
- ✓Developers running local models who need an Ollama-compatible retrieval stack
Prerequisites
- •A working Python environment plus an LLM and embedding endpoint (OpenAI-compatible or Ollama)
- •Basic RAG experience with chunking, embeddings and vector search
- •Familiarity with Docker or uv for running the bundled server
FAQ
What is LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation?
The reference implementation and documentation for LightRAG, an EMNLP 2025 framework from the University of Hong Kong that pairs an entity knowledge graph with vector embeddings in a dual-layer index. It is aimed at RAG engineers whose flat chunk-and-embed pipelines return fragmented answers, and who need cross-document reasoning without paying Microsoft GraphRAG's full-reindex cost on every update.
Is LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation free?
LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation is free to access.
What level is LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation for?
LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation is aimed at a intermediate audience. Recommended background: A working Python environment plus an LLM and embedding endpoint (OpenAI-compatible or Ollama), Basic RAG experience with chunking, embeddings and vector search, Familiarity with Docker or uv for running the bundled server.
How long does LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation take?
Expect roughly ~3-4 hours to install, index a corpus and compare the five retrieval modes. Most learners work through it at their own pace.
What will I learn from LightRAG — Simple and Fast Graph-Based Retrieval-Augmented Generation?
You'll learn: Build a dual-layer index pairing an entity knowledge graph with vector embeddings; Choose between local, global, hybrid, naive and mix retrieval modes per query; Add documents incrementally without rebuilding the entire knowledge graph from scratch; Configure KV, vector, graph and doc-status stores across Postgres, Neo4j, Milvus or MongoDB; Compare fixed, recursive, vector-semantic and paragraph-semantic chunking on your own corpus; Ingest images, tables and equations through RAG-Anything with MinerU or Docling; Run the lightrag-server API and web UI locally via uv or Docker Compose.
Topics
Sources
This page was written from 3 sources, 2 on domains other than github.com.