Repolode
HKUDS

HKUDS/LightRAG

A lightweight knowledge-graph RAG framework and server that indexes documents into entities and relations for retrieval-augmented LLM answers.

Open-source alternative to:Microsoft GraphRAG

Stars
40,235
Forks
5,709
Open issues
394
Last commit
5 days ago

What is it?

LightRAG is a retrieval-augmented generation framework that builds a knowledge graph from your documents, extracting entities and relations with an LLM and storing them alongside vector embeddings. Queries can then be answered using local entity context, global relationship context, plain chunk retrieval, or a hybrid of these, with five selectable query modes and the default set to mix.

Beyond the Python SDK, it ships as a server with a REST API and a web UI for inserting documents, exploring the graph and debugging queries. Document parsing can use MinerU, Docling or the built-in native parser for Word and Markdown files, and storage can be PostgreSQL, MongoDB, OpenSearch, Neo4j, Milvus, Qdrant and others. The default in-memory storage is meant only for testing, and the project recommends PostgreSQL for production.

The project includes RAGAS evaluation and Langfuse tracing integrations, optional reranking, role-specific LLM configuration for extraction, query, keyword and vision tasks, and Docker Compose deployment.

Key features

  • 01Builds a knowledge graph of entities and relations from documents using an LLM.
  • 02Offers five query modes: local, global, hybrid, naive and mix.
  • 03Provides a REST API server with a built-in web UI.
  • 04Parses documents with MinerU, Docling or a native Word/Markdown parser.
  • 05Supports PostgreSQL, MongoDB, OpenSearch, Neo4j, Milvus and Qdrant as storage backends.
  • 06Supports incremental document updates and deletion with knowledge graph rebuilding.

Use cases

  • Building a question-answering system over a large private document collection.
  • Answering cross-document questions that require summarizing themes or relationships.
  • Querying legal, financial or technical manuals that contain tables and formulas.
  • Evaluating RAG quality with RAGAS while tracing calls with Langfuse.

Quick start

  1. 1

    Install the LightRAG server with uv

    uv tool install "lightrag-hku[api]"
  2. 2

    Create a .env file from the example and set your LLM and embedding configuration

    cp env.example .env
  3. 3

    Launch the LightRAG server

    lightrag-server

Things to know

  • The server binds to all interfaces by default, and without authentication every endpoint is public.
  • You must configure an LLM and an embedding model in .env before it can index or answer queries.

Topics

FAQ

What is LightRAG?
A lightweight knowledge-graph RAG framework and server that indexes documents into entities and relations for retrieval-augmented LLM answers. LightRAG is a retrieval-augmented generation framework that builds a knowledge graph from your documents, extracting entities and relations with an LLM and storing them alongside vector embeddings. Queries can then be answered using local entity context, global relationship context, plain chunk retrieval, or a hybrid of these, with five selectable query modes and the default set to mix.
Is LightRAG free to use? What license does it have?
LightRAG is open source under the MIT license. Check the license terms before using it in commercial products.
Is LightRAG still maintained?
Actively maintained. The last commit to LightRAG was on Oct 15, 2026.
What can I use LightRAG for?
Building a question-answering system over a large private document collection. Answering cross-document questions that require summarizing themes or relationships. Querying legal, financial or technical manuals that contain tables and formulas. Evaluating RAG quality with RAGAS while tracing calls with Langfuse.
How do I install LightRAG?
Install the LightRAG server with uv: uv tool install "lightrag-hku[api]" Create a .env file from the example and set your LLM and embedding configuration: cp env.example .env Launch the LightRAG server: lightrag-server
Where can I get LightRAG?
The source code and installation instructions are on GitHub: https://github.com/HKUDS/LightRAG

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects