Intro on GraphRAG technique for RAG applications
Marco D'Alia
Software Architect, ex-Upwork | AI enthusiast, Llamaindex, LangChain, Typescript, Nest.js
A technique that is gaining traction for RAG is the GraphRAG, here's in short how it works:
Query
To query, you can apply different strategies of what kind of linked nodes you want to include in the context.
It all starts from a traditional KNN vector search, but then, you can:
? Global Search: get a broader "community" cluster of text nodes.
? Local Search:?fetch also linked nodes.
? DRIFT Search:?fetch linked nodes but with the added context of community information.
Examples
For extra details, check also this guide from @Microsoft: https://microsoft.github.io/graphrag/ or this guide (and colab) from LlamaIndex https://docs.llamaindex.ai/en/stable/examples/query_engine/knowledge_graph_rag_query_engine/
Is GraphRAG the right approach for your data?
I find that also this simpler technique proposed by Jerry Liu is a valid alternative when the input documents have chapters: https://github.com/run-llama/llama_parse/blob/main/examples/advanced_rag/dynamic_section_retrieval.ipynb