Skip to content

LightRAG

A Python library that builds a knowledge graph from your documents to answer questions with an LLM.

Stars
40.5k
Forks
5.8k
Licence
MIT
Language
Python
Last update
7 days ago
Type
Library

What it is

LightRAG is a Python library for retrieval-augmented generation, where a language model answers questions using information pulled from your own documents. It extracts entities and relationships from text into a knowledge graph and uses that graph, alongside vector search, to find relevant context for a query. The README also describes a web UI, Docker-based deployment, and support for several storage backends.

  • Index a folder of documents and query them through the API or WebUI
  • Store the knowledge graph in backends such as Neo4j, PostgreSQL, MongoDB, or OpenSearch, as the README lists
  • Parse PDFs and Office files with MinerU or Docling integration described in the news items
  • Evaluate retrieval quality with the RAGAS integration mentioned in the README

Great for

  • Developers building question-answering over their own document collections
  • Teams who want a graph-based alternative to plain vector-search RAG
  • Researchers experimenting with graph-based retrieval and evaluation (RAGAS and Langfuse integrations are listed)
  • People who want a self-hosted RAG setup with a choice of storage backends

Not ideal for

  • Non-programmers who only want a ready-made chat app; the README centers on a Python library and API, though a WebUI is mentioned
  • Anyone needing a fully managed hosted service; this is self-hosted open source
  • Projects where you cannot pay for or run an LLM and embedding model, since the README relies on external model services
Step-by-step guide: how to use LightRAGInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.10

    Install uv (package manager recommended by the README)

    git clone https://github.com/HKUDS/LightRAG.git
  2. 2

    Run it

    • Clone the repository from GitHub
    • Install dependencies following the README's Installation section, which recommends uv
    • Configure an LLM and embedding model per the README's configuration instructions
    • Run the example or the API/WebUI as described in the README
  3. 3

    Get the most out of it

    • Use role-specific LLM configuration to assign separate models to extraction, query, keywords, and VLM tasks
    • Choose among the four text chunking strategies (Fix, Recursive, Vector, Paragraph) to suit your documents
    • Enable the Reranker, which the README says is the default query mode
    • Use the RAGAS and Langfuse integrations to evaluate and trace queries
    • Try Docker-based local deployment of embedding, reranking, and storage backends via the setup wizard

Downloads

Strengths

  • Built on a published research paper (EMNLP 2025 per the description) with a linked arXiv preprint
  • Supports multiple storage backends and a range of configurable chunking strategies
  • MIT license and an active project with recent releases and a large star count

Trade-offs

  • Setup involves several moving parts (LLM, embedding model, storage), which the README does not simplify for beginners
  • Many features are recent and listed in news items, so behavior may change between versions
  • The README shown is truncated, so full configuration details were not available to verify

How it compares

ProjectStarsTypeLevelUpdatedBest for
LightRAG (this)40.5kLibraryintermediate7 days agoDevelopers building question-answering over their own document collections
graphrag36.5kLibraryintermediate4 days agoResearchers exploring graph-based retrieval over narrative or private text
RAG-Anything24.4kLibraryintermediate4 days agoDevelopers building question-answering systems over PDFs or Office documents with figures and tables
llama_index52.8kLibraryintermediate10 days agoPython developers building retrieval-augmented generation (RAG) apps over private documents
PageIndex40kLibraryintermediate7 days agoDevelopers building question-answering over long PDFs such as annual reports or manuals
LEANN13.8kLibraryintermediate4 days agoDevelopers building a private RAG prototype on a personal machine

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.