DEV.co
RAG Frameworks · HKUDS

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.

Source: GitHub — github.com/HKUDS/MiniRAG
2k
GitHub stars
253
Forks
Python
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryHKUDS/MiniRAG
OwnerHKUDS
Primary languagePython
LicenseMIT — OSI-approved
Stars2k
Forks253
Open issues35
Latest releasev0.0.2 (2025-02-27)
Last updated2025-10-16
Sourcehttps://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.

Quickstart

Get the MiniRAG source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/HKUDS/MiniRAG.gitcd MiniRAG# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

On-Device RAG for Small Language Models

Deploy RAG systems on edge devices or resource-constrained environments using SLMs (3B–4B parameter range). MiniRAG achieves 48–53% accuracy on complex queries with minimal storage overhead, making it ideal for local/offline knowledge retrieval.

Multi-Hop Question Answering over Custom Knowledge Bases

Build QA systems for documents requiring multi-step reasoning. MiniRAG's graph-based topology retrieval excels on multi-hop queries, demonstrating strong performance on the MultiHop-RAG benchmark even with smaller models.

Lightweight Knowledge Graph Indexing and Search

Index large document corpora into heterogeneous graphs with reduced semantic complexity. Use Neo4j, PostgreSQL, or other supported databases for scalable entity-aware retrieval without heavy embedding or LLM-based preprocessing.

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.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

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).

Software development agency

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.co

Related 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?
Yes, if you deploy a local graph database (e.g., Neo4j community edition) and use an open-source SLM (Phi-3.5, Qwen2.5, etc.) offline. External API LLMs (gpt-4o-mini) require internet; use local SLMs to achieve full offline operation.
What's the typical storage reduction compared to traditional RAG?
According to the paper and experiments, MiniRAG uses approximately 25% of the storage space vs. LLM-based RAG methods. Exact reduction depends on corpus size, entity density, and graph database backend efficiency.
Which graph database should I choose for production?
Unknown from data provided. MiniRAG supports 10+ backends (Neo4j, PostgreSQL, TiDB mentioned); production choice depends on your scale, licensing requirements (Neo4j Community free for non-commercial; commercial editions costly), and operational expertise. Benchmark with your workload.
How do I tune entity extraction for my domain?
Not clearly documented. Review ./minirag/kg/ and prompt.py for extraction logic; MiniRAG's strength is reducing reliance on semantic understanding, so simple heuristic or rule-based entity extraction may suffice. Requires experimentation with your corpus.

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.