← Back to Leaderboard
Ngusye1234

gusye1234/nano-graphrag

Embeddable Python GraphRAG for entity-centric retrieval and corpus-wide synthesis

View on GitHub ↗
Engineering Health (Methodology)
B · 56/100
Maintenance Activity
● Updated 10mo ago
Latest Release
v0.0.8
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance6/35
Fork Adoption19/25
Release Cadence11/20
License Clarity20/20
APILocal AI
Total Stars
★ 4,017
24h Growth
+1
7d Growth
+2
Forks
427

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

gusye1234/nano-graphrag Star History (2024-07-31 - 2026-12-04) ALL-TIME STAR HISTORY (2024-07 – 2026-12) +4k in 856d · avg +5/day 4.2k 2.1k 0 2024-07-31: ★ 12024-09-21: ★ 7262024-11-16: ★ 1,3762025-01-11: ★ 2,0212025-03-08: ★ 2,4882025-05-03: ★ 2,7922025-06-28: ★ 2,9922025-08-23: ★ 3,1632025-10-18: ★ 3,3602025-12-13: ★ 3,4752026-02-07: ★ 3,6012026-04-04: ★ 3,7082026-05-30: ★ 3,8182026-07-25: ★ 3,9142026-09-19: ★ 3,9682026-12-04: ★ 4,017 ★ 4k 2024-07 2025-10 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

nano-graphrag is an embeddable Python SDK built around the GraphRAG and QueryParam dataclasses. insert and ainsert chunk documents, use model calls to extract entities and relationships, and build a graph whose communities are summarized into reports. Local search starts from relevant entities and assembles graph context; global search synthesizes across community reports. The optional naive path retrieves text chunks by embedding similarity instead of using graph context at query time.

The SDK separates key-value, vector and graph storage. Its default setup combines file-backed KV storage, nano-vectordb and NetworkX; hnswlib and Neo4j are built-in options for the vector and graph layers respectively. Model completion and embedding functions are injectable. Completion is split into a stronger model for planning and responses and a cheaper one for summarization, defaulting to gpt-4o and gpt-4o-mini. The Python dependencies include OpenAI, tiktoken, NetworkX, graspologic and tenacity alongside the storage and provider packages.

Key Capabilities & Differentiators

A caller can insert a document or a batch of strings, reopen the same working_dir to load persisted state, and choose local, global or naive retrieval per query. Both ingestion and querying have async entry points. Queries normally return a completed answer without streaming; only_need_context=True returns the assembled context so the application can supply its own prompt or generation layer. Global search considers at most 512 communities by default, adjustable via QueryParam.global_max_consider_community.

OpenAI, Azure OpenAI and Amazon Bedrock have built-in integrations. Examples show DeepSeek and Ollama generation, local sentence-transformers embeddings, and FAISS and Milvus Lite vector adapters. Chunking functions and prompts are replaceable, and a custom response-to-JSON converter can handle backends whose structured output needs post-processing. GraphML provides a visualization path. English and Chinese benchmark materials and a multi-hop evaluation notebook offer starting points for comparing retrieval modes on a representative corpus.

Trade-offs & Limitations

Compared with Microsoft's GraphRAG, this implementation gives developers a smaller Python surface to modify, but it is not a drop-in replacement. It omits covariates and uses a capped set of important or central communities for global search rather than processing the full community set in the original map-reduce-like approach. That cap bounds how many reports enter consideration, but themes concentrated in lower-ranked communities can be missed. Test global coverage on the target corpus rather than treating the default as a quality guarantee.

MD5-based content keys prevent duplicate chunks, but inserts that add new content still recompute graph communities and regenerate their reports. On a frequently updated corpus, that turns ingestion cadence into a cost and latency decision; measure the effect of batching before committing to continuous ingestion. Use naive chunk retrieval as a baseline when plain passage lookup may suffice. Cloud APIs reduce local model operations but introduce provider costs and data-handling considerations; local models shift capacity planning and structured-output reliability back to the operator.

Hardware & Deployment Guide

Install the Python package from PyPI with pip install nano-graphrag or from a source checkout with pip install -e .. The integration point is an in-process Python API, not a packaged HTTP service. For the file-backed path, give the application a writable, durable working_dir. OpenAI requires an API key; Azure OpenAI needs its environment settings and using_azure_openai=True; Bedrock needs AWS credentials, using_amazon_bedrock=True, and model IDs. Neo4j is an optional graph backend, not a prerequisite.

The hosted path shifts model compute to the provider, but the application still budgets for graph processing, vector indexing, storage and API concurrency. The no-key example combines Ollama and transformers; local RAM and VRAM requirements depend on the selected models, context lengths, embedding batches and concurrency. In the release history, v0.0.6 fixed HNSW local-query bugs, v0.0.7 added naive chunk RAG, and v0.0.8, dated October 1, 2024, added Azure OpenAI and DSPy-based entity extraction.

Python API: GraphRAG and QueryParam are dataclasses; ainsert and aquery expose the async path.
Retrieval modes: Local search starts from entities, global search uses community reports, and optional naive search retrieves text chunks.
Incremental ingestion: MD5-based content keys deduplicate repeated text, but new inserts still trigger community recomputation and report regeneration.
Storage adapters: File-backed KV, nano-vectordb and NetworkX form the default stack; hnswlib and Neo4j are built-in alternatives.
Model adapters: Built-in OpenAI, Azure OpenAI and Amazon Bedrock support; examples cover DeepSeek, Ollama and local sentence-transformers embeddings.
Application control: Context-only retrieval, configurable chunking, editable prompts and a custom JSON conversion hook.
Best For

Python teams prototyping or embedding entity-centric retrieval and corpus-wide synthesis, with room to swap models and storage or compare against chunk retrieval.

Skip If

You need parity with Microsoft's GraphRAG, a packaged streaming API, or frequent ingestion without community and report rebuilds.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

APILocal AI
# clone this repo first
cd nano-graphrag
pip install -e .

Comparison vs. Top RAG, Data & Memory Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
nano-graphrag ★4k+2PythonMITEmbeddable Python GraphRAG for entity-centric retrieval and corpus-wide synthesi
llama_index53.1k+104PythonMITA modular Python SDK for document ingestion, indexing, and RAG
haystack27.2k+53PythonApache-2.0Component-based Python orchestration for RAG pipelines and tool-using agents
auto-ontology19.1k+3.7kPythonApache-2.0An ontology framework that grounds agent-generated SQL in reviewed business defi

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/gusye1234/nano-graphrag.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

gusye1234/nano-graphrag Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about nano-graphrag

How do I integrate nano-graphrag into an async Python service?

Call GraphRAG.ainsert and GraphRAG.aquery from async application code, and set QueryParam(only_need_context=True) if the application owns prompt assembly or answer generation. The normal query interface returns a complete answer rather than a token stream. Keep the same working_dir to reload persisted state with the default setup.

Do I need a GPU, and what should I size the runtime for?

With cloud generation and embeddings, there is no local model VRAM requirement; size the host for Python, graph processing, vector indexing, and persisted data. With Ollama and local embeddings, RAM and VRAM needs depend on the selected models, context lengths, batches, and concurrency. Measure ingestion and querying separately, including community regeneration after inserts.

Can I use it commercially and keep document processing on premises?

The repository uses the MIT license, which permits commercial use, modification, and redistribution subject to retaining the required copyright and license notices. Check dependency and model licenses separately. A local working directory or Neo4j backend does not keep processing on premises if generation or embedding calls still go to a hosted provider.

When should I use nano-graphrag instead of Microsoft's GraphRAG or vector-only RAG?

Choose nano-graphrag when you need a compact Python implementation you can modify and can accept global search over selected communities without covariates. Choose Microsoft's GraphRAG if you depend on the original global-search approach or need covariates. If the goal is passage lookup rather than relationship traversal or corpus-wide synthesis, start with the built-in naive chunk retrieval as a baseline.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining gusye1234/nano-graphrag? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature gusye1234/nano-graphrag on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare