MiniRAG
MiniRAG is a Python-based retrieval-augmented generation (RAG) framework designed to work efficiently with small language models (SLMs) on resource-constrained devices. It uses heterogeneous graph indexing and lightweight topology-enhanced retrieval to achieve comparable performance to larger models while using 25% of the storage space.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | HKUDS/MiniRAG |
| Owner | HKUDS |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 2k |
| Forks | 253 |
| Open issues | 35 |
| Latest release | v0.0.2 (2025-02-27) |
| Last updated | 2025-10-16 |
| Source | https://github.com/HKUDS/MiniRAG |
What MiniRAG is
MiniRAG implements semantic-aware heterogeneous graph indexing that combines text chunks and named entities in a unified structure, paired with a lightweight graph-based retrieval mechanism. The framework supports 10+ heterogeneous graph databases (Neo4j, PostgreSQL, TiDB, etc.) and is deployable via API and Docker; it was benchmarked against NaiveRAG, GraphRAG, and LightRAG on the LiHua-World and MultiHop-RAG datasets.
Get the MiniRAG source
Clone the repository and explore it locally.
git clone https://github.com/HKUDS/MiniRAG.gitcd MiniRAG# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Python environment and graph database setup (Neo4j, PostgreSQL, TiDB, or 7+ others); Docker and API deployment options available as of Feb 2025.
- Choose target SLM (Phi-3.5-mini, GLM-Edge-1.5B, Qwen2.5-3B, MiniCPM3-4B) based on latency and accuracy trade-offs; benchmark tables show variable performance across models.
- Dataset preparation: organize documents in ./dataset directory and run Step_0_index.py followed by Step_1_QA.py for indexing and retrieval; LiHua-World benchmark dataset included.
- Graph indexing design: entity extraction and chunk-to-entity linking quality directly impact retrieval accuracy; test extraction rules on your domain before production indexing.
- Storage optimization: approximately 25% of storage vs. comparable systems, but verify actual footprint with your corpus size and database backend.
When to avoid it — and what to weigh
- Requiring State-of-the-Art Semantic Understanding — If your application demands cutting-edge semantic matching (e.g., nuanced paraphrasing or out-of-vocabulary entity resolution), MiniRAG's lightweight design prioritizes efficiency over semantic depth. Consider larger RAG frameworks for high-precision semantic tasks.
- Production Deployments Requiring Extensive Operational Support — Project is young (created Jan 2025, latest release Feb 2025) with limited track record in production environments. Evaluate operational maturity, vendor support, and SLA requirements before critical deployments.
- Use Cases Demanding Real-Time Sub-100ms Latency — MiniRAG is optimized for efficiency on SLMs, but graph traversal and retrieval latency may not meet ultra-low-latency requirements. Benchmark against your specific SLM and graph database setup.
- Absence of Custom Graph Database Infrastructure — Requires deployment of a supported graph database (Neo4j, PostgreSQL, TiDB, etc.). If you cannot manage additional database infrastructure, consider pure embedding-based RAG alternatives.
License & commercial use
Licensed under MIT (MIT License), a permissive open-source license permitting commercial use, modification, and distribution with minimal restrictions. Attribution required; warranty disclaimed.
MIT license permits commercial use of MiniRAG framework itself without restrictions. However, ensure compliance with licenses of graph database backends (e.g., Neo4j Community vs. commercial editions) and any SLM licenses (e.g., Phi-3.5, Qwen2.5 terms). No warranty provided; suitable for commercial evaluation, but production deployment requires independent security and operational review.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
No security audit or threat model disclosed. Considerations: graph database access control and authentication must be implemented independently (outside MiniRAG scope); user input sanitization for entity extraction and queries not explicitly addressed; no mention of prompt injection mitigations or output validation. Lightweight design may reduce attack surface vs. heavy LLM systems, but verify security posture of graph database backend and SLM endpoint. Production deployments require security review.
Alternatives to consider
LightRAG (HKUDS/LightRAG)
MiniRAG's direct predecessor; optimized for larger models and dense retrievals. Use LightRAG if you have more compute and want higher accuracy; use MiniRAG if targeting edge devices with SLMs.
GraphRAG (Microsoft)
Heavier, LLM-native graph-based RAG; superior semantic understanding but higher latency and cost. Use GraphRAG for complex reasoning; use MiniRAG for lightweight, on-device scenarios.
nano-graphrag
Lightweight graph RAG alternative; MiniRAG is partially derived from nano-graphrag. Choose nano-graphrag if prefer minimal dependencies; choose MiniRAG for production-oriented features (Docker, API, broader DB support).
Build on MiniRAG with DEV.co software developers
Start with `pip install minirag-hku` and the included LiHua-World benchmark. Evaluate MiniRAG on your SLM and documents to validate efficiency gains. Contact our team for production deployment guidance and custom graph database setup.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
MiniRAG FAQ
Can MiniRAG run entirely offline without external services?
What's the typical storage reduction compared to traditional RAG?
Which graph database should I choose for production?
How do I tune entity extraction for my domain?
Software developers & web developers for hire
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If MiniRAG is part of your rag frameworks roadmap, our team can implement, customize, migrate, and maintain it.
Ready to Deploy Lightweight RAG?
Start with `pip install minirag-hku` and the included LiHua-World benchmark. Evaluate MiniRAG on your SLM and documents to validate efficiency gains. Contact our team for production deployment guidance and custom graph database setup.