LightRAG
LightRAG is an open source, graph-based retrieval-augmented generation framework you can self-host — it builds a knowledge graph from your documents so LLMs answer with grounded, connected context, standing in for managed services like Azure AI Search.
What is LightRAG?
LightRAG is an open source Python framework for graph-based retrieval-augmented generation (RAG). Instead of only chunking your documents and matching them by vector similarity, it extracts entities and the relationships between them into a knowledge graph, then retrieves over both the graph and the vectors so an LLM answers with connected, grounded context.
What is LightRAG best for?
LightRAG suits developers and teams building a RAG pipeline over their own documents who want the relationship-aware quality of a knowledge graph without the cost and slow indexing of Microsoft’s GraphRAG. It’s a strong fit for question-answering over large, interconnected corpora — legal, research, technical, or domain-specific knowledge bases.
What can LightRAG do?
- Build a knowledge graph of entities and relationships from raw documents automatically
- Retrieve with dual-level search — low-level for specific facts, high-level for broad concepts
- Update the graph incrementally as new documents arrive, without rebuilding from scratch
- Plug into any OpenAI-compatible LLM and embedding model, or run fully local via Ollama
- Store data across pluggable backends: PostgreSQL, Neo4j, Milvus, Qdrant, MongoDB, or OpenSearch
- Serve a REST API and web UI for uploading documents, running queries, and exploring the graph
- Parse multimodal inputs — images, tables, and formulas — via MinerU or Docling
Where does LightRAG fall short?
- The embedding model is effectively permanent: switching it means re-embedding and re-indexing your entire corpus, so choose carefully up front.
- Graph-based retrieval can inject noise — some evaluations find it boosts evidence recall but lowers context relevance versus plain vector RAG, so answer quality varies by dataset.
- It’s a framework, not a finished product. The default in-memory storage is for testing only, and some features (like the LLM cache) are exposed only through the Python SDK, not the REST API.
Is LightRAG free?
Yes — LightRAG is fully free and open source under the MIT license, with no paid edition, cloud tier, or feature gating. There is no vendor to pay. Your only running cost is the infrastructure it sits on plus the LLM and embedding API calls it makes (or nothing extra if you run those models locally).
What does LightRAG replace?
LightRAG is a self-hosted alternative to managed retrieval services like Azure AI Search and Amazon Kendra. It gives you the indexing-and-retrieval layer behind a RAG app, but you run it on your own infrastructure and keep your documents and knowledge graph in your control.
FAQ
Is LightRAG open source? Yes — it’s released under the MIT license, one of the most permissive open source licenses, so you can self-host, modify, and use it commercially without restriction.
Can I self-host LightRAG for free? Yes. Self-hosting is free; you only pay for the server and for whatever LLM and embedding calls you make. Point it at a local model through Ollama and you can run the whole pipeline with no API bills.
How is LightRAG different from GraphRAG? Both build a knowledge graph, but LightRAG uses lightweight entity-and-relationship retrieval instead of GraphRAG’s community traversal, making indexing and queries dramatically cheaper and supporting incremental updates without a full rebuild.
What do I need to run LightRAG? Python 3.10+, an OpenAI-compatible LLM and embedding model (hosted or local), and for production a real storage backend such as PostgreSQL or Neo4j rather than the default in-memory store.