LightRAG

Active
GitHub Python MIT

Description

LightRAG is a simple and fast Retrieval-Augmented Generation framework using graph-enhanced retrieval, published at EMNLP 2025.

Key Features

  • Graph-enhanced retrieval — Dual-level retrieval (local/global) using knowledge graph entities and relationships, more precise than vector search
  • Four text chunking strategies — Fixed, Recursive, Vector, and Paragraph chunking adapted to different document types
  • Multi-backend storage — Neo4j, PostgreSQL, MongoDB, OpenSearch, JSON KV Store and other storage backends supported
  • Multimodal document processing — RAG-Anything integration for PDF, images, Office docs, tables, and formula parsing
  • Role-specific LLM configuration — Four independent roles (EXTRACT, QUERY, KEYWORDS, VLM) with separate LLM settings
  • WebUI visualization — Web interface for knowledge insertion, querying, and knowledge graph visualization

Use Cases

💡 Large-scale document knowledge base — Build knowledge graphs from tens of thousands of documents with dual-level retrieval
💡 Academic paper analysis — Extract methods, experiments, and conclusions to build domain knowledge graphs for literature review
💡 Enterprise knowledge management — Integrate internal docs, emails, and reports for cross-document relational queries via graph retrieval
💡 Multimodal RAG systems — Process PDFs with images, tables, and formulas for full-modality retrieval-augmented generation
💡 Intelligent QA systems — Combine graph and vector retrieval to answer complex relational questions

Categories

Quick Start

```bash
pip install lightrag-hku

python -c "
import lightrag
from lightrag import LightRAG

rag = LightRAG(work_dir='./lightrag_work')
with open('input.txt', 'r') as f:
    text = f.read()
rag.ainsert(text)
result = rag.aquery('What is the main topic?')
print(result)
"
```

Related Projects

Related Articles