LeanRAG  by KnowledgeXLab

Knowledge-graph-based RAG framework

Created 1 year ago
251 stars

Top 99.8% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

LeanRAG is an open-source framework for Retrieval-Augmented Generation (RAG) designed to tackle the challenge of producing context-aware, concise, and high-fidelity responses. It targets researchers and engineers by employing knowledge graphs, semantic aggregation, and hierarchical retrieval techniques to enhance response quality and retrieval efficiency while minimizing redundancy.

How It Works

The core of LeanRAG's approach involves constructing and leveraging a knowledge graph. It utilizes semantic aggregation to cluster entities into summarized nodes, establishing explicit relations to form a navigable network. Retrieval is hierarchical and structure-guided, initiating from fine-grained entities and traversing upwards through the graph to gather relevant evidence. This method is designed to optimize retrieval paths, significantly reducing redundant information (achieving ~46% less redundancy than flat retrieval baselines) and ensuring more focused evidence for LLM synthesis.

Quick Start & Requirements

  • Prerequisites: Python 3.10+ and Conda for environment management.
  • Installation: Clone the repository (git clone https://github.com/RaZzzyz/LeanRAG.git), navigate to the directory, create and activate a Conda environment (e.g., conda install -n leanrag python=3.11; conda activate leanrag), and install dependencies (pip install -r requirements.txt).
  • Workflow: The process involves document chunking, knowledge graph extraction (via CommonKG or LLM-based GraphRAG), graph construction, and retrieval.
  • Links: https://github.com/RaZzzyz/LeanRAG.git

Highlighted Details

  • Accepted to AAAI-26, indicating academic recognition.
  • Demonstrates superior performance across multiple QA benchmarks (Mix, CS, Legal, Agriculture) compared to various RAG baselines, with notable improvements in Comprehensiveness, Empowerment, and Diversity metrics.
  • Achieves approximately 46% lower retrieval redundancy compared to flat retrieval baselines.

Maintenance & Community

The project acknowledges the use of nano-graphrag and HiRAG. No specific details regarding active maintainers, community channels (e.g., Discord, Slack), or a public roadmap are provided in the README.

Licensing & Compatibility

The provided README does not explicitly state the software license. This omission requires clarification for users considering commercial applications or integration into closed-source projects.

Limitations & Caveats

The README does not detail any specific limitations, known bugs, unsupported platforms, or indicate if the project is in an alpha or beta stage.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
2
Star History
102 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.