GraphRAG is now on GitHub (microsoft.com)
The team at Microsoft is pleased to announce that GraphRAG is now available in open-source!
Check out the announcement video: https://youtu.be/dsesHoTXyk0
GraphRAG is a research project from Microsoft exploring the use of knowledge graphs and large language models for enhanced retrieval augmented generation. It is an end-to-end system for richly understanding text-heavy datasets by combining text extraction, network analysis, LLM prompting, and summarization.
For more details on GraphRAG check out aka.ms/graphrag
Try out the Python code on your own machine: https://github.com/microsoft/graphrag
Easily deploy GraphRAG in Azure: https://github.com/Azure-Samples/graphrag-accelerator
Leave a comment below for what you want to build with GraphRAG!
52 comments
[ 408 ms ] story [ 1079 ms ] threadWhile building the backend of this, I have focused on building a composable set of APIs suitable for machine consumption - i.e to act as agentic tools.
I was looking for a good RAG framework to process the large amount of pdfs I have crawled, so the agents can then design and run simulations. This comes at just the right time! I am looking forward to trying it out
Knowledge graphs don't replace traditional semantic search, but they do unlock a whole new set of abilities when performing RAG, like both traversing down extremely long contexts and traversing across different contexts in a coherent, efficient way.
The only thing about KGs is that it's garbage-in-garbage-out and I've found my feeble attempts at using LLMs to generate graphs sorely lacking.. I can't wait to try this out.
At indexing time:
- run LLM over every data point multiple times ("gleanings") for entity extraction and constructing a graph index
- run an LLM over the graph multiple times to create clusters ("communities")
At query time:
- Run the LLM across all clusters, creating an answer from each and score them
- Run the LLM across all but the lowest scoring answers to produce a "global answer"
...aren't the compute requirements here untenable for any decent sized dataset?
The overall answer better be very good and relevant every time for this to tech to make sense.
Most solutions will want to focus on a very specific vertical application where the dataset is much more constrained. That we're this makes more sense.
Also a lot of alpha in data augmentation.
[1] https://www.youtube.com/watch?v=r09tJfON6kE
I understand the issues with "baseline RAG", as I experienced them myself. They make sense to me, if I query "what are the major themes of this dataset" on a list of articles, and the RAG tries to find content that's similar to that query, it probably won't find much.
Why does GraphRAG find something here? What's happening with my query that it suddenly "matches" the dataset?
> It does this by detecting “communities” of densely connected nodes in a hierarchical fashion, partitioning the graph at multiple levels from high-level themes to low-level topics, as illustrated in Figure 1. Using an LLM to summarize each of these communities creates a hierarchical summary of the data, providing an overview of a dataset without needing to know which questions to ask in advance. Each community serves as the basis of a community summary that describes its entities and their relationships.
[1] https://github.com/facebookresearch/faiss/
Looking at an example prompt from GraphRAG will make things clear https://github.com/microsoft/graphrag/blob/main/graphrag/pro...
especially these lines:
Return output in English as a single list of all the entities and relationships identified in steps 1 and 2.
Format each relationship as a JSON entry with the following format:
{{"source": <source_entity>, "target": <target_entity>, "relationship": <relationship_description>, "relationship_strength": <relationship_strength>}}
It looks like they just provide in the prompt a number of examples that follow the schema they want [2].
[1] https://github.com/microsoft/graphrag/blob/main/graphrag/ind...
[2] https://github.com/microsoft/graphrag/blob/main/graphrag/ind...
[1] https://www.promptingguide.ai/techniques/fewshot
Maybe Instructor makes the most sense only when you're working with potentially malicious user data
https://microsoft.github.io/graphrag/posts/config/overview/
Disclaimer: I'm the author of txtai
[1] https://neuml.hashnode.dev/introducing-the-semantic-graph
[2] https://neuml.hashnode.dev/generate-knowledge-with-semantic-...
[3] https://neuml.hashnode.dev/build-knowledge-graphs-with-llm-d...
[4] https://neuml.hashnode.dev/advanced-rag-with-graph-path-trav...
For that we wrote the GraphRAG-SDK that is also generating a stable Ontology. https://github.com/FalkorDB/GraphRAG-SDK