MiniRAG

HKUDSMIT长期未更新

用小型开源语言模型搭建轻量级 RAG 系统,降低检索增强生成的硬件门槛和部署复杂度,让普通设备也能跑起来。

[ACL2026] "MiniRAG: Making RAG Simpler with Small and Open-Sourced Language Models"

v0.0.2发布于 2025-02-27 09:11 UTC2,028star259fork同步于 2026-11-07 07:29 UTC

怎么上手

由 README 提炼,执行前请确认
cd MiniRAG
pip install -e .
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;定位为资源受限的端侧场景,实验使用 Phi-3.5-mini、GLM-Edge-1.5B、Qwen2.5-3B、MiniCPM3-4B 等小模型。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

面向小模型和端侧场景的极简 RAG 框架,用异构图索引让 SLM 也能跑出可用的检索增强效果

用小型开源语言模型搭建轻量级 RAG 系统,降低检索增强生成的硬件门槛和部署复杂度,让普通设备也能跑起来。

核心能力

  • 用文本块与命名实体构建语义感知异构图索引
  • 用轻量拓扑增强检索,不依赖强语义理解能力
  • 支持 Neo4j、PostgreSQL、TiDB 等 10+ 异构图数据库
  • 提供 API 与 Docker 部署方式
  • 附带 LiHua-World 端侧 RAG 评测数据集

容易踩的坑

PyPI 安装命令在 README 中写的是 pip install lightrag-hku,与新闻里的 minirag-hku 不一致,需自行确认;运行前需把数据集放到 ./dataset 目录,仓库仅内置 LiHuaWorld.zip;使用 Neo4j 等图数据库需额外部署对应后端。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

2 个版本v0.0.2
  1. v0.0.2最新正式版2025-02-27 · 2025-02-27 09:11 UTC

    MiniRAG w/ API, pypi, and more function

  2. v0.0.12025-01-16 · 2025-01-16 05:04 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    MiniRAG: Towards Extremely Simple Retrieval-Augmented Generation

    MiniRAG

    The Code Repository: MiniRAG: Towards Extremely Simple Retrieval-Augmented Generation

    Tianyu Fan, Jingyuan Wang, Xubin Ren, Chao Huang* (*Correspondence)

    🌍 README Translations

    中文说明 | 日本語

    🎉 News

    • [2025.02.27]🎯📢Now you can use pip install minirag-hku to run our code!
    • [2025.02.14]🎯📢Now MiniRAG supports 10+ heterogeneous graph databases, including Neo4j, PostgreSQL, TiDB, etc. Happy valentine's day!🌹🌹🌹
    • [2025.02.05]🎯📢Our team has released VideoRAG understanding extremely long-context videos.
    • [2025.02.01]🎯📢Now MiniRAG supports API&Docker deployment. see This for more details.

    TLDR

    MiniRAG is an extremely simple retrieval-augmented generation framework that enables small models to achieve good RAG performance through heterogeneous graph indexing and lightweight topology-enhanced retrieval.

    Abstract

    The growing demand for efficient and lightweight Retrieval-Augmented Generation (RAG) systems has highlighted significant challenges when deploying Small Language Models (SLMs) in existing RAG frameworks. Current approaches face severe performance degradation due to SLMs' limited semantic understanding and text processing capabilities, creating barriers for widespread adoption in resource-constrained scenarios. To address these fundamental limitations, we present MiniRAG, a novel RAG system designed for extreme simplicity and efficiency. MiniRAG introduces two key technical innovations: (1) a semantic-aware heterogeneous graph indexing mechanism that combines text chunks and named entities in a unified structure, reducing reliance on complex semantic understanding, and (2) a lightweight topology-enhanced retrieval approach that leverages graph structures for efficient knowledge discovery without requiring advanced language capabilities. Our extensive experiments demonstrate that MiniRAG achieves comparable performance to LLM-based methods even when using SLMs while requiring only 25% of the storage space. Additionally, we contribute a comprehensive benchmark dataset LiHua-World for evaluating lightweight RAG systems under realistic on-device scenarios with complex queries.

    MiniRAG Framework

    MiniRAG

    MiniRAG employs a streamlined workflow built on the key components: heterogeneous graph indexing and lightweight graph-based knowledge retrieval. This architecture addresses the unique challenges faced by on-device RAG systems, optimizing for both efficiency and effectiveness.

    Install

    • Install from source (Recommend)
    cd MiniRAG
    pip install -e .
    
    • Install from PyPI (Our code is based on LightRAG, so you can install it directly)
    pip install lightrag-hku
    

    Quick Start

    • All the code can be found in the ./reproduce.
    • Download the dataset you need.
    • Put the dataset in the ./dataset directory.
    • Note: We have already put the LiHua-World dataset in ./dataset/LiHua-World/data/ as LiHuaWorld.zip. If you want to use other dataset, you can put it in the ./dataset/xxx.

    Then use the following bash command to index the dataset:

    python ./reproduce/Step_0_index.py
    python ./reproduce/Step_1_QA.py
    

    Or, use the code in ./main.py to initialize MiniRAG.

    Overall Performance Table

    ModelNaiveRAGGraphRAGLightRAGMiniRAG
    acc↑err↓acc↑err↓acc↑err↓acc↑err↓
    LiHua-World
    Phi-3.5-mini-instruct41.22%23.20%//39.81%25.39%53.29%23.35%
    GLM-Edge-1.5B-Chat42.79%24.76%//35.74%25.86%52.51%25.71%
    Qwen2.5-3B-Instruct43.73%24.14%//39.18%28.68%48.75%26.02%
    MiniCPM3-4B43.42%17.08%//35.42%21.94%51.25%21.79%
    gpt-4o-mini46.55%19.12%35.27%37.77%56.90%20.85%54.08%19.44%
    MultiHop-RAG
    Phi-3.5-mini-instruct42.72%31.34%//27.03%11.78%49.96%28.44%
    GLM-Edge-1.5B-Chat44.44%24.26%////51.41%23.44%
    Qwen2.5-3B-Instruct39.48%31.69%//21.91%13.73%48.55%33.10%
    MiniCPM3-4B39.24%31.42%//19.48%10.41%47.77%26.88%
    gpt-4o-mini53.60%27.19%60.92%16.86%64.91%19.37%68.43%19.41%

    In the table, / means the method struggles to generate effective responses.

    Reproduce

    All the code can be found in the ./reproduce directory.

    Code Structure

    ├── dataset
    │   └── LiHua-World
    │       ├── README.md
    │       ├── README_CN.md
    │       ├── data
    │       │   ├── LiHuaWorld.zip
    │       └── qa
    │           ├── query_set.csv
    │           └── query_set.json
    ├── minirag
    │   ├── kg
    │   │   ├── __init__.py
    │   │   ├── neo4j_impl.py
    │   │   └── oracle_impl.py
    │   ├── __init__.py
    │   ├── base.py
    │   ├── exceptions.py
    │   ├── llm.py
    │   ├── minirag.py
    │   ├── operate.py
    │   ├── prompt.py
    │   ├── storage.py
    │   └── utils.py
    ├── reproduce
    │   ├── Step_0_index.py
    │   └── Step_1_QA.py
    ├── LICENSE
    ├── main.py
    ├── README.md
    ├── README_CN.md
    ├── requirements.txt
    ├── setup.py
    

    Dataset: LiHua-World

    LiHuaWorld

    LiHua-World is a dataset specifically designed for on-device RAG scenarios, containing one year of chat records from a virtual user named LiHua. The dataset includes three types of questions: single-hop, multi-hop, and summary, with each question paired with manually annotated answers and supporting documents. For more details, please refer to the README of LiHua-World dataset.

    Star History

    Contribution

    Thank you to all our contributors!

    Acknowledgements

    You may refer to related work that serves as foundations for our framework and code repository, nano-graphrag and LightRAG. Thanks for their wonderful works.

    🌟Citation

    @article{fan2025minirag,
      title={MiniRAG: Towards Extremely Simple Retrieval-Augmented Generation},
      author={Fan, Tianyu and Wang, Jingyuan and Ren, Xubin and Huang, Chao},
      journal={arXiv preprint arXiv:2501.06713},
      year={2025}
    }
    

    Thank you for your interest in our work!