HKUDS/LightRAG

[EMNLP2025] LightRAG: Simple and Fast Retrieval-Augmented Generation

LightRAG – A Lightweight Graph‑Based Retrieval‑Augmented Generation Framework

What it is

  • An open‑source Python library that combines vector embeddings with a knowledge‑graph index to power Retrieval‑Augmented Generation (RAG). It aims to be a faster, cheaper alternative to heavyweight solutions like Microsoft GraphRAG while still handling large corpora and multimodal documents.

Core ideas

  • Dual‑layer architecture – a KV store for raw chunks, a vector store for similarity search, and a graph store for entity/relationship links.
  • Incremental updates – documents can be added or deleted without rebuilding the whole index; the system re‑uses LLM‑generated caches to rebuild affected graph nodes quickly.
  • Multiple chunking strategies – Fixed, Recursive, Vector‑semantic and Paragraph‑semantic, the latter aligning chunks with natural headings, tables and formulas.
  • Pluggable parsers – native parser, MinerU, Docling and others, allowing extraction of text, images, tables and equations.
  • Multimodal support – via the integrated RAG‑Anything component, images and formulas are linked into the graph so the LLM can reference them during generation.

Key features

  • Graph‑based retrieval that captures long‑range semantic dependencies (useful for legal, financial or technical docs).
  • Four selectable chunking modes, including a Paragraph mode that respects document structure.
  • Built‑in reranker and optional citation generation.
  • Support for many storage back‑ends: in‑memory (default), PostgreSQL, Neo4j, Milvus, OpenSearch, MongoDB, etc.
  • Server component (lightrag-server) exposing a REST API and a Web UI for uploading docs, querying, and visualising the knowledge graph.
  • Easy offline deployment via Docker Compose or the uv package manager; includes a setup wizard that creates a ready‑to‑run .env and compose files.
  • Optional extras: spaCy models for smart heading detection in Word files, Cairo for SVG rasterisation, RAGAS evaluation, Langfuse tracing.

Typical workflow

  1. Configure your LLM, embedding model and optional reranker in a .env file (or run make env-base).
  2. Ingest documents with lightrag-server – the parser extracts text and multimodal elements, creates embeddings, builds the KG and stores everything in the chosen backend.
  3. Query via the Web UI or REST endpoint – LightRAG performs a dual‑level retrieval (graph + vector), optionally reranks results, and passes the context to the LLM for generation.
  4. Maintain – add new files or delete outdated ones; the system updates the graph incrementally.

Installation highlights

  • Recommended package manager: uv (curl -LsSf https://astral.sh/uv/install.sh | sh).
  • Install the server with uv tool install "lightrag-hku[api]" or via pip.
  • For production, spin up the Docker Compose stack (docker compose up) after copying env.example to .env and filling in your model endpoints.
  • Offline deployments are supported; see docs/OfflineDeployment.md.

Ecosystem & community

  • PyPI package: lightrag-hku
  • Discord and WeChat groups for support.
  • Related projects from the same authors: RAG‑Anything (multimodal ingestion), VideoRAG, MiniRAG.
  • Academic paper on arXiv (2410.05779) and tutorials on LearnOpenCV.

Who should use it

  • Teams needing a customizable RAG pipeline that can handle large, structured corpora and multimodal content.
  • Researchers exploring graph‑based retrieval or evaluating RAG quality with metrics like RAGAS.
  • Developers who prefer a Python‑centric stack with flexible storage options and a ready‑made API/Web UI.

All information is taken directly from the repository’s README; no additional claims are made.

Related

  • Project
  • Project
  • Project
  • Project
  • Project