
LightRAG
Graph-building RAG: an LLM turns documents into entities and relations, and queries walk both graph and vectors
What is LightRAG?
At indexing time an LLM reads every chunk and extracts entities and relations into a knowledge graph kept alongside vector embeddings; at query time five modes choose the path — local for facts about one entity, global for themes spanning documents, hybrid and mix to combine them, naive for plain chunk retrieval. A bundled server adds a REST API, a dashboard with graph visualisation, and an Ollama-compatible endpoint that chat frontends can talk to as if it were a model. The cost structure is the decision: building the graph spends an LLM call on every chunk, the project names a 30B-class model as the local minimum for extraction, and the out-of-the-box storage is stated to be unsuitable for production — if cheap chunk search is all you need, the existence of its own naive mode concedes that plainer RAG suffices.
What can you do with LightRAG?
- One index, five ways to ask — local retrieves what the graph knows about a specific entity, global follows relationship chains for questions that span documents, hybrid and the default mix merge graph and chunk retrieval, and naive skips the graph entirely — so one corpus serves both point lookups and synthesis questions.
- Four model roles, wired independently — Extraction, querying, keyword generation and vision each take their own model via OpenAI-compatible APIs, Ollama, Hugging Face or Bedrock — a large model can build the graph while a cheap one answers questions, or the reverse.
- A server chat frontends already understand — The bundled LightRAG Server exposes REST endpoints, a web dashboard with upload, query and graph visualisation, and an Ollama-compatible API — though it binds to all interfaces with those routes unauthenticated by default, so the network boundary is yours to draw.
- Storage grows from laptop to production — Defaults are in-memory with file persistence for evaluation; a single PostgreSQL, MongoDB or OpenSearch instance can carry all four stores in production, or each store picks a specialist — Milvus, Qdrant or Faiss for vectors, Neo4j or Memgraph for the graph. New documents merge into the existing graph without re-indexing.
Before you choose LightRAG
- Entities merge only on exact name match, so the same thing under two names becomes duplicate nodes or disconnected subgraphs — a graph-quality limit tracked since April 2025.Reported in#1323
- The embedding model is fixed at indexing time; switching later means re-embedding everything, and the rebuild tool requires stopping the server.
- Multi-tenant isolation leaks as of mid-2026: part of the query path ignores the workspace header and falls back to the default workspace.Reported in#2904
Star history
19 Aug to 30 Oct · +1.5k
Frequently asked questions
Is LightRAG free for commercial use?
LightRAG is released under the MIT licence — OSI-approved open source, which permits commercial use.
How can LightRAG be deployed?
LightRAG is available as Runs locally / Self-hosted.