nano-graphrag
FreeA simple, easy-to-hack GraphRAG implementation
FreeFree tier
About nano-graphrag
nano-graphrag is a lightweight, open-source implementation of GraphRAG that prioritizes simplicity and hackability. With approximately 1100 lines of code (excluding tests and prompts), it offers a faster and cleaner alternative to the official GraphRAG library. It supports multiple backends including FAISS, Neo4j, and Ollama, and is fully typed and asynchronous. The tool enables both global and local graph-based retrieval-augmented generation (RAG) searches, incremental and batch document insertion, and naive RAG modes. It can be used with OpenAI, Azure OpenAI, Amazon Bedrock, or local models via transformers and Ollama.
Key Features
Approximately 1100 lines of core code, small and easy to hack
Supports OpenAI, Azure OpenAI, Amazon Bedrock, and local models (transformers, Ollama)
Portable backends: FAISS, Neo4j, Ollama
Asynchronous and fully typed codebase
Incremental insert with MD5-hash deduplication
Global and local graph search modes
Naive RAG insert and query support
Batch document insertion
Pros & Cons
Pros
- Extremely lightweight (~1100 lines) making it easy to understand and modify
- Portable across multiple vector stores and LLM backends
- Supports both global and local graph search strategies
- Incremental insertion avoids duplicate processing
- Fully asynchronous for better performance
- Open source with permissive license (MIT based on GitHub)
Cons
- Community re-computation occurs on each insert, regenerating community reports
- Requires API keys for cloud LLM backends or local model setup
- Limited documentation beyond the README and examples
- Less mature than the official GraphRAG implementation
Best For
Building knowledge graphs from text documents for RAGHacking or extending GraphRAG for research or custom applicationsCreating a lightweight, self-hosted RAG system with graph capabilitiesQuerying themes and relationships from stories or long texts
FAQ
How do I install nano-graphrag?
You can install from source by cloning the repo and running 'pip install -e .' or from PyPi with 'pip install nano-graphrag'.
Which LLM backends are supported?
nano-graphrag supports OpenAI, Azure OpenAI, Amazon Bedrock, and local models via transformers and Ollama.
Does nano-graphrag support incremental insert?
Yes, it supports incremental insert using MD5-hash of content to avoid duplicate chunks, though communities will be re-computed each time.
What is the difference between global and local graph search?
Global search queries the entire graph for themes, while local search focuses on a specific subgraph, which the author suggests is more scalable.