General Introduction
Fast GraphRAG is an open source tool developed by Circlemind AI to enable efficient and accurate retrieval augmentation generation (RAG) through knowledge graph and PageRank algorithms. The tool intelligently adapts to the user's usage scenarios, data and query requirements, providing an interpretable, cost-effective and efficient retrieval workflow.Fast GraphRAG is designed to run at scale without significant resources or costs, and supports real-time data updating and dynamic data generation, making it suitable for a variety of domains with knowledge management and information retrieval needs.
Using Fast-GraphRAG only costs, compared to the original 0.48, a savings of almost 6 times! And this cost-effectiveness increases further as the data size and number of inserts increase.
Function List
- Interpretable and debuggable knowledge graphs: Provide human navigable views of knowledge that can be queried, visualized and updated.
- High efficiency and low cost: Designed for large-scale operation without significant resources or costs.
- Dynamic Data Generation: Automatically generate and optimize maps to best fit your domain and ontology needs.
- incremental update: Supports real-time updates, adjusting as data changes.
- Intelligent Exploration: Utilize PageRank algorithm for graph exploration to improve accuracy and reliability.
- Asynchronous and type support: Fully asynchronous with full type support to ensure robust and predictable workflows.
Comparing LightRAG, GraphRAG and VectorDBs
consult (a document etc)
# Queries | Method | All queries % | Multihop only % |
---|---|---|---|
51 | |||
VectorDB | 0.49 | 0.32 | |
LightRAG | 0.47 | 0.32 | |
GraphRAG | 0.75 | 0.68 | |
Circlemind | 0.96 | 0.95 | |
101 | |||
VectorDB | 0.42 | 0.23 | |
LightRAG | 0.45 | 0.28 | |
GraphRAG | 0.73 | 0.64 | |
Circlemind | 0.93 | 0.90 |
Data insertion
Method | Time (minutes) |
---|---|
VectorDB | ~0.3 |
LightRAG | ~25 |
GraphRAG | ~40 |
Circlemind | ~1.5 |
In the query test, Fast GraphRAG achieves high accuracy of 96% and 95% in all queries and multi-hop queries, respectively, compared to VectorDB RAG Nearly four times higher.
Additionally, Fast GraphRAG measured insertion times for a benchmark test of the dataset (about 800 blocks): insertion time for Fast GraphRAG was about 1.5 minutes, which is 27 times faster than GraphRAG, and retrieval accuracy was improved by more than 401 TP3T.
Using Help
Installation process
- Installation from source (recommended for best performance)::
# Clone this repository
git clone https://github.com/circlemind-ai/fast-graphrag
cd fast-graphrag
poetry install
- Installation from PyPi (recommended stability)::
pip install fast-graphrag
Quick Start
- Set the OpenAI API key:
export OPENAI_API_KEY="sk-..."
- Download the text of A Christmas Carol:
curl https://raw.githubusercontent.com/circlemind-ai/fast-graphrag/refs/heads/main/mock_data.txt > . /book.txt
- Optional: Set the concurrent request limit:
export CONCURRENT_TASK_LIMIT=8
- Use the following Python code snippet:
from fast_graphrag import GraphRAG
DOMAIN = "Analyze this story Focus on how they interact with each other, the locations they explore, and their relationships."
EXAMPLE_QUERIES = [
"Who are the main characters?", "What locations are mentioned?
"What locations are mentioned?", "How do the characters interact?
"How do the characters interact?"
]
grag = GraphRAG(
example_queries=EXAMPLE_QUERIES, config=GraphRAG.
config=GraphRAG.Config(
llm_service=OpenAILLMService(
model="your-llm-model",
base_url="llm.api.url.com",
api_key="your-api-key", mode=instructor.
mode=instructor.
Mode.JSON, api_version="your-llm-api_version", client="openai or aztec
client="openai or azure"
),
embedding_service=OpenAIEmbeddingService(
model="your-embedding-model",
base_url="emb.api.url.com",
base_url="emb.api.url.com", api_key="your-api-key",
embedding_dim=512,
client="openai or azure"
),
),
)
Main function operation flow
- Knowledge Graph Generation: By defining domains and example queries, GraphRAG will automatically generate a knowledge graph adapted to your needs.
- Queries and visualizations: Query using the generated knowledge graph and view the results through visualization tools.
- real time update: As data changes, GraphRAG supports real-time updating of the knowledge graph to ensure that information is current and accurate.
- Intelligent Exploration: Utilizing the PageRank algorithm, GraphRAG is able to intelligently explore the knowledge graph to improve retrieval accuracy and reliability.